From 684792c22dbaa1fb758a4b6e2e95a14cd7766e87 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 12 Aug 2009 07:03:30 +0000 Subject: [PATCH] Modified annotate_ignore_rw test such that it now verifies that ANNOTATE_IGNORE_READS_AND_WRITES_END() really works. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10787 --- drd/tests/annotate_ignore_rw.c | 14 ++++++++++++++ drd/tests/annotate_ignore_rw.stderr.exp | 7 ++++++- drd/tests/annotate_ignore_rw2.stderr.exp | 7 ++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drd/tests/annotate_ignore_rw.c b/drd/tests/annotate_ignore_rw.c index 9efe1fb3d3..e4eba066c1 100644 --- a/drd/tests/annotate_ignore_rw.c +++ b/drd/tests/annotate_ignore_rw.c @@ -8,11 +8,14 @@ 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; } @@ -21,6 +24,7 @@ int main(int argc, char** argv) { int optchar; int ign_rw = 1; + int tmp; pthread_t tid; while ((optchar = getopt(argc, argv, "r")) != EOF) @@ -42,6 +46,16 @@ int main(int argc, char** argv) s_a = s_b; if (ign_rw) ANNOTATE_IGNORE_READS_AND_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. */ + tmp = s_c; + pthread_join(tid, 0); fprintf(stderr, "Finished.\n"); diff --git a/drd/tests/annotate_ignore_rw.stderr.exp b/drd/tests/annotate_ignore_rw.stderr.exp index a7089bb434..384490af0b 100644 --- a/drd/tests/annotate_ignore_rw.stderr.exp +++ b/drd/tests/annotate_ignore_rw.stderr.exp @@ -1,4 +1,9 @@ +Conflicting load by thread 1 at 0x........ size 4 + at 0x........: main (annotate_ignore_rw.c:?) +Location 0x........ is 0 bytes inside local var "s_c" +declared at annotate_ignore_rw.c:11, in frame #? of thread 1 + Finished. -ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) +ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) diff --git a/drd/tests/annotate_ignore_rw2.stderr.exp b/drd/tests/annotate_ignore_rw2.stderr.exp index 140a319c1d..617dd2d581 100644 --- a/drd/tests/annotate_ignore_rw2.stderr.exp +++ b/drd/tests/annotate_ignore_rw2.stderr.exp @@ -9,6 +9,11 @@ Conflicting store by thread 1 at 0x........ size 4 Location 0x........ is 0 bytes inside local var "s_a" declared at annotate_ignore_rw.c:9, in frame #? of thread 1 +Conflicting load by thread 1 at 0x........ size 4 + at 0x........: main (annotate_ignore_rw.c:?) +Location 0x........ is 0 bytes inside local var "s_c" +declared at annotate_ignore_rw.c:11, in frame #? of thread 1 + Finished. -ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) +ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0) -- 2.47.3