]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add testcase from BZ #324149 which was forgotten in r13641.
authorFlorian Krohm <florian@eich-krohm.de>
Wed, 16 Jul 2014 08:18:17 +0000 (08:18 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Wed, 16 Jul 2014 08:18:17 +0000 (08:18 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14168

helgrind/tests/Makefile.am
helgrind/tests/cond_timedwait_test.c [new file with mode: 0644]
helgrind/tests/cond_timedwait_test.stderr.exp [new file with mode: 0644]
helgrind/tests/cond_timedwait_test.stdout.exp [new file with mode: 0644]
helgrind/tests/cond_timedwait_test.vgtest [new file with mode: 0644]

index d06043eacb29b36d307275097187f74c0d8faf17..79dc9452a5bc0a56573e4308c2f84432ad7cac73 100644 (file)
@@ -15,6 +15,8 @@ EXTRA_DIST = \
        cond_init_destroy.vgtest cond_init_destroy.stderr.exp \
        cond_timedwait_invalid.vgtest cond_timedwait_invalid.stdout.exp \
                cond_timedwait_invalid.stderr.exp \
+       cond_timedwait_test.vgtest cond_timedwait_test.stdout.exp \
+               cond_timedwait_test.stderr.exp \
        bar_bad.vgtest bar_bad.stdout.exp bar_bad.stderr.exp \
        bar_trivial.vgtest bar_trivial.stdout.exp bar_trivial.stderr.exp \
        free_is_write.vgtest free_is_write.stdout.exp \
@@ -108,6 +110,7 @@ check_PROGRAMS = \
        annotate_hbefore \
        cond_init_destroy \
        cond_timedwait_invalid \
+       cond_timedwait_test \
        free_is_write \
        hg01_all_ok \
        hg02_deadlock \
diff --git a/helgrind/tests/cond_timedwait_test.c b/helgrind/tests/cond_timedwait_test.c
new file mode 100644 (file)
index 0000000..e9b9be8
--- /dev/null
@@ -0,0 +1,20 @@
+#include <pthread.h>
+#include <string.h>
+
+int main() {
+  pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+  pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+  // This time has most definitely passed already. (Epoch)
+  struct timespec now;
+  memset(&now, 0, sizeof(now));
+
+  pthread_mutex_lock(&mutex);
+  pthread_cond_timedwait(&cond, &mutex, &now);
+  pthread_mutex_unlock(&mutex);
+
+  pthread_mutex_destroy(&mutex);
+  pthread_cond_destroy(&cond);
+
+  return 0;
+}
diff --git a/helgrind/tests/cond_timedwait_test.stderr.exp b/helgrind/tests/cond_timedwait_test.stderr.exp
new file mode 100644 (file)
index 0000000..d18786f
--- /dev/null
@@ -0,0 +1,3 @@
+
+
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
diff --git a/helgrind/tests/cond_timedwait_test.stdout.exp b/helgrind/tests/cond_timedwait_test.stdout.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/helgrind/tests/cond_timedwait_test.vgtest b/helgrind/tests/cond_timedwait_test.vgtest
new file mode 100644 (file)
index 0000000..b2a3d71
--- /dev/null
@@ -0,0 +1 @@
+prog: cond_timedwait_test