[PATCH] [lsan] Remove old LSan tests. Convert one of them to a LIT test.
Sergey Matveev
earthdok at google.com
Mon May 27 03:40:33 PDT 2013
================
Comment at: lib/lsan/lit_tests/use_globals_initialized.cc:5
@@ +4,3 @@
+// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_globals=0" %t 2>&1 | FileCheck --check-prefix=CHECK-leak %s
+// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_globals=1" %t 2>&1
+// RUN: LSAN_OPTIONS="" %t 2>&1
----------------
Kostya Serebryany wrote:
> Is this correct?
> use_globals=1 has no leaks, but use_globals=0 has them?
Yes. When use_globals=false, LSan doesn't see the pointer stored in the global variable, so it reports the block as leaked.
================
Comment at: lib/lsan/lit_tests/use_globals_initialized.cc:11
@@ +10,3 @@
+
+unsigned kSmallAllocSize = 1337;
+
----------------
Kostya Serebryany wrote:
> This constant is used just once and then in the CHECK section you use 1337 again.
> So, I'd just use malloc(1337);
done
================
Comment at: lib/lsan/lit_tests/use_globals_initialized.cc:20
@@ +19,3 @@
+}
+// CHECK-leak: Test alloc: [[ADDR:.*]].
+// CHECK-leak: Directly leaked 1337 byte block at [[ADDR]]
----------------
Kostya Serebryany wrote:
> lsan report should have a header, like asan/msan/tsan do
> ==1234== WARNING: LeakSanitizer: memory leaks
> and the tests need to check for it.
done
http://llvm-reviews.chandlerc.com/D860
More information about the llvm-commits
mailing list