From: Bart Van Assche Date: Mon, 16 Feb 2009 19:42:17 +0000 (+0000) Subject: Just as for the regression tests of other Valgrind tools, do not explicitly state... X-Git-Tag: svn/VALGRIND_3_5_0~970 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=21242b42b275fee9c8aef23b270a1bf984f38157;p=thirdparty%2Fvalgrind.git Just as for the regression tests of other Valgrind tools, do not explicitly state that these are licensed under the GPLv2 license but leave this implicit. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9181 --- diff --git a/drd/tests/fp_race.c b/drd/tests/fp_race.c index 69fa6648ff..bb9853e13c 100644 --- a/drd/tests/fp_race.c +++ b/drd/tests/fp_race.c @@ -1,56 +1,33 @@ -/* - This file is part of drd, a data race detector. +/* Test data race detection between floating point variables. */ - Copyright (C) 2006-2008 Bart Van Assche - bart.vanassche@gmail.com - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. - - The GNU General Public License is contained in the file COPYING. -*/ - -// Test data race detection between floating point variables. #include -#include // printf() +#include /* printf() */ #include -#include // usleep() - +#include /* usleep() */ -// Local functions declarations. +/* Local functions declarations. */ static void* thread_func(void*); -// Local variables. -// s_mutex protects s_d3. +/* Local variables. */ + +/* s_mutex protects s_d3. */ static pthread_mutex_t s_mutex; -static double s_d1; // accessed before thread creation and in the created - // thread (not a race). -static double s_d2; // accessed in the created thread and after the join - // (not a race). -static double s_d3; // accessed simultaneously from both threads (race). +static double s_d1; /* accessed before thread creation and in the created */ + /* thread (not a race). */ +static double s_d2; /* accessed in the created thread and after the join */ + /* (not a race). */ +static double s_d3; /* accessed simultaneously from both threads (race). */ static int s_debug = 0; static int s_do_printf = 0; static int s_use_mutex = 0; -// Function definitions. +/* Function definitions. */ int main(int argc, char** argv) { @@ -77,8 +54,10 @@ int main(int argc, char** argv) pthread_mutex_init(&s_mutex, 0); - // Switch to line-buffered mode, such that timing information can be - // obtained for each printf() call with strace. + /* + * Switch to line-buffered mode, such that timing information can be + * obtained for each printf() call with strace. + */ setlinebuf(stdout); if (s_debug) @@ -90,7 +69,6 @@ int main(int argc, char** argv) s_d3 = 3; pthread_create(&threadid, 0, thread_func, 0); - // Wait until the printf() in the created thread finished. { if (s_use_mutex) pthread_mutex_lock(&s_mutex); @@ -98,12 +76,8 @@ int main(int argc, char** argv) if (s_use_mutex) pthread_mutex_unlock(&s_mutex); } - // Wait until the thread finished. - //printf("Before call to pthread_join()\n"); - //fflush(stdout); + /* Wait until the thread finished. */ pthread_join(threadid, 0); - //printf("After call to pthread_join()\n"); - //fflush(stdout); if (s_do_printf) printf("s_d2 = %g (should be 2)\n", s_d2); if (s_do_printf) printf("s_d3 = %g (should be 5)\n", s_d3); diff --git a/drd/tests/fp_race.stderr.exp b/drd/tests/fp_race.stderr.exp index 8c509c70a7..d71aa061d8 100644 --- a/drd/tests/fp_race.stderr.exp +++ b/drd/tests/fp_race.stderr.exp @@ -2,7 +2,7 @@ Conflicting load by thread 1/1 at 0x........ size 8 at 0x........: main (fp_race.c:?) Location 0x........ is 0 bytes inside local var "s_d3" -declared at fp_race.c:47, in frame #? of thread 1 +declared at fp_race.c:24, in frame #? of thread 1 Other segment start (thread 0/2) (thread finished, call stack no longer available) Other segment end (thread 0/2) @@ -11,7 +11,7 @@ Other segment end (thread 0/2) Conflicting store by thread 1/1 at 0x........ size 8 at 0x........: main (fp_race.c:?) Location 0x........ is 0 bytes inside local var "s_d3" -declared at fp_race.c:47, in frame #? of thread 1 +declared at fp_race.c:24, in frame #? of thread 1 Other segment start (thread 0/2) (thread finished, call stack no longer available) Other segment end (thread 0/2) diff --git a/drd/tests/pth_detached.c b/drd/tests/pth_detached.c index 506693c181..a645b97c2a 100644 --- a/drd/tests/pth_detached.c +++ b/drd/tests/pth_detached.c @@ -1,6 +1,4 @@ -/** Test whether detached threads are handled properly. - * Copyright (c) 2006-2008 by Bart Van Assche (bart.vanassche@gmail.com). - */ +/* Test whether detached threads are handled properly. */ #include diff --git a/drd/tests/pth_detached_sem.c b/drd/tests/pth_detached_sem.c index 27602ab6e3..4d0223c345 100644 --- a/drd/tests/pth_detached_sem.c +++ b/drd/tests/pth_detached_sem.c @@ -1,9 +1,9 @@ -/** Test whether detached threads are handled properly. - * This test program is based on pth_detached.c, with the difference that - * in this test program the main thread uses a counting semaphore instead - * of a counter protected by a mutex to wait until all detached threads - * finished. - * Copyright (c) 2006-2008 by Bart Van Assche (bart.vanassche@gmail.com). +/** + * Test whether detached threads are handled properly. + * This test program is based on pth_detached.c, with the difference that + * in this test program the main thread uses a counting semaphore instead + * of a counter protected by a mutex to wait until all detached threads + * finished. */ diff --git a/drd/tests/sem_as_mutex.c b/drd/tests/sem_as_mutex.c index 1e23e1cc28..4b4ee9a0b6 100644 --- a/drd/tests/sem_as_mutex.c +++ b/drd/tests/sem_as_mutex.c @@ -1,57 +1,34 @@ -/* - This file is part of drd, a data race detector. +/* Use a semaphore to implement mutual exclusion. */ - Copyright (C) 2006-2008 Bart Van Assche - bart.vanassche@gmail.com - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. - - The GNU General Public License is contained in the file COPYING. -*/ - -// Use a semaphore to implement mutual exclusion. #include -#include // printf() +#include /* printf() */ #include #include -#include // usleep() - +#include /* usleep() */ -// Local functions declarations. +/* Local functions declarations. */ static void* thread_func(void*); -// Local variables. -// s_sem protects s_d3. +/* Local variables. */ + +/* s_sem protects s_d3. */ static sem_t s_sem; -static double s_d1; // accessed before thread creation and in the created - // thread (not a race). -static double s_d2; // accessed in the created thread and after the join - // (not a race). -static double s_d3; // accessed simultaneously from both threads (race). +static double s_d1; /* accessed before thread creation and in the created */ + /* thread (not a race). */ +static double s_d2; /* accessed in the created thread and after the join */ + /* (not a race). */ +static double s_d3; /* accessed simultaneously from both threads (race). */ static int s_debug = 0; static int s_do_printf = 0; static int s_do_mutual_exclusion = 0; -// Function definitions. +/* Function definitions. */ int main(int argc, char** argv) { @@ -78,8 +55,10 @@ int main(int argc, char** argv) sem_init(&s_sem, 0, 1); - // Switch to line-buffered mode, such that timing information can be - // obtained for each printf() call with strace. + /* + * Switch to line-buffered mode, such that timing information can be + * obtained for each printf() call with strace. + */ setlinebuf(stdout); if (s_debug) @@ -91,7 +70,6 @@ int main(int argc, char** argv) s_d3 = 3; pthread_create(&threadid, 0, thread_func, 0); - // Wait until the printf() in the created thread finished. { if (s_do_mutual_exclusion) sem_wait(&s_sem); @@ -99,12 +77,8 @@ int main(int argc, char** argv) if (s_do_mutual_exclusion) sem_post(&s_sem); } - // Wait until the thread finished. - //printf("Before call to pthread_join()\n"); - //fflush(stdout); + /* Wait until the thread finished. */ pthread_join(threadid, 0); - //printf("After call to pthread_join()\n"); - //fflush(stdout); if (s_do_printf) printf("s_d2 = %g (should be 2)\n", s_d2); if (s_do_printf) printf("s_d3 = %g (should be 5)\n", s_d3); diff --git a/drd/tests/sem_as_mutex.stderr.exp b/drd/tests/sem_as_mutex.stderr.exp index b02899a281..55f92d0929 100644 --- a/drd/tests/sem_as_mutex.stderr.exp +++ b/drd/tests/sem_as_mutex.stderr.exp @@ -2,7 +2,7 @@ Conflicting load by thread 1/1 at 0x........ size 8 at 0x........: main (sem_as_mutex.c:?) Location 0x........ is 0 bytes inside local var "s_d3" -declared at sem_as_mutex.c:48, in frame #? of thread 1 +declared at sem_as_mutex.c:25, in frame #? of thread 1 Other segment start (thread 0/2) (thread finished, call stack no longer available) Other segment end (thread 0/2) @@ -11,7 +11,7 @@ Other segment end (thread 0/2) Conflicting store by thread 1/1 at 0x........ size 8 at 0x........: main (sem_as_mutex.c:?) Location 0x........ is 0 bytes inside local var "s_d3" -declared at sem_as_mutex.c:48, in frame #? of thread 1 +declared at sem_as_mutex.c:25, in frame #? of thread 1 Other segment start (thread 0/2) (thread finished, call stack no longer available) Other segment end (thread 0/2)