|
From: <sv...@va...> - 2010-03-07 19:59:43
|
Author: bart
Date: 2010-03-07 19:59:35 +0000 (Sun, 07 Mar 2010)
New Revision: 11076
Log:
Added yet another regression test.
Added:
trunk/drd/tests/annotate_hb_race.c
trunk/drd/tests/annotate_hb_race.stderr.exp
trunk/drd/tests/annotate_hb_race.vgtest
Modified:
trunk/drd/tests/
trunk/drd/tests/Makefile.am
Property changes on: trunk/drd/tests
___________________________________________________________________
Name: svn:ignore
- *.dSYM
*.stderr.diff*
*.stderr.out
*.stdout.diff*
*.stdout.out
.deps
Makefile
Makefile.in
annotate_hb_err
annotate_ignore_rw
annotate_ignore_write
annotate_publish_hg
annotate_rwlock
annotate_smart_pointer
atomic_var
bar_bad
bar_trivial
boost_thread
circular_buffer
custom_alloc
drd_bitmap_test
fp_race
hg01_all_ok
hg02_deadlock
hg03_inherit
hg04_race
hg05_race2
hg06_readshared
hold_lock
linuxthreads_det
matinv
memory_allocation
monitor_example
new_delete
omp_matinv
omp_prime
omp_printf
pth_barrier
pth_barrier_race
pth_barrier_reinit
pth_broadcast
pth_cancel_locked
pth_cleanup_handler
pth_cond_race
pth_create_chain
pth_create_glibc_2_0
pth_detached
pth_detached_sem
pth_inconsistent_cond_wait
pth_mutex_reinit
pth_process_shared_mutex
pth_spinlock
qt4_atomic
qt4_mutex
qt4_rwlock
qt4_semaphore
recursive_mutex
rwlock_race
rwlock_test
rwlock_type_checking
sem_as_mutex
sem_open
sigalrm
tc01_simple_race
tc02_simple_tls
tc03_re_excl
tc04_free_lock
tc05_simple_race
tc06_two_races
tc07_hbl1
tc08_hbl2
tc09_bad_unlock
tc10_rec_lock
tc11_XCHG
tc12_rwl_trivial
tc13_laog1
tc15_laog_lockdel
tc16_byterace
tc17_sembar
tc18_semabuse
tc19_shadowmem
tc20_verifywrap
tc21_pthonce
tc22_exit_w_lock
tc23_bogus_condwait
tc24_nonzero_sem
thread_name
trylock
tsan_unittest
unit_bitmap
unit_vc
vg_regtest.tmp*
+ *.dSYM
*.stderr.diff*
*.stderr.out
*.stdout.diff*
*.stdout.out
.deps
Makefile
Makefile.in
annotate_hb_err
annotate_hb_race
annotate_ignore_rw
annotate_ignore_write
annotate_publish_hg
annotate_rwlock
annotate_smart_pointer
atomic_var
bar_bad
bar_trivial
boost_thread
circular_buffer
custom_alloc
drd_bitmap_test
fp_race
hg01_all_ok
hg02_deadlock
hg03_inherit
hg04_race
hg05_race2
hg06_readshared
hold_lock
linuxthreads_det
matinv
memory_allocation
monitor_example
new_delete
omp_matinv
omp_prime
omp_printf
pth_barrier
pth_barrier_race
pth_barrier_reinit
pth_broadcast
pth_cancel_locked
pth_cleanup_handler
pth_cond_race
pth_create_chain
pth_create_glibc_2_0
pth_detached
pth_detached_sem
pth_inconsistent_cond_wait
pth_mutex_reinit
pth_process_shared_mutex
pth_spinlock
qt4_atomic
qt4_mutex
qt4_rwlock
qt4_semaphore
recursive_mutex
rwlock_race
rwlock_test
rwlock_type_checking
sem_as_mutex
sem_open
sigalrm
tc01_simple_race
tc02_simple_tls
tc03_re_excl
tc04_free_lock
tc05_simple_race
tc06_two_races
tc07_hbl1
tc08_hbl2
tc09_bad_unlock
tc10_rec_lock
tc11_XCHG
tc12_rwl_trivial
tc13_laog1
tc15_laog_lockdel
tc16_byterace
tc17_sembar
tc18_semabuse
tc19_shadowmem
tc20_verifywrap
tc21_pthonce
tc22_exit_w_lock
tc23_bogus_condwait
tc24_nonzero_sem
thread_name
trylock
tsan_unittest
unit_bitmap
unit_vc
vg_regtest.tmp*
Modified: trunk/drd/tests/Makefile.am
===================================================================
--- trunk/drd/tests/Makefile.am 2010-03-07 18:39:33 UTC (rev 11075)
+++ trunk/drd/tests/Makefile.am 2010-03-07 19:59:35 UTC (rev 11076)
@@ -16,6 +16,8 @@
EXTRA_DIST = \
annotate_hb_err.stderr.exp \
annotate_hb_err.vgtest \
+ annotate_hb_race.stderr.exp \
+ annotate_hb_race.vgtest \
annotate_hbefore.stderr.exp \
annotate_hbefore.vgtest \
annotate_order_1.stderr.exp \
@@ -249,6 +251,7 @@
check_PROGRAMS = \
annotate_hb_err \
+ annotate_hb_race \
annotate_ignore_rw \
annotate_ignore_write \
annotate_publish_hg \
Added: trunk/drd/tests/annotate_hb_race.c
===================================================================
--- trunk/drd/tests/annotate_hb_race.c (rev 0)
+++ trunk/drd/tests/annotate_hb_race.c 2010-03-07 19:59:35 UTC (rev 11076)
@@ -0,0 +1,50 @@
+/*
+ * Test program with happens-before / happens-after annotations that triggers
+ * a data race. The data race will only be reported if happens-after
+ * annotations that occur in different threads are not totally ordered. Or:
+ * this is a test for the implementation of ordering annotations.
+ */
+
+
+#include <stdio.h>
+#include <pthread.h>
+#include "unified_annotations.h"
+
+
+static int s_i;
+
+
+static void* thread_func(void* arg)
+{
+ int i;
+
+ ANNOTATE_HAPPENS_AFTER(&s_i);
+ i = s_i;
+ ANNOTATE_HAPPENS_AFTER(&s_i);
+ *(int*)arg = i;
+ return NULL;
+}
+
+int main(int argc, char** argv)
+{
+ pthread_t tid[2];
+ int result[2];
+
+ ANNOTATE_HAPPENS_BEFORE(&s_i);
+ pthread_create(&tid[0], 0, thread_func, &result[0]);
+ pthread_create(&tid[1], 0, thread_func, &result[1]);
+ s_i = 1;
+
+ pthread_join(tid[0], NULL);
+ pthread_join(tid[1], NULL);
+
+ fprintf(stderr, "Done.\n");
+
+ return 0;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 2
+ * End:
+ */
Added: trunk/drd/tests/annotate_hb_race.stderr.exp
===================================================================
--- trunk/drd/tests/annotate_hb_race.stderr.exp (rev 0)
+++ trunk/drd/tests/annotate_hb_race.stderr.exp 2010-03-07 19:59:35 UTC (rev 11076)
@@ -0,0 +1,9 @@
+
+Conflicting store by thread x at 0x........ size 4
+ at 0x........: main (annotate_hb_race.c:?)
+Location 0x........ is 0 bytes inside local var "s_i"
+declared at annotate_hb_race.c:14, in frame #? of thread x
+
+Done.
+
+ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Added: trunk/drd/tests/annotate_hb_race.vgtest
===================================================================
--- trunk/drd/tests/annotate_hb_race.vgtest (rev 0)
+++ trunk/drd/tests/annotate_hb_race.vgtest 2010-03-07 19:59:35 UTC (rev 11076)
@@ -0,0 +1,4 @@
+prereq: test -e annotate_hb_race && ./supported_libpthread
+vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no
+prog: annotate_hb_race
+stderr_filter: filter_stderr_and_thread_no
|