[compiler-rt] 88c9162 - Fix the test case in D88686
Jianzhou Zhao via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 17:30:35 PDT 2020
Author: Jianzhou Zhao
Date: 2020-10-03T00:23:39Z
New Revision: 88c9162c9d47ef43a505bc5301dc626f3cd4f437
URL: https://github.com/llvm/llvm-project/commit/88c9162c9d47ef43a505bc5301dc626f3cd4f437
DIFF: https://github.com/llvm/llvm-project/commit/88c9162c9d47ef43a505bc5301dc626f3cd4f437.diff
LOG: Fix the test case in D88686
Adjusted when to check RSS.
Added:
Modified:
compiler-rt/test/dfsan/munmap_release_shadow.c
Removed:
################################################################################
diff --git a/compiler-rt/test/dfsan/munmap_release_shadow.c b/compiler-rt/test/dfsan/munmap_release_shadow.c
index 98147dc695b9..03197dfb8641 100644
--- a/compiler-rt/test/dfsan/munmap_release_shadow.c
+++ b/compiler-rt/test/dfsan/munmap_release_shadow.c
@@ -32,8 +32,14 @@ int main(int argc, char **argv) {
munmap(p, map_size);
size_t after_munmap = get_rss_kb();
- fprintf(stderr, "RSS at start: %td, after mmap: %td, after mumap: %td\n",
- before, after_mmap, after_munmap);
+ p = mmap(NULL, map_size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ dfsan_set_label(label, &val, sizeof(val));
+ memset(p, val, map_size);
+ size_t after_mmap2 = get_rss_kb();
+
+ fprintf(stderr, "RSS at start: %td, after mmap: %td, after mumap: %td, after mmap2: %td\n",
+ before, after_mmap, after_munmap, after_mmap2);
// The memory after mmap increases 3 times of map_size because the overhead of
// shadow memory is 2x.
@@ -42,6 +48,7 @@ int main(int argc, char **argv) {
// OS does not release memory to the same level as the start of the program.
// The assert checks the memory after munmap up to a delta.
const size_t delta = 50000;
- assert(after_munmap + delta <= after_mmap);
+ assert(after_mmap2 <= after_mmap + delta);
+
return 0;
}
More information about the llvm-commits
mailing list