Make sure that the same tests are on all platforms.
In order to be able to generate a list of tests for cts, the same set of tests must exist across all platforms. This CL adds empty tests where a test was conditionally compiled out. This CL creates a single library libBionicTests that includes all of the tests found in bionic-unit-tests-static. Also fix a few missing include files in some test files. Tested by running and compiling the tests for every platform and verifying the same number of tests are on each platform. Change-Id: I9989d4bfebb0f9c409a0ce7e87169299eac605a2
This commit is contained in:
@@ -38,7 +38,9 @@ static void TestDirname(const char* in, const char* expected_out) {
|
||||
free(writable_in);
|
||||
}
|
||||
|
||||
TEST(libgen, basename) {
|
||||
// Do not use basename as the test name, it's defined to another value in glibc
|
||||
// so leads to a differently named test on host versus target architectures.
|
||||
TEST(libgen, basename_smoke) {
|
||||
TestBasename(NULL, ".");
|
||||
TestBasename("", ".");
|
||||
TestBasename("/usr/lib", "lib");
|
||||
@@ -62,8 +64,7 @@ TEST(libgen, dirname) {
|
||||
TestDirname("/", "/");
|
||||
}
|
||||
|
||||
#if __BIONIC__
|
||||
|
||||
#if defined(__BIONIC__)
|
||||
static void TestBasename(const char* in, const char* expected_out, int expected_rc,
|
||||
char* buf, size_t buf_size, int expected_errno) {
|
||||
errno = 0;
|
||||
@@ -85,8 +86,10 @@ static void TestDirname(const char* in, const char* expected_out, int expected_r
|
||||
}
|
||||
ASSERT_EQ(expected_errno, errno) << in;
|
||||
}
|
||||
#endif // __BIONIC__
|
||||
|
||||
TEST(libgen, basename_r) {
|
||||
#if defined(__BIONIC__)
|
||||
char buf[256];
|
||||
TestBasename("", ".", 1, NULL, 0, 0);
|
||||
TestBasename("", ".", -1, buf, 0, ERANGE);
|
||||
@@ -99,9 +102,13 @@ TEST(libgen, basename_r) {
|
||||
TestBasename("/", "/", 1, buf, sizeof(buf), 0);
|
||||
TestBasename(".", ".", 1, buf, sizeof(buf), 0);
|
||||
TestBasename("..", "..", 2, buf, sizeof(buf), 0);
|
||||
#else // __BIONIC__
|
||||
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
||||
#endif // __BIONIC__
|
||||
}
|
||||
|
||||
TEST(libgen, dirname_r) {
|
||||
#if defined(__BIONIC__)
|
||||
char buf[256];
|
||||
TestDirname("", ".", 1, NULL, 0, 0);
|
||||
TestDirname("", ".", -1, buf, 0, ERANGE);
|
||||
@@ -112,6 +119,7 @@ TEST(libgen, dirname_r) {
|
||||
TestDirname("usr", ".", 1, buf, sizeof(buf), 0);
|
||||
TestDirname(".", ".", 1, buf, sizeof(buf), 0);
|
||||
TestDirname("..", ".", 1, buf, sizeof(buf), 0);
|
||||
#else // __BIONIC__
|
||||
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
||||
#endif // __BIONIC__
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user