From: Bart Van Assche Date: Wed, 9 Mar 2011 17:50:34 +0000 (+0000) Subject: DRD: Added a regression test. X-Git-Tag: svn/VALGRIND_3_7_0~616 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c42807edf5cc3b8203016560983fb097de9a879d;p=thirdparty%2Fvalgrind.git DRD: Added a regression test. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11613 --- diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am index adbc39dc90..b6f40f8ab8 100644 --- a/drd/tests/Makefile.am +++ b/drd/tests/Makefile.am @@ -146,6 +146,8 @@ EXTRA_DIST = \ pth_detached2.stderr.exp \ pth_detached2.stdout.exp \ pth_detached2.vgtest \ + pth_detached3.stderr.exp \ + pth_detached3.vgtest \ pth_detached_sem.stderr.exp \ pth_detached_sem.stdout.exp \ pth_detached_sem.vgtest \ @@ -285,6 +287,7 @@ check_PROGRAMS = \ pth_create_chain \ pth_detached \ pth_detached_sem \ + pth_detached3 \ pth_inconsistent_cond_wait \ pth_mutex_reinit \ pth_process_shared_mutex \ diff --git a/drd/tests/pth_detached3.c b/drd/tests/pth_detached3.c new file mode 100644 index 0000000000..12a7a14de8 --- /dev/null +++ b/drd/tests/pth_detached3.c @@ -0,0 +1,29 @@ +/* Invoke pthread_detach() with an invalid thread ID. */ + +#include +#include +#include +#include + +static void* thread_func(void* arg) +{ + return 0; +} + +int main(int argc, char** argv) +{ + pthread_t thread; + + pthread_create(&thread, NULL, thread_func, NULL); + pthread_join(thread, NULL); + + /* Invoke pthread_detach() with the thread ID of a joined thread. */ + pthread_detach(thread); + + /* Invoke pthread_detach() with an invalid thread ID. */ + pthread_detach(thread + 1); + + fprintf(stderr, "Finished.\n"); + + return 0; +} diff --git a/drd/tests/pth_detached3.stderr.exp b/drd/tests/pth_detached3.stderr.exp new file mode 100644 index 0000000000..58412ec4cc --- /dev/null +++ b/drd/tests/pth_detached3.stderr.exp @@ -0,0 +1,12 @@ + +pthread_detach(): invalid thread ID 0x........ + at 0x........: pthread_detach (drd_pthread_intercepts.c:?) + by 0x........: main (pth_detached3.c:21) + +pthread_detach(): invalid thread ID 0x........ + at 0x........: pthread_detach (drd_pthread_intercepts.c:?) + by 0x........: main (pth_detached3.c:24) + +Finished. + +ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) diff --git a/drd/tests/pth_detached3.vgtest b/drd/tests/pth_detached3.vgtest new file mode 100644 index 0000000000..9c72be7450 --- /dev/null +++ b/drd/tests/pth_detached3.vgtest @@ -0,0 +1,2 @@ +prereq: ./supported_libpthread +prog: pth_detached3