aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/__aeabi_read_tp_test.cpp2
-rw-r--r--tests/async_safe_test.cpp16
-rw-r--r--tests/dl_test.cpp8
-rw-r--r--tests/dlext_test.cpp5
-rw-r--r--tests/dlfcn_test.cpp28
-rw-r--r--tests/elftls_dl_test.cpp6
-rw-r--r--tests/endian_test.cpp8
-rw-r--r--tests/fortify_test.cpp38
-rw-r--r--tests/getauxval_test.cpp2
-rw-r--r--tests/getcwd_test.cpp2
-rw-r--r--tests/grp_pwd_file_test.cpp12
-rw-r--r--tests/grp_pwd_test.cpp28
-rw-r--r--tests/libgen_test.cpp4
-rw-r--r--tests/link_test.cpp2
-rw-r--r--tests/malloc_iterate_test.cpp8
-rw-r--r--tests/malloc_test.cpp22
-rw-r--r--tests/math_test.cpp14
-rw-r--r--tests/membarrier_test.cpp11
-rw-r--r--tests/pthread_test.cpp61
-rw-r--r--tests/pty_test.cpp3
-rw-r--r--tests/sched_test.cpp2
-rw-r--r--tests/semaphore_test.cpp5
-rw-r--r--tests/signal_test.cpp2
-rw-r--r--tests/stack_protector_test.cpp2
-rw-r--r--tests/stdio_ext_test.cpp2
-rw-r--r--tests/stdio_test.cpp12
-rw-r--r--tests/string_test.cpp14
-rw-r--r--tests/sys_msg_test.cpp3
-rw-r--r--tests/sys_prctl_test.cpp5
-rw-r--r--tests/sys_ptrace_test.cpp45
-rw-r--r--tests/sys_random_test.cpp12
-rw-r--r--tests/sys_sem_test.cpp3
-rw-r--r--tests/sys_shm_test.cpp3
-rw-r--r--tests/sys_stat_test.cpp2
-rw-r--r--tests/system_properties_test.cpp26
-rw-r--r--tests/system_properties_test2.cpp4
-rw-r--r--tests/time_test.cpp2
-rw-r--r--tests/utils.h2
-rw-r--r--tests/wchar_test.cpp2
-rw-r--r--tests/wctype_test.cpp8
40 files changed, 187 insertions, 249 deletions
diff --git a/tests/__aeabi_read_tp_test.cpp b/tests/__aeabi_read_tp_test.cpp
index 697465879..7209a758a 100644
--- a/tests/__aeabi_read_tp_test.cpp
+++ b/tests/__aeabi_read_tp_test.cpp
@@ -38,6 +38,6 @@ TEST(aeabi, read_tp) {
#if defined(__arm__)
ASSERT_EQ(__aeabi_read_tp(), static_cast<void*>(__get_tls()));
#else
- GTEST_LOG_(INFO) << "__aeabi_read_tp is only available on arm32.\n";
+ GTEST_SKIP() << "__aeabi_read_tp is only available on arm32";
#endif
}
diff --git a/tests/async_safe_test.cpp b/tests/async_safe_test.cpp
index 4940e3af7..6c4758e71 100644
--- a/tests/async_safe_test.cpp
+++ b/tests/async_safe_test.cpp
@@ -104,7 +104,7 @@ TEST(async_safe_log, smoke) {
async_safe_format_buffer(buf, sizeof(buf), "a%lld,%d,%d,%dz", 0x1000000000LL, 6, 7, 8);
EXPECT_STREQ("a68719476736,6,7,8z", buf);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -114,7 +114,7 @@ TEST(async_safe_log, d_INT_MAX) {
async_safe_format_buffer(buf, sizeof(buf), "%d", INT_MAX);
EXPECT_STREQ("2147483647", buf);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -124,7 +124,7 @@ TEST(async_safe_log, d_INT_MIN) {
async_safe_format_buffer(buf, sizeof(buf), "%d", INT_MIN);
EXPECT_STREQ("-2147483648", buf);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -138,7 +138,7 @@ TEST(async_safe_log, ld_LONG_MAX) {
EXPECT_STREQ("2147483647", buf);
#endif
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -152,7 +152,7 @@ TEST(async_safe_log, ld_LONG_MIN) {
EXPECT_STREQ("-2147483648", buf);
#endif
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -162,7 +162,7 @@ TEST(async_safe_log, lld_LLONG_MAX) {
async_safe_format_buffer(buf, sizeof(buf), "%lld", LLONG_MAX);
EXPECT_STREQ("9223372036854775807", buf);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -172,7 +172,7 @@ TEST(async_safe_log, lld_LLONG_MIN) {
async_safe_format_buffer(buf, sizeof(buf), "%lld", LLONG_MIN);
EXPECT_STREQ("-9223372036854775808", buf);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -196,6 +196,6 @@ TEST(async_safe_log, buffer_overrun) {
ASSERT_EQ(4, async_safe_format_buffer(buf, 2, "xxxx"));
EXPECT_STREQ("x", buf);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index 468ce3d99..9e463948a 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -138,7 +138,7 @@ TEST(dl, exec_linker_load_self) {
TEST(dl, preinit_system_calls) {
#if defined(__BIONIC__)
- SKIP_WITH_HWASAN; // hwasan not initialized in preinit_array, b/124007027
+ SKIP_WITH_HWASAN << "hwasan not initialized in preinit_array, b/124007027";
std::string helper = GetTestlibRoot() +
"/preinit_syscall_test_helper/preinit_syscall_test_helper";
chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
@@ -150,7 +150,7 @@ TEST(dl, preinit_system_calls) {
TEST(dl, preinit_getauxval) {
#if defined(__BIONIC__)
- SKIP_WITH_HWASAN; // hwasan not initialized in preinit_array, b/124007027
+ SKIP_WITH_HWASAN << "hwasan not initialized in preinit_array, b/124007027";
std::string helper = GetTestlibRoot() +
"/preinit_getauxval_test_helper/preinit_getauxval_test_helper";
chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
@@ -242,7 +242,7 @@ static bool is_debuggable_build() {
// whose search paths include the 'ns2/' subdir.
TEST(dl, exec_with_ld_config_file) {
#if defined(__BIONIC__)
- SKIP_WITH_HWASAN; // libclang_rt.hwasan is not found with custom ld config
+ SKIP_WITH_HWASAN << "libclang_rt.hwasan is not found with custom ld config";
if (!is_debuggable_build()) {
// LD_CONFIG_FILE is not supported on user build
return;
@@ -265,7 +265,7 @@ TEST(dl, exec_with_ld_config_file) {
// additional namespaces other than the default namespace.
TEST(dl, exec_with_ld_config_file_with_ld_preload) {
#if defined(__BIONIC__)
- SKIP_WITH_HWASAN; // libclang_rt.hwasan is not found with custom ld config
+ SKIP_WITH_HWASAN << "libclang_rt.hwasan is not found with custom ld config";
if (!is_debuggable_build()) {
// LD_CONFIG_FILE is not supported on user build
return;
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index cace36c02..aa65a53fa 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -540,10 +540,7 @@ TEST_F(DlExtRelroSharingTest, RelroFileEmpty) {
}
TEST_F(DlExtRelroSharingTest, VerifyMemorySaving) {
- if (geteuid() != 0) {
- GTEST_LOG_(INFO) << "This test must be run as root.\n";
- return;
- }
+ if (geteuid() != 0) GTEST_SKIP() << "This test must be run as root";
TemporaryFile tf; // Use tf to get an unique filename.
ASSERT_NOERROR(close(tf.fd));
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 8a3b6f36d..311e462c9 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -254,8 +254,7 @@ TEST(dlfcn, dlopen_by_soname) {
TEST(dlfcn, dlopen_vdso) {
#if __has_include(<sys/auxv.h>)
if (getauxval(AT_SYSINFO_EHDR) == 0) {
- GTEST_LOG_(INFO) << "getauxval(AT_SYSINFO_EHDR) == 0, skipping this test.";
- return;
+ GTEST_SKIP() << "getauxval(AT_SYSINFO_EHDR) == 0, skipping this test";
}
#endif
@@ -970,9 +969,9 @@ TEST(dlfcn, dlopen_executable_by_absolute_path) {
#if defined(__BIONIC__)
ASSERT_EQ(handle1, handle2);
#else
- GTEST_LOG_(INFO) << "Skipping ASSERT_EQ(handle1, handle2) for glibc: "
- "it loads a separate copy of the main executable "
- "on dlopen by absolute path.";
+ GTEST_SKIP() << "Skipping ASSERT_EQ(handle1, handle2) for glibc: "
+ "it loads a separate copy of the main executable "
+ "on dlopen by absolute path";
#endif
}
@@ -997,7 +996,10 @@ TEST(dlfcn, dlopen_executable_by_absolute_path) {
#define ALTERNATE_PATH_TO_LIBC ALTERNATE_PATH_TO_SYSTEM_LIB "libc.so"
TEST(dlfcn, dladdr_libc) {
-#if defined(__BIONIC__)
+#if defined(__GLIBC__)
+ GTEST_SKIP() << "glibc returns libc.so's ldconfig path, which is a symlink (not a realpath)";
+#endif
+
Dl_info info;
void* addr = reinterpret_cast<void*>(puts); // well-known libc function
ASSERT_TRUE(dladdr(addr, &info) != 0);
@@ -1019,10 +1021,6 @@ TEST(dlfcn, dladdr_libc) {
// TODO: add check for dfi_fbase
ASSERT_STREQ("puts", info.dli_sname);
ASSERT_EQ(addr, info.dli_saddr);
-#else
- GTEST_LOG_(INFO) << "This test does nothing for glibc. Glibc returns path from ldconfig "
- "for libc.so, which is symlink itself (not a realpath).\n";
-#endif
}
TEST(dlfcn, dladdr_invalid) {
@@ -1060,7 +1058,7 @@ TEST(dlfcn, dlopen_library_with_only_gnu_hash) {
ASSERT_STREQ("getRandomNumber", dlinfo.dli_sname);
ASSERT_SUBSTR("libgnu-hash-table-library.so", dlinfo.dli_fname);
#else
- GTEST_LOG_(INFO) << "This test does nothing for mips/mips64; mips toolchain does not support '--hash-style=gnu'\n";
+ GTEST_SKIP() << "mips toolchain does not support '--hash-style=gnu'";
#endif
}
@@ -1178,13 +1176,13 @@ TEST(dlfcn, dlopen_symlink) {
// that calls dlopen(libc...). This is to test the situation
// described in b/7941716.
TEST(dlfcn, dlopen_dlopen_from_ctor) {
-#if defined(__BIONIC__)
+#if defined(__GLIBC__)
+ GTEST_SKIP() << "glibc segfaults if you try to call dlopen from a constructor";
+#endif
+
void* handle = dlopen("libtest_dlopen_from_ctor_main.so", RTLD_NOW);
ASSERT_TRUE(handle != nullptr) << dlerror();
dlclose(handle);
-#else
- GTEST_LOG_(INFO) << "This test is disabled for glibc (glibc segfaults if you try to call dlopen from a constructor).\n";
-#endif
}
static std::string g_fini_call_order_str;
diff --git a/tests/elftls_dl_test.cpp b/tests/elftls_dl_test.cpp
index 36bdc3b92..88225d81d 100644
--- a/tests/elftls_dl_test.cpp
+++ b/tests/elftls_dl_test.cpp
@@ -146,7 +146,7 @@ TEST(elftls_dl, tlsdesc_missing_weak) {
ASSERT_EQ(nullptr, missing_weak_dyn_tls_addr());
}).join();
#else
- GTEST_LOG_(INFO) << "This test is only run on TLSDESC-based targets.\n";
+ GTEST_SKIP() << "This test is only run on TLSDESC-based targets";
#endif
}
@@ -215,7 +215,7 @@ TEST(elftls_dl, dtv_resize) {
#undef LOAD_LIB
#else
- GTEST_LOG_(INFO) << "This test is skipped for glibc because it tests Bionic internals.";
+ GTEST_SKIP() << "test doesn't apply to glibc";
#endif
}
@@ -266,6 +266,6 @@ TEST(elftls_dl, dlclose_removes_entry) {
dlclose(lib);
}
#else
- GTEST_LOG_(INFO) << "This test is skipped for glibc because it tests Bionic internals.";
+ GTEST_SKIP() << "test doesn't apply to glibc";
#endif
}
diff --git a/tests/endian_test.cpp b/tests/endian_test.cpp
index 85d56f089..3d6dc4da4 100644
--- a/tests/endian_test.cpp
+++ b/tests/endian_test.cpp
@@ -46,7 +46,7 @@ TEST(endian, htons_htonl_htonq_macros) {
ASSERT_EQ(be32, htonl(le32));
ASSERT_EQ(be64, htonq(le64));
#else
- GTEST_LOG_(INFO) << "glibc doesn't have these macros";
+ GTEST_SKIP() << "glibc doesn't have htons/htonl/htonq in <endian.h>";
#endif
}
@@ -56,7 +56,7 @@ TEST(endian, ntohs_ntohl_ntohq_macros) {
ASSERT_EQ(le32, ntohl(be32));
ASSERT_EQ(le64, ntohq(be64));
#else
- GTEST_LOG_(INFO) << "glibc doesn't have these macros";
+ GTEST_SKIP() << "glibc doesn't have ntohs/ntohl/ntohq in <endian.h>";
#endif
}
@@ -90,7 +90,7 @@ TEST(endian, betoh16_betoh32_betoh64) {
ASSERT_EQ(le32, betoh32(be32));
ASSERT_EQ(le64, betoh64(be64));
#else
- GTEST_LOG_(INFO) << "glibc doesn't have these macros";
+ GTEST_SKIP() << "glibc doesn't have betoh16/betoh32/betoh64";
#endif
}
@@ -100,6 +100,6 @@ TEST(endian, letoh16_letoh32_letoh64) {
ASSERT_EQ(le32, letoh32(le32));
ASSERT_EQ(le64, letoh64(le64));
#else
- GTEST_LOG_(INFO) << "glibc doesn't have these macros";
+ GTEST_SKIP() << "glibc doesn't have letoh16/letoh32/letoh64";
#endif
}
diff --git a/tests/fortify_test.cpp b/tests/fortify_test.cpp
index bc33251dc..489b7018d 100644
--- a/tests/fortify_test.cpp
+++ b/tests/fortify_test.cpp
@@ -143,7 +143,7 @@ TEST_F(DEATHTEST, stpcpy_fortified2) {
ASSERT_FORTIFY(stpcpy(myfoo.empty, src));
free(src);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "stpcpy not available";
#endif // __BIONIC__
}
@@ -155,7 +155,7 @@ TEST_F(DEATHTEST, strcpy_fortified2) {
ASSERT_FORTIFY(strcpy(myfoo.empty, src));
free(src);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -167,7 +167,7 @@ TEST_F(DEATHTEST, strcpy2_fortified2) {
ASSERT_FORTIFY(strcpy(myfoo.empty, src));
free(src);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -179,7 +179,7 @@ TEST_F(DEATHTEST, strcpy3_fortified2) {
ASSERT_FORTIFY(strcpy(myfoo.one, src));
free(src);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -191,7 +191,7 @@ TEST_F(DEATHTEST, strchr_fortified2) {
ASSERT_FORTIFY(printf("%s", strchr(myfoo.a, 'a')));
ASSERT_FORTIFY(printf("%s", strchr(static_cast<const char*>(myfoo.a), 'a')));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -203,7 +203,7 @@ TEST_F(DEATHTEST, strrchr_fortified2) {
ASSERT_FORTIFY(printf("%s", strrchr(myfoo.a, 'a')));
ASSERT_FORTIFY(printf("%s", strrchr(static_cast<const char*>(myfoo.a), 'a')));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -215,7 +215,7 @@ TEST_F(DEATHTEST, memchr_fortified2) {
ASSERT_FORTIFY(printf("%s", memchr(myfoo.a, 'a', asize)));
ASSERT_FORTIFY(printf("%s", memchr(static_cast<const void*>(myfoo.a), 'a', asize)));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -227,7 +227,7 @@ TEST_F(DEATHTEST, memrchr_fortified2) {
ASSERT_FORTIFY(printf("%s", memrchr(myfoo.a, 'a', asize)));
ASSERT_FORTIFY(printf("%s", memrchr(static_cast<const void*>(myfoo.a), 'a', asize)));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -238,7 +238,7 @@ TEST_F(DEATHTEST, strlcpy_fortified2) {
size_t n = strlen(myfoo.a);
ASSERT_FORTIFY(strlcpy(myfoo.one, myfoo.a, n));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "strlcpy not available";
#endif // __BIONIC__
}
@@ -250,7 +250,7 @@ TEST_F(DEATHTEST, strlcat_fortified2) {
size_t n = strlen(myfoo.a);
ASSERT_FORTIFY(strlcat(myfoo.one, myfoo.a, n));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "strlcat not available";
#endif // __BIONIC__
}
@@ -315,7 +315,7 @@ TEST_F(DEATHTEST, strcpy_fortified) {
ASSERT_FORTIFY(strcpy(buf, orig));
free(orig);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -327,7 +327,7 @@ TEST_F(DEATHTEST, strcpy2_fortified) {
ASSERT_FORTIFY(strcpy(buf, orig));
free(orig);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -339,7 +339,7 @@ TEST_F(DEATHTEST, strcpy3_fortified) {
ASSERT_FORTIFY(strcpy(buf, orig));
free(orig);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -351,7 +351,7 @@ TEST_F(DEATHTEST, strcpy4_fortified) {
ASSERT_FORTIFY(strcpy(buf, orig));
free(orig);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -361,7 +361,7 @@ TEST_F(DEATHTEST, strlen_fortified) {
memcpy(buf, "0123456789", sizeof(buf));
ASSERT_FORTIFY(printf("%zd", strlen(buf)));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -371,7 +371,7 @@ TEST_F(DEATHTEST, strchr_fortified) {
memcpy(buf, "0123456789", sizeof(buf));
ASSERT_FORTIFY(printf("%s", strchr(buf, 'a')));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -381,7 +381,7 @@ TEST_F(DEATHTEST, strrchr_fortified) {
memcpy(buf, "0123456789", sizeof(buf));
ASSERT_FORTIFY(printf("%s", strrchr(buf, 'a')));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
}
@@ -393,7 +393,7 @@ TEST_F(DEATHTEST, strlcpy_fortified) {
size_t n = strlen(bufa);
ASSERT_FORTIFY(strlcpy(bufb, bufa, n));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "strlcpy not available";
#endif // __BIONIC__
}
@@ -406,7 +406,7 @@ TEST_F(DEATHTEST, strlcat_fortified) {
size_t n = strlen(bufa);
ASSERT_FORTIFY(strlcat(bufb, bufa, n));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "strlcat not available";
#endif // __BIONIC__
}
diff --git a/tests/getauxval_test.cpp b/tests/getauxval_test.cpp
index aa21817ba..f4ec7f570 100644
--- a/tests/getauxval_test.cpp
+++ b/tests/getauxval_test.cpp
@@ -61,5 +61,5 @@ TEST(getauxval, arm_has_AT_HWCAP2) {
return;
}
#endif
- GTEST_LOG_(INFO) << "This test is only meaningful for 32-bit ARM code on 64-bit devices.\n";
+ GTEST_SKIP() << "This test is only meaningful for 32-bit ARM code on 64-bit devices";
}
diff --git a/tests/getcwd_test.cpp b/tests/getcwd_test.cpp
index 791ffae59..97b1d4f29 100644
--- a/tests/getcwd_test.cpp
+++ b/tests/getcwd_test.cpp
@@ -51,7 +51,7 @@ TEST(getcwd, auto_too_small) {
}
TEST(getcwd, auto_too_large) {
- SKIP_WITH_HWASAN; // allocation size too large
+ SKIP_WITH_HWASAN << "allocation size too large";
// If we ask the library to allocate an unreasonably large buffer, ERANGE.
errno = 0;
char* cwd = getcwd(nullptr, static_cast<size_t>(-1));
diff --git a/tests/grp_pwd_file_test.cpp b/tests/grp_pwd_file_test.cpp
index 66866fb48..adcdbd6e6 100644
--- a/tests/grp_pwd_file_test.cpp
+++ b/tests/grp_pwd_file_test.cpp
@@ -103,7 +103,7 @@ TEST(grp_pwd_file, passwd_file_one_entry) {
EXPECT_FALSE(passwd_file.FindById(3, nullptr));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -123,7 +123,7 @@ TEST(grp_pwd_file, group_file_one_entry) {
EXPECT_FALSE(group_file.FindById(3, nullptr));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -161,7 +161,7 @@ TEST(grp_pwd_file, passwd_file_many_entries) {
EXPECT_FALSE(passwd_file.FindById(50, nullptr));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -197,7 +197,7 @@ TEST(grp_pwd_file, group_file_many_entries) {
EXPECT_FALSE(group_file.FindById(799, nullptr));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -219,7 +219,7 @@ TEST(grp_pwd_file, passwd_file_required_prefix) {
FindAndCheckPasswdEntry(&passwd_file, "vendor_name", 3, 4, "dir", "shell");
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -241,6 +241,6 @@ TEST(grp_pwd_file, group_file_required_prefix) {
FindAndCheckGroupEntry(&group_file, "vendor_name", 2);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
diff --git a/tests/grp_pwd_test.cpp b/tests/grp_pwd_test.cpp
index eb8fe2a85..b46839bf4 100644
--- a/tests/grp_pwd_test.cpp
+++ b/tests/grp_pwd_test.cpp
@@ -138,17 +138,13 @@ static void check_get_passwd(const char* username, uid_t uid, uid_type_t uid_typ
#else // !defined(__BIONIC__)
-static void print_no_getpwnam_test_info() {
- GTEST_LOG_(INFO) << "This test is about uid/username translation for Android, which does nothing on libc other than bionic.\n";
-}
-
static void check_get_passwd(const char* /* username */, uid_t /* uid */, uid_type_t /* uid_type */,
bool /* check_username */) {
- print_no_getpwnam_test_info();
+ GTEST_SKIP() << "bionic-only test";
}
static void check_get_passwd(const char* /* username */, uid_t /* uid */, uid_type_t /* uid_type */) {
- print_no_getpwnam_test_info();
+ GTEST_SKIP() << "bionic-only test";
}
#endif
@@ -311,7 +307,7 @@ TEST(pwd, getpwent_iterate) {
expect_ids(uids);
#else
- print_no_getpwnam_test_info();
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -382,16 +378,12 @@ static void check_get_group(const char* group_name, gid_t gid, bool check_groupn
#else // !defined(__BIONIC__)
-static void print_no_getgrnam_test_info() {
- GTEST_LOG_(INFO) << "This test is about gid/group_name translation for Android, which does nothing on libc other than bionic.\n";
-}
-
static void check_get_group(const char*, gid_t, bool) {
- print_no_getgrnam_test_info();
+ GTEST_SKIP() << "bionic-only test";
}
static void check_get_group(const char*, gid_t) {
- print_no_getgrnam_test_info();
+ GTEST_SKIP() << "bionic-only test";
}
#endif
@@ -501,7 +493,7 @@ TEST(grp, getgrnam_r_reentrancy) {
check_group(grp[0], "root", 0);
check_group(grp[1], "system", 1000);
#else
- print_no_getgrnam_test_info();
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -521,7 +513,7 @@ TEST(grp, getgrgid_r_reentrancy) {
check_group(grp[0], "root", 0);
check_group(grp[1], "system", 1000);
#else
- print_no_getgrnam_test_info();
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -561,7 +553,7 @@ TEST(grp, getgrent_iterate) {
expect_ids(gids);
#else
- print_no_getgrnam_test_info();
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -590,7 +582,7 @@ TEST(pwd, vendor_prefix_users) {
TestAidNamePrefix("/vendor/etc/passwd");
#else
- print_no_getpwnam_test_info();
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -602,6 +594,6 @@ TEST(pwd, vendor_prefix_groups) {
TestAidNamePrefix("/vendor/etc/group");
#else
- print_no_getgrnam_test_info();
+ GTEST_SKIP() << "bionic-only test";
#endif
}
diff --git a/tests/libgen_test.cpp b/tests/libgen_test.cpp
index d5b5eb6ec..24f7923d9 100644
--- a/tests/libgen_test.cpp
+++ b/tests/libgen_test.cpp
@@ -78,7 +78,7 @@ TEST(libgen, basename_r) {
TestBasename(".", ".", 1, buf, sizeof(buf), 0);
TestBasename("..", "..", 2, buf, sizeof(buf), 0);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "basename_r is only available on 32-bit bionic";
#endif // __BIONIC__
}
@@ -95,6 +95,6 @@ TEST(libgen, dirname_r) {
TestDirname(".", ".", 1, buf, sizeof(buf), 0);
TestDirname("..", ".", 1, buf, sizeof(buf), 0);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "dirname_r is only available on 32-bit bionic";
#endif // __BIONIC__
}
diff --git a/tests/link_test.cpp b/tests/link_test.cpp
index 1bdee9ff4..cf5fc0bb0 100644
--- a/tests/link_test.cpp
+++ b/tests/link_test.cpp
@@ -231,6 +231,6 @@ TEST(link, dl_unwind_find_exidx) {
}
ASSERT_TRUE(found);
#else
- GTEST_LOG_(INFO) << "dl_unwind_find_exidx is an ARM-only API\n";
+ GTEST_SKIP() << "dl_unwind_find_exidx is an ARM-only API";
#endif
}
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp
index 76583ebb5..9d4fe040a 100644
--- a/tests/malloc_iterate_test.cpp
+++ b/tests/malloc_iterate_test.cpp
@@ -150,7 +150,7 @@ TEST(malloc_iterate, small_allocs) {
FreePtrs(&test_data);
#else
- GTEST_LOG_(INFO) << "Skipping, this is a bionic only test.";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -169,7 +169,7 @@ TEST(malloc_iterate, large_allocs) {
FreePtrs(&test_data);
#else
- GTEST_LOG_(INFO) << "Skipping, this is a bionic only test.";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -193,7 +193,7 @@ TEST(malloc_iterate, invalid_pointers) {
ASSERT_EQ(0UL, test_data.total_allocated_bytes);
#else
- GTEST_LOG_(INFO) << "Skipping, this is a bionic only test.";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -222,6 +222,6 @@ TEST(malloc_iterate, malloc_disable_prevents_allocs) {
ASSERT_NE(-1, wait_pid) << "Unknown failure in waitpid.";
ASSERT_EQ(0, wait_pid) << "malloc_disable did not prevent allocation calls.";
#else
- GTEST_LOG_(INFO) << "Skipping, this is a bionic only test.";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index bc6a37b75..0226a2d68 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -89,7 +89,7 @@ TEST(malloc, calloc_overflow) {
}
TEST(malloc, memalign_multiple) {
- SKIP_WITH_HWASAN; // hwasan requires power of 2 alignment.
+ SKIP_WITH_HWASAN << "hwasan requires power of 2 alignment";
// Memalign test where the alignment is any value.
for (size_t i = 0; i <= 12; i++) {
for (size_t alignment = 1 << i; alignment < (1U << (i+1)); alignment++) {
@@ -526,24 +526,24 @@ TEST(malloc, mallopt_smoke) {
TEST(malloc, mallopt_decay) {
#if defined(__BIONIC__)
- SKIP_WITH_HWASAN; // hwasan does not implement mallopt
+ SKIP_WITH_HWASAN << "hwasan does not implement mallopt";
errno = 0;
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 1));
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 0));
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 1));
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 0));
#else
- GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
TEST(malloc, mallopt_purge) {
#if defined(__BIONIC__)
- SKIP_WITH_HWASAN; // hwasan does not implement mallopt
+ SKIP_WITH_HWASAN << "hwasan does not implement mallopt";
errno = 0;
ASSERT_EQ(1, mallopt(M_PURGE, 0));
#else
- GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -561,7 +561,7 @@ TEST(malloc, reallocarray_overflow) {
ASSERT_TRUE(reallocarray(nullptr, b, a) == nullptr);
ASSERT_EQ(ENOMEM, errno);
#else
- GTEST_LOG_(INFO) << "This test requires a C library with reallocarray.\n";
+ GTEST_SKIP() << "reallocarray not available";
#endif
}
@@ -571,13 +571,13 @@ TEST(malloc, reallocarray) {
ASSERT_TRUE(p != nullptr);
ASSERT_GE(malloc_usable_size(p), 64U);
#else
- GTEST_LOG_(INFO) << "This test requires a C library with reallocarray.\n";
+ GTEST_SKIP() << "reallocarray not available";
#endif
}
TEST(malloc, mallinfo) {
#if defined(__BIONIC__)
- SKIP_WITH_HWASAN; // hwasan does not implement mallinfo
+ SKIP_WITH_HWASAN << "hwasan does not implement mallinfo";
static size_t sizes[] = {
8, 32, 128, 4096, 32768, 131072, 1024000, 10240000, 20480000, 300000000
};
@@ -616,7 +616,7 @@ TEST(malloc, mallinfo) {
<< kMaxAllocs << " allocations.";
}
#else
- GTEST_LOG_(INFO) << "Host glibc does not pass this test, skipping.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif
}
@@ -627,7 +627,7 @@ TEST(android_mallopt, error_on_unexpected_option) {
EXPECT_EQ(false, android_mallopt(unrecognized_option, nullptr, 0));
EXPECT_EQ(ENOTSUP, errno);
#else
- GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -673,6 +673,6 @@ TEST(android_mallopt, init_zygote_child_profiling) {
EXPECT_EQ(ENOTSUP, errno);
}
#else
- GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
diff --git a/tests/math_test.cpp b/tests/math_test.cpp
index f816fad48..1dd45b408 100644
--- a/tests/math_test.cpp
+++ b/tests/math_test.cpp
@@ -388,7 +388,7 @@ TEST(MATH_TEST, __isnormal) {
ASSERT_TRUE(__isnormal(123.0));
ASSERT_FALSE(__isnormal(double_subnormal()));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "glibc doesn't have __isnormal.\n";
+ GTEST_SKIP() << "glibc doesn't have __isnormal";
#endif // __BIONIC__
}
@@ -397,7 +397,7 @@ TEST(MATH_TEST, __isnormalf) {
ASSERT_TRUE(__isnormalf(123.0f));
ASSERT_FALSE(__isnormalf(float_subnormal()));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "glibc doesn't have __isnormalf.\n";
+ GTEST_SKIP() << "glibc doesn't have __isnormalf";
#endif // __BIONIC__
}
@@ -406,7 +406,7 @@ TEST(MATH_TEST, isnormalf) {
ASSERT_TRUE(isnormalf(123.0f));
ASSERT_FALSE(isnormalf(float_subnormal()));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "glibc doesn't have isnormalf.\n";
+ GTEST_SKIP() << "glibc doesn't have isnormalf";
#endif // __BIONIC__
}
@@ -415,7 +415,7 @@ TEST(MATH_TEST, __isnormall) {
ASSERT_TRUE(__isnormall(123.0L));
ASSERT_FALSE(__isnormall(ldouble_subnormal()));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "glibc doesn't have __isnormall.\n";
+ GTEST_SKIP() << "glibc doesn't have __isnormall";
#endif // __BIONIC__
}
@@ -424,7 +424,7 @@ TEST(MATH_TEST, isnormall) {
ASSERT_TRUE(isnormall(123.0L));
ASSERT_FALSE(isnormall(ldouble_subnormal()));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "glibc doesn't have isnormall.\n";
+ GTEST_SKIP() << "glibc doesn't have isnormall";
#endif // __BIONIC__
}
@@ -1396,7 +1396,7 @@ TEST(MATH_TEST, gamma_r) {
ASSERT_DOUBLE_EQ(log(24.0), gamma_r(5.0, &sign));
ASSERT_EQ(1, sign);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "glibc doesn't have gamma_r.\n";
+ GTEST_SKIP() << "glibc doesn't have gamma_r";
#endif // __BIONIC__
}
@@ -1406,7 +1406,7 @@ TEST(MATH_TEST, gammaf_r) {
ASSERT_FLOAT_EQ(logf(24.0f), gammaf_r(5.0f, &sign));
ASSERT_EQ(1, sign);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "glibc doesn't have gammaf_r.\n";
+ GTEST_SKIP() << "glibc doesn't have gammaf_r";
#endif // __BIONIC__
}
diff --git a/tests/membarrier_test.cpp b/tests/membarrier_test.cpp
index 9e871c71c..6f650e712 100644
--- a/tests/membarrier_test.cpp
+++ b/tests/membarrier_test.cpp
@@ -46,8 +46,7 @@ TEST(membarrier, query) {
TEST(membarrier, global_barrier) {
if (!HasMembarrier(MEMBARRIER_CMD_GLOBAL)) {
- GTEST_LOG_(INFO) << "MEMBARRIER_CMD_GLOBAL not supported, skipping test.";
- return;
+ GTEST_SKIP() << "MEMBARRIER_CMD_GLOBAL not supported";
}
ASSERT_EQ(0, syscall(__NR_membarrier, MEMBARRIER_CMD_GLOBAL, 0));
}
@@ -78,14 +77,10 @@ static const char* MembarrierCommandToName(int membarrier_cmd) {
static void TestRegisterAndBarrierCommands(int membarrier_cmd_register,
int membarrier_cmd_barrier) {
if (!HasMembarrier(membarrier_cmd_register)) {
- GTEST_LOG_(INFO) << MembarrierCommandToName(membarrier_cmd_register)
- << " not supported, skipping test.";
- return;
+ GTEST_SKIP() << MembarrierCommandToName(membarrier_cmd_register) << " not supported";
}
if (!HasMembarrier(membarrier_cmd_barrier)) {
- GTEST_LOG_(INFO) << MembarrierCommandToName(membarrier_cmd_barrier)
- << " not supported, skipping test.";
- return;
+ GTEST_SKIP() << MembarrierCommandToName(membarrier_cmd_barrier) << " not supported";
}
ScopedErrnoCleaner errno_cleaner;
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 973ca5340..7b64401db 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -190,7 +190,7 @@ TEST(pthread, static_pthread_key_used_before_creation) {
ASSERT_EQ(EINVAL, pthread_setspecific(key, nullptr));
ASSERT_EQ(EINVAL, pthread_key_delete(key));
#else
- GTEST_LOG_(INFO) << "This test tests bionic pthread key implementation detail.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -986,8 +986,7 @@ TEST(pthread, pthread_rwlock_reader_wakeup_writer_timedwait_monotonic_np) {
test_pthread_rwlock_reader_wakeup_writer(
[&](pthread_rwlock_t* lock) { return pthread_rwlock_timedwrlock_monotonic_np(lock, &ts); });
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing since pthread_rwlock_timedwrlock_monotonic_np is "
- "only supported on bionic";
+ GTEST_SKIP() << "pthread_rwlock_timedwrlock_monotonic_np not available";
#endif // __BIONIC__
}
@@ -1035,8 +1034,7 @@ TEST(pthread, pthread_rwlock_writer_wakeup_reader_timedwait_monotonic_np) {
test_pthread_rwlock_writer_wakeup_reader(
[&](pthread_rwlock_t* lock) { return pthread_rwlock_timedrdlock_monotonic_np(lock, &ts); });
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing since pthread_rwlock_timedrdlock_monotonic_np is "
- "only supported on bionic";
+ GTEST_SKIP() << "pthread_rwlock_timedrdlock_monotonic_np not available";
#endif // __BIONIC__
}
@@ -1096,8 +1094,7 @@ TEST(pthread, pthread_rwlock_timedrdlock_monotonic_np_timeout) {
pthread_rwlock_timedrdlock_timeout_helper(CLOCK_MONOTONIC,
pthread_rwlock_timedrdlock_monotonic_np);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing since pthread_rwlock_timedrdlock_monotonic_np is "
- "only supported on bionic";
+ GTEST_SKIP() << "pthread_rwlock_timedrdlock_monotonic_np not available";
#endif // __BIONIC__
}
@@ -1133,8 +1130,7 @@ TEST(pthread, pthread_rwlock_timedwrlock_monotonic_np_timeout) {
pthread_rwlock_timedwrlock_timeout_helper(CLOCK_MONOTONIC,
pthread_rwlock_timedwrlock_monotonic_np);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing since pthread_rwlock_timedwrlock_monotonic_np is "
- "only supported on bionic";
+ GTEST_SKIP() << "pthread_rwlock_timedwrlock_monotonic_np not available";
#endif // __BIONIC__
}
@@ -1364,7 +1360,7 @@ TEST(pthread, pthread_cond_broadcast__preserves_condattr_flags) {
ASSERT_EQ(0, pthread_condattr_getpshared(&attr, &pshared));
ASSERT_EQ(PTHREAD_PROCESS_SHARED, pshared);
#else // !defined(__BIONIC__)
- GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // !defined(__BIONIC__)
}
@@ -1480,8 +1476,7 @@ TEST_F(pthread_CondWakeupTest, signal_timedwait_CLOCK_MONOTONIC_np) {
progress = SIGNALED;
ASSERT_EQ(0, pthread_cond_signal(&cond));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing since pthread_cond_timedwait_monotonic_np is only "
- "supported on bionic";
+ GTEST_SKIP() << "pthread_cond_timedwait_monotonic_np not available";
#endif // __BIONIC__
}
@@ -1516,8 +1511,7 @@ TEST(pthread, pthread_cond_timedwait_monotonic_np_timeout) {
#if defined(__BIONIC__)
pthread_cond_timedwait_timeout_helper(CLOCK_MONOTONIC, pthread_cond_timedwait_monotonic_np);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing since pthread_cond_timedwait_monotonic_np is only "
- "supported on bionic";
+ GTEST_SKIP() << "pthread_cond_timedwait_monotonic_np not available";
#endif // __BIONIC__
}
@@ -1739,7 +1733,7 @@ TEST(pthread, pthread_gettid_np) {
ASSERT_EQ(t_gettid_result, t_pthread_gettid_np_result);
#else
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "pthread_gettid_np not available";
#endif
}
@@ -1934,7 +1928,7 @@ TEST(pthread, pthread_mutex_pi_count_limit) {
}
ASSERT_EQ(0, pthread_mutexattr_destroy(&attr));
#else
- GTEST_LOG_(INFO) << "This test does nothing as pi mutex count isn't limited.\n";
+ GTEST_SKIP() << "pi mutex count not limited to 64Ki";
#endif
}
@@ -2121,7 +2115,7 @@ TEST(pthread, pthread_mutex_owner_tid_limit) {
// Bionic's pthread_mutex implementation on 32-bit devices uses 16 bits to represent owner tid.
ASSERT_LE(pid_max, 65536);
#else
- GTEST_LOG_(INFO) << "This test does nothing as 32-bit tid is supported by pthread_mutex.\n";
+ GTEST_SKIP() << "pthread_mutex supports 32-bit tid";
#endif
}
@@ -2164,8 +2158,7 @@ TEST(pthread, pthread_mutex_timedlock_monotonic_np) {
#if defined(__BIONIC__)
pthread_mutex_timedlock_helper(CLOCK_MONOTONIC, pthread_mutex_timedlock_monotonic_np);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing since pthread_mutex_timedlock_monotonic_np is only "
- "supported on bionic";
+ GTEST_SKIP() << "pthread_mutex_timedlock_monotonic_np not available";
#endif // __BIONIC__
}
@@ -2216,8 +2209,7 @@ TEST(pthread, pthread_mutex_timedlock_monotonic_np_pi) {
#if defined(__BIONIC__)
pthread_mutex_timedlock_pi_helper(CLOCK_MONOTONIC, pthread_mutex_timedlock_monotonic_np);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing since pthread_mutex_timedlock_monotonic_np is only "
- "supported on bionic";
+ GTEST_SKIP() << "pthread_mutex_timedlock_monotonic_np not available";
#endif // __BIONIC__
}
@@ -2240,7 +2232,7 @@ TEST(pthread, pthread_mutex_using_destroyed_mutex) {
ASSERT_EXIT(pthread_mutex_destroy(&m), ::testing::KilledBySignal(SIGABRT),
"pthread_mutex_destroy called on a destroyed mutex");
#else
- GTEST_LOG_(INFO) << "This test tests bionic pthread mutex implementation details.";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -2297,7 +2289,7 @@ TEST(pthread, pthread_types_allow_four_bytes_alignment) {
ASSERT_EQ(0, pthread_rwlock_destroy(rwlock));
#else
- GTEST_LOG_(INFO) << "This test tests bionic implementation details.";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -2312,7 +2304,7 @@ TEST(pthread, pthread_mutex_lock_null_32) {
pthread_mutex_t* null_value = nullptr;
ASSERT_EQ(EINVAL, pthread_mutex_lock(null_value));
#else
- GTEST_LOG_(INFO) << "This test tests bionic implementation details on 32 bit devices.";
+ GTEST_SKIP() << "32-bit bionic-only test";
#endif
}
@@ -2327,7 +2319,7 @@ TEST(pthread, pthread_mutex_unlock_null_32) {
pthread_mutex_t* null_value = nullptr;
ASSERT_EQ(EINVAL, pthread_mutex_unlock(null_value));
#else
- GTEST_LOG_(INFO) << "This test tests bionic implementation details on 32 bit devices.";
+ GTEST_SKIP() << "32-bit bionic-only test";
#endif
}
@@ -2336,7 +2328,7 @@ TEST_F(pthread_DeathTest, pthread_mutex_lock_null_64) {
pthread_mutex_t* null_value = nullptr;
ASSERT_EXIT(pthread_mutex_lock(null_value), testing::KilledBySignal(SIGSEGV), "");
#else
- GTEST_LOG_(INFO) << "This test tests bionic implementation details on 64 bit devices.";
+ GTEST_SKIP() << "64-bit bionic-only test";
#endif
}
@@ -2345,7 +2337,7 @@ TEST_F(pthread_DeathTest, pthread_mutex_unlock_null_64) {
pthread_mutex_t* null_value = nullptr;
ASSERT_EXIT(pthread_mutex_unlock(null_value), testing::KilledBySignal(SIGSEGV), "");
#else
- GTEST_LOG_(INFO) << "This test tests bionic implementation details on 64 bit devices.";
+ GTEST_SKIP() << "64-bit bionic-only test";
#endif
}
@@ -2658,10 +2650,7 @@ TEST(pthread, pthread_attr_setinheritsched__PTHREAD_INHERIT_SCHED__PTHREAD_EXPLI
TEST(pthread, pthread_attr_setinheritsched_PTHREAD_INHERIT_SCHED_takes_effect) {
sched_param param = { .sched_priority = sched_get_priority_min(SCHED_FIFO) };
int rc = pthread_setschedparam(pthread_self(), SCHED_FIFO, &param);
- if (rc == EPERM) {
- GTEST_LOG_(INFO) << "pthread_setschedparam failed with EPERM, skipping test\n";
- return;
- }
+ if (rc == EPERM) GTEST_SKIP() << "pthread_setschedparam failed with EPERM";
ASSERT_EQ(0, rc);
pthread_attr_t attr;
@@ -2682,10 +2671,7 @@ TEST(pthread, pthread_attr_setinheritsched_PTHREAD_INHERIT_SCHED_takes_effect) {
TEST(pthread, pthread_attr_setinheritsched_PTHREAD_EXPLICIT_SCHED_takes_effect) {
sched_param param = { .sched_priority = sched_get_priority_min(SCHED_FIFO) };
int rc = pthread_setschedparam(pthread_self(), SCHED_FIFO, &param);
- if (rc == EPERM) {
- GTEST_LOG_(INFO) << "pthread_setschedparam failed with EPERM, skipping test\n";
- return;
- }
+ if (rc == EPERM) GTEST_SKIP() << "pthread_setschedparam failed with EPERM";
ASSERT_EQ(0, rc);
pthread_attr_t attr;
@@ -2707,10 +2693,7 @@ TEST(pthread, pthread_attr_setinheritsched_PTHREAD_EXPLICIT_SCHED_takes_effect)
TEST(pthread, pthread_attr_setinheritsched__takes_effect_despite_SCHED_RESET_ON_FORK) {
sched_param param = { .sched_priority = sched_get_priority_min(SCHED_FIFO) };
int rc = pthread_setschedparam(pthread_self(), SCHED_FIFO | SCHED_RESET_ON_FORK, &param);
- if (rc == EPERM) {
- GTEST_LOG_(INFO) << "pthread_setschedparam failed with EPERM, skipping test\n";
- return;
- }
+ if (rc == EPERM) GTEST_SKIP() << "pthread_setschedparam failed with EPERM";
ASSERT_EQ(0, rc);
pthread_attr_t attr;
diff --git a/tests/pty_test.cpp b/tests/pty_test.cpp
index 75f228c8a..29f86f16a 100644
--- a/tests/pty_test.cpp
+++ b/tests/pty_test.cpp
@@ -109,8 +109,7 @@ TEST(pty, bug_28979140) {
cpu_set_t cpus;
ASSERT_EQ(0, sched_getaffinity(0, sizeof(cpu_set_t), &cpus));
if (CPU_COUNT(&cpus) < 2) {
- GTEST_LOG_(INFO) << "This test tests bug happens only on multiprocessors.";
- return;
+ GTEST_SKIP() << "This bug only happens on multiprocessors";
}
constexpr uint32_t TEST_DATA_COUNT = 2000000;
diff --git a/tests/sched_test.cpp b/tests/sched_test.cpp
index 91840260e..9309a7ff5 100644
--- a/tests/sched_test.cpp
+++ b/tests/sched_test.cpp
@@ -47,7 +47,7 @@ TEST(sched, clone) {
// See https://sourceware.org/bugzilla/show_bug.cgi?id=10311 for more details.
TEST(sched, clone) {
// In order to enumerate all possible tests for CTS, create an empty test.
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc is broken";
}
#endif
diff --git a/tests/semaphore_test.cpp b/tests/semaphore_test.cpp
index 690e8865c..7addf6dda 100644
--- a/tests/semaphore_test.cpp
+++ b/tests/semaphore_test.cpp
@@ -141,8 +141,7 @@ TEST(semaphore, sem_timedwait_monotonic_np) {
#if defined(__BIONIC__)
sem_timedwait_helper(CLOCK_MONOTONIC, sem_timedwait_monotonic_np);
#else // __BIONIC__
- GTEST_LOG_(INFO)
- << "This test does nothing since sem_timedwait_monotonic_np is only supported on bionic";
+ GTEST_SKIP() << "sem_timedwait_monotonic_np is only supported on bionic";
#endif // __BIONIC__
}
@@ -218,7 +217,7 @@ TEST(semaphore, sem_wait_no_EINTR_in_sdk_less_equal_than_23) {
ASSERT_EQ(0, pthread_join(thread, &result));
ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(result));
#else
- GTEST_LOG_(INFO) << "This test tests sem_wait's compatibility for old sdk versions";
+ GTEST_SKIP() << "This test tests sem_wait's compatibility for old sdk versions";
#endif
}
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index 77b004ff3..1ae174a63 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -582,7 +582,7 @@ TEST(signal, sys_signame) {
ASSERT_TRUE(sys_signame[0] == nullptr);
ASSERT_STREQ("HUP", sys_signame[SIGHUP]);
#else
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "glibc doesn't have sys_signame";
#endif
}
diff --git a/tests/stack_protector_test.cpp b/tests/stack_protector_test.cpp
index 7a85cc34b..9fe7bb105 100644
--- a/tests/stack_protector_test.cpp
+++ b/tests/stack_protector_test.cpp
@@ -95,7 +95,7 @@ TEST(stack_protector, global_guard) {
ASSERT_NE(0, gettid());
ASSERT_NE(0U, __stack_chk_guard);
#else
- GTEST_LOG_(INFO) << "glibc doesn't have a global __stack_chk_guard.\n";
+ GTEST_SKIP() << "glibc doesn't have a global __stack_chk_guard";
#endif
}
diff --git a/tests/stdio_ext_test.cpp b/tests/stdio_ext_test.cpp
index d84fda0c9..fce600aa6 100644
--- a/tests/stdio_ext_test.cpp
+++ b/tests/stdio_ext_test.cpp
@@ -193,7 +193,7 @@ TEST(stdio_ext, __freading__fwriting) {
TEST(stdio_ext, __fseterr) {
#if defined(__GLIBC__)
- GTEST_LOG_(INFO) << "glibc doesn't have __fseterr, but gnulib will use it";
+ GTEST_SKIP() << "glibc doesn't have __fseterr, but gnulib will use it";
#else
FILE* fp = fopen("/dev/null", "w");
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index ad6ed45a9..65a942c37 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -330,7 +330,7 @@ TEST(STDIO_TEST, snprintf_n) {
int i = 1234;
EXPECT_DEATH(snprintf(buf, sizeof(buf), "a %n b", &i), "%n not allowed on Android");
#else
- GTEST_LOG_(INFO) << "This test does nothing on glibc.\n";
+ GTEST_SKIP() << "glibc does allow %n";
#endif
}
@@ -1897,7 +1897,7 @@ TEST(STDIO_TEST, open_memstream_EINVAL) {
ASSERT_EQ(nullptr, open_memstream(&p, nullptr));
ASSERT_EQ(EINVAL, errno);
#else
- GTEST_LOG_(INFO) << "This test does nothing on glibc.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif
}
@@ -2157,7 +2157,7 @@ TEST(STDIO_TEST, fseek_ftell_unseekable) {
fclose(fp);
#else
- GTEST_LOG_(INFO) << "glibc uses fopencookie instead.\n";
+ GTEST_SKIP() << "glibc uses fopencookie instead";
#endif
}
@@ -2167,7 +2167,7 @@ TEST(STDIO_TEST, funopen_EINVAL) {
ASSERT_EQ(nullptr, funopen(nullptr, nullptr, nullptr, nullptr, nullptr));
ASSERT_EQ(EINVAL, errno);
#else
- GTEST_LOG_(INFO) << "glibc uses fopencookie instead.\n";
+ GTEST_SKIP() << "glibc uses fopencookie instead";
#endif
}
@@ -2195,7 +2195,7 @@ TEST(STDIO_TEST, funopen_seek) {
EXPECT_EQ(0, fgetpos64(fp64, &pos64)) << strerror(errno);
EXPECT_EQ(0xfedcba12345678, pos64);
#else
- GTEST_LOG_(INFO) << "glibc uses fopencookie instead.\n";
+ GTEST_SKIP() << "glibc uses fopencookie instead";
#endif
}
@@ -2234,7 +2234,7 @@ static void AssertFileOffsetAt(FILE* fp, off64_t offset) {
EXPECT_EQ(offset, static_cast<off64_t>(pos));
EXPECT_EQ(offset, static_cast<off64_t>(pos64));
#else
- GTEST_LOG_(INFO) << "glibc's fpos_t is opaque.\n";
+ GTEST_SKIP() << "glibc's fpos_t is opaque";
#endif
}
diff --git a/tests/string_test.cpp b/tests/string_test.cpp
index b27ca87d2..335d33bd6 100644
--- a/tests/string_test.cpp
+++ b/tests/string_test.cpp
@@ -85,7 +85,7 @@ TEST(STRING_TEST, strerror_concurrent) {
ASSERT_STREQ("Unknown error 1001", strerror1001);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "Skipping test, requires a thread safe strerror.";
+ GTEST_SKIP() << "thread-safe strerror not available";
#endif // __BIONIC__
}
@@ -578,7 +578,7 @@ TEST(STRING_TEST, strlcat) {
}
}
#else
- GTEST_LOG_(INFO) << "Skipping test, strlcat not supported on this platform.";
+ GTEST_SKIP() << "strlcat not available";
#endif
}
@@ -610,7 +610,7 @@ TEST(STRING_TEST, strlcpy) {
(memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN) != 0));
}
#else
- GTEST_LOG_(INFO) << "Skipping test, strlcpy not supported on this platform.";
+ GTEST_SKIP() << "strlcpy not available";
#endif
}
@@ -1139,7 +1139,7 @@ TEST(STRING_TEST, strlcpy_align) {
#if defined(STRLCPY_SUPPORTED)
RunSrcDstBufferAlignTest(LARGE, DoStrlcpyTest);
#else
- GTEST_LOG_(INFO) << "Skipping test, strlcpy not supported on this platform.";
+ GTEST_SKIP() << "strlcpy not available";
#endif
}
@@ -1147,7 +1147,7 @@ TEST(STRING_TEST, strlcpy_overread) {
#if defined(STRLCPY_SUPPORTED)
RunSrcDstBufferOverreadTest(DoStrlcpyTest);
#else
- GTEST_LOG_(INFO) << "Skipping test, strlcpy not supported on this platform.";
+ GTEST_SKIP() << "strlcpy not available";
#endif
}
@@ -1275,7 +1275,7 @@ TEST(STRING_TEST, strlcat_align) {
#if defined(STRLCAT_SUPPORTED)
RunSrcDstBufferAlignTest(MEDIUM, DoStrlcatTest, LargeSetIncrement);
#else
- GTEST_LOG_(INFO) << "Skipping test, strlcat not supported on this platform.";
+ GTEST_SKIP() << "strlcat not available";
#endif
}
@@ -1283,7 +1283,7 @@ TEST(STRING_TEST, strlcat_overread) {
#if defined(STRLCAT_SUPPORTED)
RunSrcDstBufferOverreadTest(DoStrlcatTest);
#else
- GTEST_LOG_(INFO) << "Skipping test, strlcat not supported on this platform.";
+ GTEST_SKIP() << "strlcat not available";
#endif
}
diff --git a/tests/sys_msg_test.cpp b/tests/sys_msg_test.cpp
index 8b3623e15..200f65437 100644
--- a/tests/sys_msg_test.cpp
+++ b/tests/sys_msg_test.cpp
@@ -35,8 +35,7 @@
TEST(sys_msg, smoke) {
if (msgctl(-1, IPC_STAT, nullptr) == -1 && errno == ENOSYS) {
- GTEST_LOG_(INFO) << "no <sys/msg.h> support in this kernel\n";
- return;
+ GTEST_SKIP() << "no <sys/msg.h> support in this kernel";
}
// Create a queue.
diff --git a/tests/sys_prctl_test.cpp b/tests/sys_prctl_test.cpp
index cd23c0a39..6d1fa1d9c 100644
--- a/tests/sys_prctl_test.cpp
+++ b/tests/sys_prctl_test.cpp
@@ -61,7 +61,7 @@ TEST(sys_prctl, bug_20017123) {
ASSERT_EQ(0, munmap(p, page_size * 3));
#else
- GTEST_LOG_(INFO) << "This test does nothing as it tests an Android specific kernel feature.";
+ GTEST_SKIP() << "PR_SET_VMA not available";
#endif
}
@@ -112,7 +112,6 @@ TEST(sys_prctl, pr_cap_ambient) {
EXPECT_EQ(-1, err);
EXPECT_EQ(EINVAL, errno);
#else
- GTEST_LOG_(INFO)
- << "Skipping test that requires host support for PR_CAP_AMBIENT.";
+ GTEST_SKIP() << "PR_CAP_AMBIENT not available";
#endif
}
diff --git a/tests/sys_ptrace_test.cpp b/tests/sys_ptrace_test.cpp
index 04dcd4ed2..9b3dba0f6 100644
--- a/tests/sys_ptrace_test.cpp
+++ b/tests/sys_ptrace_test.cpp
@@ -62,14 +62,13 @@ class ChildGuard {
enum class HwFeature { Watchpoint, Breakpoint };
-static bool is_hw_feature_supported(pid_t child, HwFeature feature) {
+static void check_hw_feature_supported(pid_t child, HwFeature feature) {
#if defined(__arm__)
long capabilities;
long result = ptrace(PTRACE_GETHBPREGS, child, 0, &capabilities);
if (result == -1) {
EXPECT_EQ(EIO, errno);
- GTEST_LOG_(INFO) << "Hardware debug support disabled at kernel configuration time.";
- return false;
+ GTEST_SKIP() << "Hardware debug support disabled at kernel configuration time";
}
uint8_t hb_count = capabilities & 0xff;
capabilities >>= 8;
@@ -77,19 +76,12 @@ static bool is_hw_feature_supported(pid_t child, HwFeature feature) {
capabilities >>= 8;
uint8_t max_wp_size = capabilities & 0xff;
if (max_wp_size == 0) {
- GTEST_LOG_(INFO)
- << "Kernel reports zero maximum watchpoint size. Hardware debug support missing.";
- return false;
+ GTEST_SKIP() << "Kernel reports zero maximum watchpoint size";
+ } else if (feature == HwFeature::Watchpoint && wp_count == 0) {
+ GTEST_SKIP() << "Kernel reports zero hardware watchpoints";
+ } else if (feature == HwFeature::Breakpoint && hb_count == 0) {
+ GTEST_SKIP() << "Kernel reports zero hardware breakpoints";
}
- if (feature == HwFeature::Watchpoint && wp_count == 0) {
- GTEST_LOG_(INFO) << "Kernel reports zero hardware watchpoints";
- return false;
- }
- if (feature == HwFeature::Breakpoint && hb_count == 0) {
- GTEST_LOG_(INFO) << "Kernel reports zero hardware breakpoints";
- return false;
- }
- return true;
#elif defined(__aarch64__)
user_hwdebug_state dreg_state;
iovec iov;
@@ -99,20 +91,13 @@ static bool is_hw_feature_supported(pid_t child, HwFeature feature) {
long result = ptrace(PTRACE_GETREGSET, child,
feature == HwFeature::Watchpoint ? NT_ARM_HW_WATCH : NT_ARM_HW_BREAK, &iov);
if (result == -1) {
- EXPECT_EQ(EINVAL, errno);
- return false;
+ ASSERT_EQ(EINVAL, errno);
}
- return (dreg_state.dbg_info & 0xff) > 0;
-#elif defined(__i386__) || defined(__x86_64__)
- // We assume watchpoints and breakpoints are always supported on x86.
- UNUSED(child);
- UNUSED(feature);
- return true;
+ if ((dreg_state.dbg_info & 0xff) == 0) GTEST_SKIP() << "hardware support missing";
#else
- // TODO: mips support.
+ // We assume watchpoints and breakpoints are always supported on x86.
UNUSED(child);
UNUSED(feature);
- return false;
#endif
}
@@ -190,10 +175,7 @@ static void run_watchpoint_test(std::function<void(T&)> child_func, size_t offse
ASSERT_TRUE(WIFSTOPPED(status)) << "Status was: " << status;
ASSERT_EQ(SIGSTOP, WSTOPSIG(status)) << "Status was: " << status;
- if (!is_hw_feature_supported(child, HwFeature::Watchpoint)) {
- GTEST_LOG_(INFO) << "Skipping test because hardware support is not available.\n";
- return;
- }
+ check_hw_feature_supported(child, HwFeature::Watchpoint);
set_watchpoint(child, uintptr_t(untag_address(&data)) + offset, size);
@@ -360,10 +342,7 @@ TEST(sys_ptrace, hardware_breakpoint) {
ASSERT_TRUE(WIFSTOPPED(status)) << "Status was: " << status;
ASSERT_EQ(SIGSTOP, WSTOPSIG(status)) << "Status was: " << status;
- if (!is_hw_feature_supported(child, HwFeature::Breakpoint)) {
- GTEST_LOG_(INFO) << "Skipping test because hardware support is not available.\n";
- return;
- }
+ check_hw_feature_supported(child, HwFeature::Breakpoint);
set_breakpoint(child);
diff --git a/tests/sys_random_test.cpp b/tests/sys_random_test.cpp
index 78cbf4a71..2e2665b89 100644
--- a/tests/sys_random_test.cpp
+++ b/tests/sys_random_test.cpp
@@ -43,7 +43,7 @@ TEST(sys_random, getentropy) {
ASSERT_EQ(0, getentropy(buf2, sizeof(buf2)));
ASSERT_TRUE(memcmp(buf1, buf2, sizeof(buf1)) != 0);
#else
- GTEST_LOG_(INFO) << "This test requires a C library with <sys/random.h>.\n";
+ GTEST_SKIP() << "<sys/random.h> not available";
#endif
}
@@ -53,7 +53,7 @@ TEST(sys_random, getentropy_EFAULT) {
ASSERT_EQ(-1, getentropy(nullptr, 1));
ASSERT_EQ(EFAULT, errno);
#else
- GTEST_LOG_(INFO) << "This test requires a C library with <sys/random.h>.\n";
+ GTEST_SKIP() << "<sys/random.h> not available";
#endif
}
@@ -66,7 +66,7 @@ TEST(sys_random, getentropy_EIO) {
ASSERT_EQ(-1, getentropy(buf, sizeof(buf)));
ASSERT_EQ(EIO, errno);
#else
- GTEST_LOG_(INFO) << "This test requires a C library with <sys/random.h>.\n";
+ GTEST_SKIP() << "<sys/random.h> not available";
#endif
}
@@ -79,7 +79,7 @@ TEST(sys_random, getrandom) {
ASSERT_EQ(64, getrandom(buf2, sizeof(buf2), 0));
ASSERT_TRUE(memcmp(buf1, buf2, sizeof(buf1)) != 0);
#else
- GTEST_LOG_(INFO) << "This test requires a C library with <sys/random.h>.\n";
+ GTEST_SKIP() << "<sys/random.h> not available";
#endif
}
@@ -89,7 +89,7 @@ TEST(sys_random, getrandom_EFAULT) {
ASSERT_EQ(-1, getrandom(nullptr, 256, 0));
ASSERT_EQ(EFAULT, errno);
#else
- GTEST_LOG_(INFO) << "This test requires a C library with <sys/random.h>.\n";
+ GTEST_SKIP() << "<sys/random.h> not available";
#endif
}
@@ -100,6 +100,6 @@ TEST(sys_random, getrandom_EINVAL) {
ASSERT_EQ(-1, getrandom(buf, sizeof(buf), ~0));
ASSERT_EQ(EINVAL, errno);
#else
- GTEST_LOG_(INFO) << "This test requires a C library with <sys/random.h>.\n";
+ GTEST_SKIP() << "<sys/random.h> not available";
#endif
}
diff --git a/tests/sys_sem_test.cpp b/tests/sys_sem_test.cpp
index dff34c83a..b98926b4b 100644
--- a/tests/sys_sem_test.cpp
+++ b/tests/sys_sem_test.cpp
@@ -35,8 +35,7 @@
TEST(sys_sem, smoke) {
if (semctl(-1, 0, IPC_RMID) == -1 && errno == ENOSYS) {
- GTEST_LOG_(INFO) << "no <sys/sem.h> support in this kernel\n";
- return;
+ GTEST_SKIP() << "no <sys/sem.h> support in this kernel";
}
// Create a semaphore.
diff --git a/tests/sys_shm_test.cpp b/tests/sys_shm_test.cpp
index 15abe05d1..fd5d42413 100644
--- a/tests/sys_shm_test.cpp
+++ b/tests/sys_shm_test.cpp
@@ -34,8 +34,7 @@
TEST(sys_shm, smoke) {
if (shmctl(-1, IPC_STAT, nullptr) == -1 && errno == ENOSYS) {
- GTEST_LOG_(INFO) << "no <sys/shm.h> support in this kernel\n";
- return;
+ GTEST_SKIP() << "no <sys/shm.h> support in this kernel";
}
// Create a segment.
diff --git a/tests/sys_stat_test.cpp b/tests/sys_stat_test.cpp
index 70ad45151..97bf58026 100644
--- a/tests/sys_stat_test.cpp
+++ b/tests/sys_stat_test.cpp
@@ -82,7 +82,7 @@ TEST(sys_stat, mkfifo) {
unlink(path.c_str());
} else {
// SELinux policy forbids us from creating FIFOs. http://b/17646702.
- GTEST_LOG_(INFO) << "This test only performs a test when run as root.";
+ GTEST_SKIP() << "SELinux policy forbids non-root from creating FIFOs";
}
}
diff --git a/tests/system_properties_test.cpp b/tests/system_properties_test.cpp
index 3b5089664..245e42f7d 100644
--- a/tests/system_properties_test.cpp
+++ b/tests/system_properties_test.cpp
@@ -121,7 +121,7 @@ TEST(properties, __system_property_add) {
ASSERT_EQ(5, system_properties.Get(name, propvalue));
ASSERT_STREQ(propvalue, "value");
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -156,7 +156,7 @@ TEST(properties, __system_property_update) {
ASSERT_EQ(6, system_properties.Get("property_other", propvalue));
ASSERT_STREQ(propvalue, "value6");
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -202,7 +202,7 @@ TEST(properties, fill) {
ASSERT_EQ(0, memcmp(prop_value, prop_value_ret, PROP_VALUE_MAX));
}
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -219,7 +219,7 @@ TEST(properties, __system_property_foreach) {
ASSERT_EQ(0, system_properties.Foreach(foreach_test_callback, &count));
ASSERT_EQ(3U, count);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -248,7 +248,7 @@ TEST(properties, __system_property_find_nth) {
ASSERT_TRUE(system_properties.FindNth(i) == nullptr);
}
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -307,7 +307,7 @@ TEST(properties, fill_hierarchical) {
}
}
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -328,7 +328,7 @@ TEST(properties, errors) {
ASSERT_EQ(-1, system_properties.Add("name", 4, "value", PROP_VALUE_MAX));
ASSERT_EQ(-1, system_properties.Update(NULL, "value", PROP_VALUE_MAX));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -344,7 +344,7 @@ TEST(properties, __system_property_serial) {
ASSERT_EQ(0, system_properties.Update(const_cast<prop_info*>(pi), "value2", 6));
ASSERT_NE(serial, system_properties.Serial(pi));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -375,7 +375,7 @@ TEST(properties, __system_property_wait_any) {
thread.join();
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -408,7 +408,7 @@ TEST(properties, __system_property_wait) {
thread.join();
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -436,7 +436,7 @@ TEST_F(properties_DeathTest, read_only) {
ASSERT_EXIT(__system_property_add("property", 8, "value", 5), KilledByFault(), "");
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -508,7 +508,7 @@ TEST(properties, __system_property_extra_long_read_only) {
}
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -523,6 +523,6 @@ TEST(properties, __system_property_extra_long_read_only_too_long) {
ASSERT_NE(0, system_properties.Add(name.c_str(), name.size(), value.c_str(), value.size()));
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
diff --git a/tests/system_properties_test2.cpp b/tests/system_properties_test2.cpp
index e6e7ef25c..c061faa09 100644
--- a/tests/system_properties_test2.cpp
+++ b/tests/system_properties_test2.cpp
@@ -124,7 +124,7 @@ TEST(properties, smoke) {
ASSERT_EQ(expected_name, legacy_name);
ASSERT_STREQ("value2", propvalue);
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
@@ -143,6 +143,6 @@ TEST(properties, empty_value) {
}
#else // __BIONIC__
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 50830ee1a..637fa85e6 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -912,6 +912,6 @@ TEST(time, timespec_get) {
ASSERT_EQ(0, timespec_get(&ts, 123));
ASSERT_EQ(TIME_UTC, timespec_get(&ts, TIME_UTC));
#else
- GTEST_LOG_(INFO) << "glibc doesn't have timespec_get until 2.21\n";
+ GTEST_SKIP() << "glibc doesn't have timespec_get until 2.21";
#endif
}
diff --git a/tests/utils.h b/tests/utils.h
index cc1aa8c73..fe41019a7 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -64,7 +64,7 @@ static inline bool running_with_hwasan() {
return &__hwasan_init != 0;
}
-#define SKIP_WITH_HWASAN if (running_with_hwasan()) { return; }
+#define SKIP_WITH_HWASAN if (running_with_hwasan()) GTEST_SKIP()
static inline void* untag_address(void* addr) {
#if defined(__LP64__)
diff --git a/tests/wchar_test.cpp b/tests/wchar_test.cpp
index 9aef800ab..9b4fc4f8e 100644
--- a/tests/wchar_test.cpp
+++ b/tests/wchar_test.cpp
@@ -713,7 +713,7 @@ TEST(stdio, open_wmemstream_EINVAL) {
ASSERT_EQ(nullptr, open_wmemstream(&p, nullptr));
ASSERT_EQ(EINVAL, errno);
#else
- GTEST_LOG_(INFO) << "This test does nothing.\n";
+ GTEST_SKIP() << "This test is bionic-specific";
#endif
}
diff --git a/tests/wctype_test.cpp b/tests/wctype_test.cpp
index 06e1571ae..85a46aa4c 100644
--- a/tests/wctype_test.cpp
+++ b/tests/wctype_test.cpp
@@ -111,7 +111,7 @@ TEST(wctype, towlower) {
EXPECT_EQ(wint_t(L'δ'), towlower(L'δ'));
EXPECT_EQ(wint_t(L'δ'), towlower(L'Δ'));
} else {
- GTEST_LOG_(INFO) << "skipping unicode towlower tests";
+ GTEST_SKIP() << "icu not available";
}
}
@@ -127,7 +127,7 @@ TEST(wctype, towlower_l) {
EXPECT_EQ(wint_t(L'δ'), towlower_l(L'δ', l.l));
EXPECT_EQ(wint_t(L'δ'), towlower_l(L'Δ', l.l));
} else {
- GTEST_LOG_(INFO) << "skipping unicode towlower_l tests";
+ GTEST_SKIP() << "icu not available";
}
}
@@ -142,7 +142,7 @@ TEST(wctype, towupper) {
EXPECT_EQ(wint_t(L'Δ'), towupper(L'δ'));
EXPECT_EQ(wint_t(L'Δ'), towupper(L'Δ'));
} else {
- GTEST_LOG_(INFO) << "skipping unicode towupper tests";
+ GTEST_SKIP() << "icu not available";
}
}
@@ -158,7 +158,7 @@ TEST(wctype, towupper_l) {
EXPECT_EQ(wint_t(L'Δ'), towupper_l(L'δ', l.l));
EXPECT_EQ(wint_t(L'Δ'), towupper_l(L'Δ', l.l));
} else {
- GTEST_LOG_(INFO) << "skipping unicode towupper_l tests";
+ GTEST_SKIP() << "icu not available";
}
}