diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-08-22 09:04:33 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-08-22 09:04:33 +0000 |
commit | 3aad5eebd9aed157e1460e519de3cb13f21d25d0 (patch) | |
tree | db663fbe7af03e27872c6803af21c8f4563616be /standalone/tests/wrappers_c_test.cpp | |
parent | 40102fa36484b75502b5cd46aa022b33d0d012e5 (diff) | |
parent | c2e59964f5866acb106d217462c1771afdd24844 (diff) | |
download | platform_external_scudo-main-cg-testing-release.tar.gz platform_external_scudo-main-cg-testing-release.tar.bz2 platform_external_scudo-main-cg-testing-release.zip |
Snap for 7664297 from c2e59964f5866acb106d217462c1771afdd24844 to main-cg-testing-releasemain-cg-testing-release
Change-Id: I1bb534a242d423e4bc897cf824f5647ac4447665
Diffstat (limited to 'standalone/tests/wrappers_c_test.cpp')
-rw-r--r-- | standalone/tests/wrappers_c_test.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/standalone/tests/wrappers_c_test.cpp b/standalone/tests/wrappers_c_test.cpp index eed8f031933..f607ba70ab4 100644 --- a/standalone/tests/wrappers_c_test.cpp +++ b/standalone/tests/wrappers_c_test.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "memtag.h" #include "scudo/interface.h" #include "tests/scudo_unit_test.h" @@ -37,7 +38,7 @@ void *pvalloc(size_t size); static const size_t Size = 100U; -TEST(ScudoWrappersCTest, Malloc) { +TEST(ScudoWrappersCDeathTest, Malloc) { void *P = malloc(Size); EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); @@ -153,7 +154,7 @@ TEST(ScudoWrappersCTest, AlignedAlloc) { EXPECT_EQ(errno, EINVAL); } -TEST(ScudoWrappersCTest, Realloc) { +TEST(ScudoWrappersCDeathTest, Realloc) { // realloc(nullptr, N) is malloc(N) void *P = realloc(nullptr, 0U); EXPECT_NE(P, nullptr); @@ -277,6 +278,10 @@ static uintptr_t BoundaryP; static size_t Count; static void callback(uintptr_t Base, size_t Size, void *Arg) { + if (scudo::archSupportsMemoryTagging()) { + Base = scudo::untagPointer(Base); + BoundaryP = scudo::untagPointer(BoundaryP); + } if (Base == BoundaryP) Count++; } @@ -328,7 +333,7 @@ TEST(ScudoWrappersCTest, MallocIterateBoundary) { // Fuchsia doesn't have alarm, fork or malloc_info. #if !SCUDO_FUCHSIA -TEST(ScudoWrappersCTest, MallocDisableDeadlock) { +TEST(ScudoWrappersCDeathTest, MallocDisableDeadlock) { // We expect heap operations within a disable/enable scope to deadlock. EXPECT_DEATH( { @@ -363,10 +368,10 @@ TEST(ScudoWrappersCTest, MallocInfo) { free(P2); } -TEST(ScudoWrappersCTest, Fork) { +TEST(ScudoWrappersCDeathTest, Fork) { void *P; pid_t Pid = fork(); - EXPECT_GE(Pid, 0); + EXPECT_GE(Pid, 0) << strerror(errno); if (Pid == 0) { P = malloc(Size); EXPECT_NE(P, nullptr); |