summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drd/tests/bug-235681.c30
-rw-r--r--drd/tests/bug-235681.stderr.exp9
-rw-r--r--drd/tests/bug-235681.vgtest1
3 files changed, 24 insertions, 16 deletions
diff --git a/drd/tests/bug-235681.c b/drd/tests/bug-235681.c
index 3b306ec0..99114eb6 100644
--- a/drd/tests/bug-235681.c
+++ b/drd/tests/bug-235681.c
@@ -13,28 +13,34 @@
pthread_mutex_t mutex;
pthread_cond_t cond_var;
int status;
+int silent;
static void *run_fn(void *v)
{
int rc;
- fprintf(stderr, "run_fn starting\n");
+ if (!silent)
+ fprintf(stderr, "run_fn starting\n");
rc = pthread_mutex_lock(&mutex);
assert(!rc);
while (!status) {
- fprintf(stderr, "run_fn(): status==0\n");
+ if (!silent)
+ fprintf(stderr, "run_fn(): status==0\n");
rc = pthread_cond_wait(&cond_var, &mutex);
assert(!rc);
- fprintf(stderr, "run_fn(): woke up\n");
+ if (!silent)
+ fprintf(stderr, "run_fn(): woke up\n");
}
- fprintf(stderr, "run_fn(): status==1\n");
+ if (!silent)
+ fprintf(stderr, "run_fn(): status==1\n");
rc = pthread_mutex_unlock(&mutex);
assert(!rc);
- fprintf(stderr, "run_fn done\n");
+ if (!silent)
+ fprintf(stderr, "run_fn done\n");
return NULL;
}
@@ -44,6 +50,9 @@ int main(int argc, char **argv)
int rc;
pthread_t other_thread;
+ if (argc > 1)
+ silent = 1;
+
rc = pthread_mutex_init(&mutex, NULL);
assert(!rc);
rc = pthread_cond_init(&cond_var, NULL);
@@ -55,14 +64,16 @@ int main(int argc, char **argv)
assert(!rc);
/* yield the processor, and give the other thread a chance to get into the while loop */
- fprintf(stderr, "main(): sleeping...\n");
+ if (!silent)
+ fprintf(stderr, "main(): sleeping...\n");
sleep(1);
rc = pthread_mutex_lock(&mutex);
assert(!rc);
/**** BEGIN CS *****/
- fprintf(stderr, "main(): status=1\n");
+ if (!silent)
+ fprintf(stderr, "main(): status=1\n");
status = 1;
rc = pthread_cond_broadcast(&cond_var);
assert(!rc);
@@ -71,10 +82,13 @@ int main(int argc, char **argv)
rc = pthread_mutex_unlock(&mutex);
assert(!rc);
- fprintf(stderr, "joining...\n");
+ if (!silent)
+ fprintf(stderr, "joining...\n");
rc = pthread_join(other_thread, NULL);
assert(!rc);
+ fprintf(stderr, "Done.\n");
+
return 0;
}
diff --git a/drd/tests/bug-235681.stderr.exp b/drd/tests/bug-235681.stderr.exp
index 8aa66127..d16127fb 100644
--- a/drd/tests/bug-235681.stderr.exp
+++ b/drd/tests/bug-235681.stderr.exp
@@ -1,11 +1,4 @@
-run_fn starting
-run_fn(): status==0
-main(): sleeping...
-main(): status=1
-joining...
-run_fn(): woke up
-run_fn(): status==1
-run_fn done
+Done.
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
diff --git a/drd/tests/bug-235681.vgtest b/drd/tests/bug-235681.vgtest
index 45ff5fd8..f6051b7c 100644
--- a/drd/tests/bug-235681.vgtest
+++ b/drd/tests/bug-235681.vgtest
@@ -1,4 +1,5 @@
prereq: test -e bug-235681 && ./supported_libpthread
vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=3
prog: bug-235681
+args: -q
stderr_filter: filter_stderr