[PATCH] [TSan][MIPS64] Fix few more test cases for MIPS64
Sagar Thakur
Sagar.Thakur at imgtec.com
Thu Jan 29 22:52:23 PST 2015
Hi dvyukov, samsonov, kcc,
Test cases fixed :
- global_race.cc, global_race2.cc, global_race3.cc : File Check expects a 47-bit address in place of ADDR, ADDR2, ADDR3 in the test cases. Used 40-bit address for mips64.
- map32bit.cc : MAP_32BIT flag for mmap is supported only for x86_64. Marked as XFAIL for mips64.
- mmap_large.cc : Mmap start address is given according to 47-bit address space. Used 40-bit address for mips64.
- signal_errno.cc : Stack trace was incorrect because pc was incremented by 1 in tsan_interceptors.cc:1908 in CallUserSignalHandler (). Used `StackTrace::GetNextInstructionPC ()` in place of `pc +1`.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7290
Files:
lib/tsan/rtl/tsan_interceptors.cc
test/tsan/global_race.cc
test/tsan/global_race2.cc
test/tsan/global_race3.cc
test/tsan/map32bit.cc
test/tsan/mmap_large.cc
Index: lib/tsan/rtl/tsan_interceptors.cc
===================================================================
--- lib/tsan/rtl/tsan_interceptors.cc
+++ lib/tsan/rtl/tsan_interceptors.cc
@@ -1897,7 +1897,7 @@
VarSizeStackTrace stack;
// Add 1 to pc because return address is expected,
// OutputReport() will undo this.
- ObtainCurrentStack(thr, pc + 1, &stack);
+ ObtainCurrentStack(thr, StackTrace::GetNextInstructionPc(pc), &stack);
ThreadRegistryLock l(ctx->thread_registry);
ScopedReport rep(ReportTypeErrnoInSignal);
if (!IsFiredSuppression(ctx, rep, stack)) {
Index: test/tsan/global_race.cc
===================================================================
--- test/tsan/global_race.cc
+++ test/tsan/global_race.cc
@@ -13,7 +13,11 @@
barrier_init(&barrier, 2);
// On FreeBSD, the %p conversion specifier works as 0x%x and thus does not
// match to the format used in the diagnotic message.
+#ifdef __x86_64__
fprintf(stderr, "addr=0x%012lx\n", (unsigned long) GlobalData);
+#elif defined(__mips64)
+ fprintf(stderr, "addr=0x%010lx\n", (unsigned long) GlobalData);
+#endif
pthread_t t;
pthread_create(&t, 0, Thread, 0);
GlobalData[2] = 43;
Index: test/tsan/global_race2.cc
===================================================================
--- test/tsan/global_race2.cc
+++ test/tsan/global_race2.cc
@@ -13,7 +13,11 @@
barrier_init(&barrier, 2);
// On FreeBSD, the %p conversion specifier works as 0x%x and thus does not
// match to the format used in the diagnotic message.
+#ifdef __x86_64__
fprintf(stderr, "addr2=0x%012lx\n", (unsigned long) &x);
+#elif defined(__mips64)
+ fprintf(stderr, "addr2=0x%010lx\n", (unsigned long) &x);
+#endif
pthread_t t;
pthread_create(&t, 0, Thread, 0);
x = 0;
Index: test/tsan/global_race3.cc
===================================================================
--- test/tsan/global_race3.cc
+++ test/tsan/global_race3.cc
@@ -18,7 +18,11 @@
barrier_init(&barrier, 2);
// On FreeBSD, the %p conversion specifier works as 0x%x and thus does not
// match to the format used in the diagnotic message.
+#ifdef __x86_64__
fprintf(stderr, "addr3=0x%012lx\n", (unsigned long) XXX::YYY::ZZZ);
+#elif defined(__mips64)
+ fprintf(stderr, "addr3=0x%010lx\n", (unsigned long) XXX::YYY::ZZZ);
+#endif
pthread_t t;
pthread_create(&t, 0, Thread, 0);
XXX::YYY::ZZZ[0] = 0;
Index: test/tsan/map32bit.cc
===================================================================
--- test/tsan/map32bit.cc
+++ test/tsan/map32bit.cc
@@ -7,6 +7,9 @@
// Test for issue:
// https://code.google.com/p/thread-sanitizer/issues/detail?id=5
+// MAP_32BIT flag for mmap is supported only for x86_64.
+// XFAIL: mips64
+
void *Thread(void *ptr) {
*(int*)ptr = 42;
barrier_wait(&barrier);
Index: test/tsan/mmap_large.cc
===================================================================
--- test/tsan/mmap_large.cc
+++ test/tsan/mmap_large.cc
@@ -5,7 +5,11 @@
#include <sys/mman.h>
int main() {
+#ifdef __x86_64__
const size_t kLog2Size = 39;
+#elif defined(__mips64)
+ const size_t kLog2Size = 32;
+#endif
const uintptr_t kLocation = 0x40ULL << kLog2Size;
void *p = mmap(
reinterpret_cast<void*>(kLocation),
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7290.19025.patch
Type: text/x-patch
Size: 3248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150130/13dab3e1/attachment.bin>
More information about the llvm-commits
mailing list