]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Modified annotate_ignore_rw test such that it now verifies that
authorBart Van Assche <bvanassche@acm.org>
Wed, 12 Aug 2009 07:03:30 +0000 (07:03 +0000)
committerBart Van Assche <bvanassche@acm.org>
Wed, 12 Aug 2009 07:03:30 +0000 (07:03 +0000)
ANNOTATE_IGNORE_READS_AND_WRITES_END() really works.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10787

drd/tests/annotate_ignore_rw.c
drd/tests/annotate_ignore_rw.stderr.exp
drd/tests/annotate_ignore_rw2.stderr.exp

index 9efe1fb3d3d0d9660558e0953ab1a2b433a2f165..e4eba066c1f15c30a98b54a21ffe08f371b951d3 100644 (file)
@@ -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");
index a7089bb434c9dde3bb9fba2f44cbaee14d5a74af..384490af0bc6a268102f78c7405190f5c13bfdd1 100644 (file)
@@ -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)
index 140a319c1dbe52144172a5358f4ed08af190df1f..617dd2d5813d3ee90954bf53e5d2981853a3a34c 100644 (file)
@@ -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)