Commit eecd8b7c by Jakub Jelinek Committed by Jakub Jelinek

re PR sanitizer/59410 (tsan tests fail with address randomization disabled)

	PR sanitizer/59410
	* lib/tsan-dg.exp (tsan_init): Instead of not running any
	tsan tests if trivial testcase doesn't run, set dg-do-what-default
	to compile.
	(tsan_finish): Restore dg-do-what-default.
	* g++.dg/tsan/atomic_free.C: Remove dg-do line.
	* g++.dg/tsan/fd_close_norace2.C: Likewise.
	* g++.dg/tsan/default_options.C: Likewise.
	* g++.dg/tsan/aligned_vs_unaligned_race.C: Likewise.
	* g++.dg/tsan/atomic_free2.C: Likewise.
	* g++.dg/tsan/cond_race.C: Likewise.
	* g++.dg/tsan/fd_close_norace.C: Likewise.
	* g++.dg/tsan/benign_race.C: Likewise.
	* c-c++-common/tsan/fd_pipe_race.c: Likewise.
	* c-c++-common/tsan/simple_race.c: Likewise.
	* c-c++-common/tsan/mutexset1.c: Likewise.
	* c-c++-common/tsan/thread_leak2.c: Likewise.
	* c-c++-common/tsan/tls_race.c: Likewise.
	* c-c++-common/tsan/write_in_reader_lock.c: Likewise.
	* c-c++-common/tsan/race_on_barrier2.c: Likewise.
	* c-c++-common/tsan/free_race2.c: Likewise.
	* c-c++-common/tsan/thread_leak.c: Likewise.
	* c-c++-common/tsan/thread_leak1.c: Likewise.
	* c-c++-common/tsan/race_on_barrier.c: Likewise.
	* c-c++-common/tsan/free_race.c: Likewise.
	* c-c++-common/tsan/sleep_sync.c: Likewise.
	* c-c++-common/tsan/tiny_race.c: Likewise.
	* c-c++-common/tsan/race_on_mutex2.c: Likewise.
	* c-c++-common/tsan/atomic_stack.c: Likewise.
	* c-c++-common/tsan/race_on_mutex.c: Likewise.  Adjust line numbers
	in dg-output regexps.
	* c-c++-common/tsan/simple_stack.c: Likewise.

From-SVN: r207371
parent efa7882f
2014-01-31 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/59410
* lib/tsan-dg.exp (tsan_init): Instead of not running any
tsan tests if trivial testcase doesn't run, set dg-do-what-default
to compile.
(tsan_finish): Restore dg-do-what-default.
* g++.dg/tsan/atomic_free.C: Remove dg-do line.
* g++.dg/tsan/fd_close_norace2.C: Likewise.
* g++.dg/tsan/default_options.C: Likewise.
* g++.dg/tsan/aligned_vs_unaligned_race.C: Likewise.
* g++.dg/tsan/atomic_free2.C: Likewise.
* g++.dg/tsan/cond_race.C: Likewise.
* g++.dg/tsan/fd_close_norace.C: Likewise.
* g++.dg/tsan/benign_race.C: Likewise.
* c-c++-common/tsan/fd_pipe_race.c: Likewise.
* c-c++-common/tsan/simple_race.c: Likewise.
* c-c++-common/tsan/mutexset1.c: Likewise.
* c-c++-common/tsan/thread_leak2.c: Likewise.
* c-c++-common/tsan/tls_race.c: Likewise.
* c-c++-common/tsan/write_in_reader_lock.c: Likewise.
* c-c++-common/tsan/race_on_barrier2.c: Likewise.
* c-c++-common/tsan/free_race2.c: Likewise.
* c-c++-common/tsan/thread_leak.c: Likewise.
* c-c++-common/tsan/thread_leak1.c: Likewise.
* c-c++-common/tsan/race_on_barrier.c: Likewise.
* c-c++-common/tsan/free_race.c: Likewise.
* c-c++-common/tsan/sleep_sync.c: Likewise.
* c-c++-common/tsan/tiny_race.c: Likewise.
* c-c++-common/tsan/race_on_mutex2.c: Likewise.
* c-c++-common/tsan/atomic_stack.c: Likewise.
* c-c++-common/tsan/race_on_mutex.c: Likewise. Adjust line numbers
in dg-output regexps.
* c-c++-common/tsan/simple_stack.c: Likewise.
2014-01-31 Richard Henderson <rth@redhat.com>
* g++.dg/tm/pr60004.C: New.
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......@@ -38,7 +37,7 @@ int main() {
/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
/* { dg-output " Atomic read of size 1 at .* by thread T2:(\n|\r\n|\r)" } */
/* { dg-output " #0 pthread_mutex_lock.*" } */
/* { dg-output " #1 Thread2.* .*(race_on_mutex.c:22|\\?{2}:0) (.*)" } */
/* { dg-output " #1 Thread2.* .*(race_on_mutex.c:21|\\?{2}:0) (.*)" } */
/* { dg-output " Previous write of size 1 at .* by thread T1:(\n|\r\n|\r)" } */
/* { dg-output " #0 pthread_mutex_init .* (.)*" } */
/* { dg-output " #1 Thread1.* .*(race_on_mutex.c:13|\\?{2}:0) .*" } */
/* { dg-output " #1 Thread1.* .*(race_on_mutex.c:12|\\?{2}:0) .*" } */
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-set-target-env-var TSAN_OPTIONS "halt_on_error=1" } */
/* { dg-shouldfail "tsan" } */
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......@@ -51,16 +50,16 @@ int main() {
/* { dg-output "WARNING: ThreadSanitizer: data race.*" } */
/* { dg-output " Write of size 4 at .* by thread T1:(\n|\r\n|\r)" } */
/* { dg-output " #0 foo1.* .*(simple_stack.c:11|\\?{2}:0) (.*)" } */
/* { dg-output " #1 bar1.* .*(simple_stack.c:16|\\?{2}:0) (.*)" } */
/* { dg-output " #2 Thread1.* .*(simple_stack.c:30|\\?{2}:0) (.*)" } */
/* { dg-output " #0 foo1.* .*(simple_stack.c:10|\\?{2}:0) (.*)" } */
/* { dg-output " #1 bar1.* .*(simple_stack.c:15|\\?{2}:0) (.*)" } */
/* { dg-output " #2 Thread1.* .*(simple_stack.c:29|\\?{2}:0) (.*)" } */
/* { dg-output " Previous read of size 4 at .* by thread T2:(\n|\r\n|\r)" } */
/* { dg-output " #0 foo2.* .*(simple_stack.c:20|\\?{2}:0) (.*)" } */
/* { dg-output " #1 bar2.* .*(simple_stack.c:25|\\?{2}:0) (.*)" } */
/* { dg-output " #2 Thread2.* .*(simple_stack.c:35|\\?{2}:0) (.*)" } */
/* { dg-output " #0 foo2.* .*(simple_stack.c:19|\\?{2}:0) (.*)" } */
/* { dg-output " #1 bar2.* .*(simple_stack.c:24|\\?{2}:0) (.*)" } */
/* { dg-output " #2 Thread2.* .*(simple_stack.c:34|\\?{2}:0) (.*)" } */
/* { dg-output " Thread T1 \\(tid=.*, running\\) created by main thread at:(\n|\r\n|\r)" } */
/* { dg-output " #0 pthread_create .* (.*)" } */
/* { dg-output " #1 StartThread.* .*(simple_stack.c:40|\\?{2}:0) (.*)" } */
/* { dg-output " #1 StartThread.* .*(simple_stack.c:39|\\?{2}:0) (.*)" } */
/* { dg-output " Thread T2 (.*) created by main thread at:(\n|\r\n|\r)" } */
/* { dg-output " #0 pthread_create .* (.*)" } */
/* { dg-output " #1 StartThread.* .*(simple_stack.c:40|\\?{2}:0) (.*)" } */
/* { dg-output " #1 StartThread.* .*(simple_stack.c:39|\\?{2}:0) (.*)" } */
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
#include <pthread.h>
#include <stdio.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run { target { x86_64-*-linux* } } } */
#include <pthread.h>
#include <stdio.h>
#include <stdint.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
/* { dg-output "ThreadSanitizer: data race.*" } */
/* { dg-output "pthread_cond_signal.*" } */
......
/* { dg-do run } */
/* { dg-shouldfail "tsan" } */
#include <pthread.h>
......
/* { dg-do run } */
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
......
/* { dg-do run } */
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
......
......@@ -69,6 +69,8 @@ proc tsan_init { args } {
global ALWAYS_CXXFLAGS
global TOOL_OPTIONS
global tsan_saved_TEST_ALWAYS_FLAGS
global dg-do-what-default
global tsan_saved_dg-do-what-default
set link_flags ""
if ![is_remote host] {
......@@ -79,6 +81,9 @@ proc tsan_init { args } {
}
}
if [info exists dg-do-what-default] {
set tsan_saved_dg-do-what-default ${dg-do-what-default}
}
if [info exists TEST_ALWAYS_FLAGS] {
set tsan_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS
}
......@@ -96,8 +101,11 @@ proc tsan_init { args } {
if [check_runtime_nocache tsan_works {
int main () { return 0; }
} "-fPIE -pie -fsanitize=thread -g"] {
return 1
set dg-do-what-default run
} else {
set dg-do-what-default compile
}
return 1
}
return 0
}
......@@ -109,10 +117,17 @@ proc tsan_init { args } {
proc tsan_finish { args } {
global TEST_ALWAYS_FLAGS
global tsan_saved_TEST_ALWAYS_FLAGS
global dg-do-what-default
global tsan_saved_dg-do-what-default
if [info exists tsan_saved_TEST_ALWAYS_FLAGS] {
set TEST_ALWAYS_FLAGS $tsan_saved_TEST_ALWAYS_FLAGS
} else {
unset TEST_ALWAYS_FLAGS
}
if [info exists tsan_saved_dg-do-what-default] {
set dg-do-what-default ${tsan_saved_dg-do-what-default}
} else {
unset dg-do-what-default
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment