diff options
author | Scott Lobdell <slobdell@google.com> | 2021-04-25 19:53:00 +0000 |
---|---|---|
committer | Scott Lobdell <slobdell@google.com> | 2021-04-25 19:53:00 +0000 |
commit | dfa7c0a9b59c4ef591f46f7624dfe687c2bb0a6c (patch) | |
tree | 4b78af6f79fb9de2a712ac6268059bf838000a40 /tests/dl_test.cpp | |
parent | 987dccb5f063052171fae7a59cbf9fca808f8f80 (diff) | |
parent | 4626df89bfb561fc06d805e04d040a15f378919f (diff) |
Merge SP1A.210425.001
Change-Id: If71c56f3e2e9fbbeffc7096a560a5ef8b8cd8566
Diffstat (limited to 'tests/dl_test.cpp')
-rw-r--r-- | tests/dl_test.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp index 6c9bf3fb5..766f27a0b 100644 --- a/tests/dl_test.cpp +++ b/tests/dl_test.cpp @@ -27,9 +27,10 @@ #include <stdint.h> #include <sys/stat.h> -#include <string> -#include <iostream> #include <fstream> +#include <iostream> +#include <regex> +#include <string> #include "gtest_globals.h" #include <android-base/file.h> @@ -382,7 +383,8 @@ static void RelocationsTest(const char* lib, const char* expectation) { ExecTestHelper eth; eth.SetArgs({ "readelf", "-SW", path.c_str(), nullptr }); eth.Run([&]() { execvpe("readelf", eth.GetArgs(), eth.GetEnv()); }, 0, nullptr); - ASSERT_TRUE(eth.GetOutput().find(expectation) != std::string::npos) << eth.GetOutput(); + + ASSERT_TRUE(std::regex_search(eth.GetOutput(), std::regex(expectation))) << eth.GetOutput(); // Can we load it? void* handle = dlopen(lib, RTLD_NOW); @@ -395,31 +397,29 @@ static void RelocationsTest(const char* lib, const char* expectation) { } TEST(dl, relocations_RELR) { - RelocationsTest("librelocations-RELR.so", - ".relr.dyn RELR"); + RelocationsTest("librelocations-RELR.so", "\\.relr\\.dyn * RELR"); } TEST(dl, relocations_ANDROID_RELR) { - RelocationsTest("librelocations-ANDROID_RELR.so", - ".relr.dyn ANDROID_RELR"); + RelocationsTest("librelocations-ANDROID_RELR.so", "\\.relr\\.dyn * ANDROID_RELR"); } TEST(dl, relocations_ANDROID_REL) { RelocationsTest("librelocations-ANDROID_REL.so", #if __LP64__ - ".rela.dyn ANDROID_RELA" + "\\.rela\\.dyn * ANDROID_RELA" #else - ".rel.dyn ANDROID_REL" + "\\.rel\\.dyn * ANDROID_REL" #endif - ); + ); } TEST(dl, relocations_fat) { RelocationsTest("librelocations-fat.so", #if __LP64__ - ".rela.dyn RELA" + "\\.rela\\.dyn * RELA" #else - ".rel.dyn REL" + "\\.rel\\.dyn * REL" #endif - ); + ); } |