Merge "No tombstones under normal bionic unit tests run." into main

This commit is contained in:
Christopher Ferris 2023-07-25 19:24:42 +00:00 committed by Gerrit Code Review
commit 78a74b02ad
2 changed files with 12 additions and 7 deletions

View file

@ -34,12 +34,15 @@
#if defined(__BIONIC__)
#include "android-base/file.h"
#include "android-base/silent_death_test.h"
#include "android-base/test_utils.h"
#include "gwp_asan/options.h"
#include "platform/bionic/malloc.h"
#include "sys/system_properties.h"
#include "utils.h"
using gwp_asan_integration_DeathTest = SilentDeathTest;
// basename is a mess, use gnu basename explicitly to avoid the need for string
// mutation.
extern "C" const char* __gnu_basename(const char* path);
@ -133,7 +136,7 @@ class SyspropRestorer {
}
};
TEST(gwp_asan_integration, DISABLED_assert_gwp_asan_enabled) {
TEST_F(gwp_asan_integration_DeathTest, DISABLED_assert_gwp_asan_enabled) {
std::string maps;
EXPECT_TRUE(android::base::ReadFileToString("/proc/self/maps", &maps));
EXPECT_TRUE(maps.find("GWP-ASan") != std::string::npos) << maps;
@ -173,7 +176,7 @@ TEST(gwp_asan_integration, sysprops_program_specific) {
__system_property_set((std::string("libc.debug.gwp_asan.max_allocs.") + basename).c_str(),
"40000");
RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
RunSubtestNoEnv("gwp_asan_integration_DeathTest.DISABLED_assert_gwp_asan_enabled");
}
TEST(gwp_asan_integration, sysprops_persist_program_specific) {
@ -191,7 +194,7 @@ TEST(gwp_asan_integration, sysprops_persist_program_specific) {
__system_property_set((std::string("persist.libc.debug.gwp_asan.max_allocs.") + basename).c_str(),
"40000");
RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
RunSubtestNoEnv("gwp_asan_integration_DeathTest.DISABLED_assert_gwp_asan_enabled");
}
TEST(gwp_asan_integration, sysprops_non_persist_overrides_persist) {
@ -235,7 +238,7 @@ TEST(gwp_asan_integration, sysprops_program_specific_overrides_default) {
__system_property_set("libc.debug.gwp_asan.process_sampling.system_default", "0");
__system_property_set("libc.debug.gwp_asan.max_allocs.system_default", "0");
RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
RunSubtestNoEnv("gwp_asan_integration_DeathTest.DISABLED_assert_gwp_asan_enabled");
}
TEST(gwp_asan_integration, sysprops_can_disable) {
@ -261,7 +264,7 @@ TEST(gwp_asan_integration, env_overrides_sysprop) {
__system_property_set("libc.debug.gwp_asan.process_sampling.system_default", "0");
__system_property_set("libc.debug.gwp_asan.max_allocs.system_default", "0");
RunGwpAsanTest("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
RunGwpAsanTest("gwp_asan_integration_DeathTest.DISABLED_assert_gwp_asan_enabled");
}
#endif // defined(__BIONIC__)

View file

@ -1049,11 +1049,13 @@ TEST(STDIO_TEST, popen_return_value_1) {
}
TEST(STDIO_TEST, popen_return_value_signal) {
FILE* fp = popen("kill -7 $$", "r");
// Use a realtime signal to avoid creating a tombstone when running.
std::string cmd = android::base::StringPrintf("kill -%d $$", SIGRTMIN);
FILE* fp = popen(cmd.c_str(), "r");
ASSERT_TRUE(fp != nullptr);
int status = pclose(fp);
EXPECT_TRUE(WIFSIGNALED(status));
EXPECT_EQ(7, WTERMSIG(status));
EXPECT_EQ(SIGRTMIN, WTERMSIG(status));
}
TEST(STDIO_TEST, getc) {