|
From: <sv...@va...> - 2009-08-13 09:31:15
|
Author: bart
Date: 2009-08-13 10:30:57 +0100 (Thu, 13 Aug 2009)
New Revision: 10800
Log:
Added test program for the ANNOTATE_IGNORE_WRITES_*() annotation
macro's.
Added:
trunk/drd/tests/annotate_ignore_write.c
trunk/drd/tests/annotate_ignore_write.stderr.exp
trunk/drd/tests/annotate_ignore_write.vgtest
trunk/drd/tests/annotate_ignore_write2.stderr.exp
trunk/drd/tests/annotate_ignore_write2.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
annotate_ignore_rw
annotate_rwlock
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
Makefile
Makefile.in
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_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
annotate_ignore_rw
annotate_ignore_write
annotate_rwlock
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
Makefile
Makefile.in
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_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 2009-08-13 04:24:38 UTC (rev 10799)
+++ trunk/drd/tests/Makefile.am 2009-08-13 09:30:57 UTC (rev 10800)
@@ -29,6 +29,10 @@
annotate_ignore_rw.vgtest \
annotate_ignore_rw2.stderr.exp \
annotate_ignore_rw2.vgtest \
+ annotate_ignore_write.stderr.exp \
+ annotate_ignore_write.vgtest \
+ annotate_ignore_write2.stderr.exp \
+ annotate_ignore_write2.vgtest \
annotate_trace_memory.stderr.exp \
annotate_trace_memory.vgtest \
atomic_var.stderr.exp \
@@ -244,6 +248,7 @@
check_PROGRAMS = \
annotate_ignore_rw \
+ annotate_ignore_write \
custom_alloc \
fp_race \
hold_lock \
Added: trunk/drd/tests/annotate_ignore_write.c
===================================================================
--- trunk/drd/tests/annotate_ignore_write.c (rev 0)
+++ trunk/drd/tests/annotate_ignore_write.c 2009-08-13 09:30:57 UTC (rev 10800)
@@ -0,0 +1,63 @@
+/* Test program for the annotations that suppress write operations. */
+
+#include <assert.h> /* assert() */
+#include <pthread.h>
+#include <stdio.h> /* EOF */
+#include <unistd.h> /* getopt() */
+#include "../../drd/drd.h"
+
+static int s_a;
+static int s_b;
+static int s_c;
+
+static void* thread_func(void* arg)
+{
+ /* Read s_a and modify s_b. */
+ s_b = s_a;
+ /* Modify s_c. */
+ s_c = 1;
+
+ return NULL;
+}
+
+int main(int argc, char** argv)
+{
+ int optchar;
+ int ign_rw = 1;
+ pthread_t tid;
+
+ while ((optchar = getopt(argc, argv, "r")) != EOF)
+ {
+ switch (optchar)
+ {
+ case 'r':
+ ign_rw = 0;
+ break;
+ default:
+ assert(0);
+ }
+ }
+
+ pthread_create(&tid, 0, thread_func, 0);
+ if (ign_rw)
+ ANNOTATE_IGNORE_WRITES_BEGIN();
+ /* Read s_b and modify s_a. */
+ s_a = s_b;
+ if (ign_rw)
+ ANNOTATE_IGNORE_WRITES_END();
+
+ /*
+ * Insert a delay here in order to make sure the load of s_c happens
+ * after s_c has been modified.
+ */
+ sleep(1);
+
+ /* Read s_c and modify s_a. */
+ s_a = s_c;
+
+ pthread_join(tid, 0);
+
+ fprintf(stderr, "Finished.\n");
+
+ return 0;
+}
Added: trunk/drd/tests/annotate_ignore_write.stderr.exp
===================================================================
--- trunk/drd/tests/annotate_ignore_write.stderr.exp (rev 0)
+++ trunk/drd/tests/annotate_ignore_write.stderr.exp 2009-08-13 09:30:57 UTC (rev 10800)
@@ -0,0 +1,19 @@
+
+Conflicting load by thread 1 at 0x........ size 4
+ at 0x........: main (annotate_ignore_write.c:?)
+Location 0x........ is 0 bytes inside local var "s_b"
+declared at annotate_ignore_write.c:10, in frame #? of thread 1
+
+Conflicting load by thread 1 at 0x........ size 4
+ at 0x........: main (annotate_ignore_write.c:?)
+Location 0x........ is 0 bytes inside local var "s_c"
+declared at annotate_ignore_write.c:11, in frame #? of thread 1
+
+Conflicting store by thread 1 at 0x........ size 4
+ at 0x........: main (annotate_ignore_write.c:?)
+Location 0x........ is 0 bytes inside local var "s_a"
+declared at annotate_ignore_write.c:9, in frame #? of thread 1
+
+Finished.
+
+ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
Added: trunk/drd/tests/annotate_ignore_write.vgtest
===================================================================
--- trunk/drd/tests/annotate_ignore_write.vgtest (rev 0)
+++ trunk/drd/tests/annotate_ignore_write.vgtest 2009-08-13 09:30:57 UTC (rev 10800)
@@ -0,0 +1,4 @@
+prereq: ./supported_libpthread
+vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no
+prog: annotate_ignore_write
+stderr_filter: filter_stderr
Added: trunk/drd/tests/annotate_ignore_write2.stderr.exp
===================================================================
--- trunk/drd/tests/annotate_ignore_write2.stderr.exp (rev 0)
+++ trunk/drd/tests/annotate_ignore_write2.stderr.exp 2009-08-13 09:30:57 UTC (rev 10800)
@@ -0,0 +1,24 @@
+
+Conflicting load by thread 1 at 0x........ size 4
+ at 0x........: main (annotate_ignore_write.c:?)
+Location 0x........ is 0 bytes inside local var "s_b"
+declared at annotate_ignore_write.c:10, in frame #? of thread 1
+
+Conflicting store by thread 1 at 0x........ size 4
+ at 0x........: main (annotate_ignore_write.c:?)
+Location 0x........ is 0 bytes inside local var "s_a"
+declared at annotate_ignore_write.c:9, in frame #? of thread 1
+
+Conflicting load by thread 1 at 0x........ size 4
+ at 0x........: main (annotate_ignore_write.c:?)
+Location 0x........ is 0 bytes inside local var "s_c"
+declared at annotate_ignore_write.c:11, in frame #? of thread 1
+
+Conflicting store by thread 1 at 0x........ size 4
+ at 0x........: main (annotate_ignore_write.c:?)
+Location 0x........ is 0 bytes inside local var "s_a"
+declared at annotate_ignore_write.c:9, in frame #? of thread 1
+
+Finished.
+
+ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
Added: trunk/drd/tests/annotate_ignore_write2.vgtest
===================================================================
--- trunk/drd/tests/annotate_ignore_write2.vgtest (rev 0)
+++ trunk/drd/tests/annotate_ignore_write2.vgtest 2009-08-13 09:30:57 UTC (rev 10800)
@@ -0,0 +1,5 @@
+prereq: ./supported_libpthread
+vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no
+prog: annotate_ignore_write
+args: -r
+stderr_filter: filter_stderr
|