Author: bart Date: 2008-03-09 16:16:06 +0000 (Sun, 09 Mar 2008) New Revision: 7616
Log: Added test for LinuxThreads detection. Added: trunk/exp-drd/tests/linuxthreads_det.c trunk/exp-drd/tests/linuxthreads_det.stderr.exp trunk/exp-drd/tests/linuxthreads_det.stdout.exp trunk/exp-drd/tests/linuxthreads_det.vgtest Modified: trunk/exp-drd/tests/Makefile.am Modified: trunk/exp-drd/tests/Makefile.am =================================================================== --- trunk/exp-drd/tests/Makefile.am 2008-03-09 15:59:30 UTC (rev 7615) +++ trunk/exp-drd/tests/Makefile.am 2008-03-09 16:16:06 UTC (rev 7616) @@ -42,11 +42,14 @@ hg06_readshared.stderr.exp \ hg06_readshared.stderr.exp-linuxthreads \ hg06_readshared.vgtest \ + linuxthreads_det.stderr.exp \ + linuxthreads_det.stderr.exp-linuxthreads \ + linuxthreads_det.stdout.exp \ + linuxthreads_det.stdout.exp-linuxthreads \ matinv.stderr.exp \ matinv.stderr.exp-linuxthreads \ matinv.stdout.exp \ matinv.stdout.exp-linuxthreads \ - matinv.stdout.exp-linuxthreads \ matinv.vgtest \ pth_barrier.stderr.exp \ pth_barrier.stderr.exp-linuxthreads \ @@ -194,6 +197,7 @@ hg04_race \ hg05_race2 \ hg06_readshared \ + linuxthreads_det \ matinv \ pth_barrier \ pth_broadcast \ @@ -261,13 +265,16 @@ hg06_readshared_SOURCES = ../../helgrind/tests/hg06_readshared.c hg06_readshared_LDADD = -lpthread +linuxthreads_det_SOURCES = linuxthreads_det.c +linuxthreads_det_LDADD = -lpthread + matinv_SOURCES = matinv.c matinv_LDADD = -lpthread -lm if HAVE_GCC_FOPENMP matinv_openmp_SOURCES = matinv_openmp.c matinv_openmp_CFLAGS = -fopenmp -matinv_openmp_LDADD = -lpthread -lm +matinv_openmp_LDADD = -lm endif pth_barrier_SOURCES = pth_barrier.c Added: trunk/exp-drd/tests/linuxthreads_det.c =================================================================== --- trunk/exp-drd/tests/linuxthreads_det.c (rev 0) +++ trunk/exp-drd/tests/linuxthreads_det.c 2008-03-09 16:16:06 UTC (rev 7616) @@ -0,0 +1,41 @@ +/** Test whether DRD recognizes LinuxThreads as LinuxThreads and NPTL as + * NPTL. + */ + + +#include <pthread.h> +#include <semaphore.h> +#include <stdio.h> +#include <unistd.h> + + +static sem_t s_sem; +static pid_t s_main_thread_pid; + + +void* thread_func(void* arg) +{ + if (s_main_thread_pid == getpid()) + { + printf("NPTL or non-Linux POSIX threads implemenentation detected.\n"); + } + else + { + printf("Detected LinuxThreads as POSIX threads implemenentation.\n"); + } + sem_post(&s_sem); + return 0; +} + +int main(int argc, char** argv) +{ + pthread_t threadid; + + s_main_thread_pid = getpid(); + sem_init(&s_sem, 0, 0); + pthread_create(&threadid, 0, thread_func, 0); + sem_wait(&s_sem); + pthread_join(threadid, 0); + sem_destroy(&s_sem); + return 0; +} Added: trunk/exp-drd/tests/linuxthreads_det.stderr.exp =================================================================== --- trunk/exp-drd/tests/linuxthreads_det.stderr.exp (rev 0) +++ trunk/exp-drd/tests/linuxthreads_det.stderr.exp 2008-03-09 16:16:06 UTC (rev 7616) @@ -0,0 +1,3 @@ + + +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Added: trunk/exp-drd/tests/linuxthreads_det.stdout.exp =================================================================== --- trunk/exp-drd/tests/linuxthreads_det.stdout.exp (rev 0) +++ trunk/exp-drd/tests/linuxthreads_det.stdout.exp 2008-03-09 16:16:06 UTC (rev 7616) @@ -0,0 +1 @@ +NPTL or non-Linux POSIX threads implemenentation detected. Added: trunk/exp-drd/tests/linuxthreads_det.vgtest =================================================================== --- trunk/exp-drd/tests/linuxthreads_det.vgtest (rev 0) +++ trunk/exp-drd/tests/linuxthreads_det.vgtest 2008-03-09 16:16:06 UTC (rev 7616) @@ -0,0 +1 @@ +prog: linuxthreads_det ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Valgrind-developers mailing list Valgrind-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-developers