summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog8
-rw-r--r--tests/GNUmakefile5
-rw-r--r--tests/condvar1_2.c42
-rw-r--r--tests/spin4.c45
4 files changed, 55 insertions, 45 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 944961d..afd2cbb 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,11 @@
+2002-02-23 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * condvar1_2.c: Loop over the test many times in the hope
+ of detecting any intermittent deadlocks. This is to
+ test a fixed problem in pthread_cond_destroy.c.
+
+ * spin4.c: Remove unused variable.
+
2002-02-17 Ross Johnson <rpj@special.ise.canberra.edu.au>
* condvar1_1.c: New test.
diff --git a/tests/GNUmakefile b/tests/GNUmakefile
index 74bd6b3..9e6cf89 100644
--- a/tests/GNUmakefile
+++ b/tests/GNUmakefile
@@ -49,9 +49,8 @@ MAKE = make
GLANG = c++
CC = gcc
XXCFLAGS =
-#CFLAGS = -g -O0 -mthreads -UNDEBUG -Wall -x $(GLANG)
-#CFLAGS = -O3 -mthreads -UNDEBUG -Wall -x $(GLANG)
-CFLAGS = -g -O0 -UNDEBUG -Wall $(XXCFLAGS)
+CFLAGS = -O3 -UNDEBUG -Wall $(XXCFLAGS)
+#CFLAGS = -g -O0 -UNDEBUG -Wall $(XXCFLAGS)
BUILD_DIR = ..
INCLUDES = -I.
diff --git a/tests/condvar1_2.c b/tests/condvar1_2.c
index 66237ba..4cb7d9d 100644
--- a/tests/condvar1_2.c
+++ b/tests/condvar1_2.c
@@ -81,7 +81,8 @@
#include "test.h"
enum {
- NUM_CV = 100
+ NUM_CV = 100,
+ NUM_LOOPS = 100
};
static pthread_cond_t cv[NUM_CV];
@@ -89,34 +90,37 @@ static pthread_cond_t cv[NUM_CV];
int
main()
{
- int i, j;
+ int i, j, k;
int result = -1;
pthread_t t;
- for (i = 0; i < NUM_CV; i++)
+ for (k = 0; k < NUM_LOOPS; k++)
{
- assert(pthread_cond_init(&cv[i], NULL) == 0);
- }
+ for (i = 0; i < NUM_CV; i++)
+ {
+ assert(pthread_cond_init(&cv[i], NULL) == 0);
+ }
- j = NUM_CV;
- (void) srand((unsigned)time(NULL));
+ j = NUM_CV;
+ (void) srand((unsigned)time(NULL));
- /* Traverse the list asynchronously. */
- assert(pthread_create(&t, NULL, pthread_timechange_handler_np, NULL) == 0);
+ /* Traverse the list asynchronously. */
+ assert(pthread_create(&t, NULL, pthread_timechange_handler_np, NULL) == 0);
- do
- {
- i = (NUM_CV - 1) * rand() / RAND_MAX;
- if (cv[i] != NULL)
+ do
{
- j--;
- assert(pthread_cond_destroy(&cv[i]) == 0);
+ i = (NUM_CV - 1) * rand() / RAND_MAX;
+ if (cv[i] != NULL)
+ {
+ j--;
+ assert(pthread_cond_destroy(&cv[i]) == 0);
+ }
}
- }
- while (j > 0);
+ while (j > 0);
- assert(pthread_join(t, (void **) &result) == 0);
- assert (result == 0);
+ assert(pthread_join(t, (void **) &result) == 0);
+ assert (result == 0);
+ }
return 0;
}
diff --git a/tests/spin4.c b/tests/spin4.c
index 3cd6d64..aabbb28 100644
--- a/tests/spin4.c
+++ b/tests/spin4.c
@@ -6,32 +6,32 @@
*
* --------------------------------------------------------------------------
*
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2002 Pthreads-win32 contributors
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2002 Pthreads-win32 contributors
*
- * Contact Email: rpj@ise.canberra.edu.au
+ * Contact Email: rpj@ise.canberra.edu.au
*
- * The current list of contributors is contained
- * in the file CONTRIBUTORS included with the source
- * code distribution. The list can also be seen at the
- * following World Wide Web location:
- * http://sources.redhat.com/pthreads-win32/contributors.html
+ * The current list of contributors is contained
+ * in the file CONTRIBUTORS included with the source
+ * code distribution. The list can also be seen at the
+ * following World Wide Web location:
+ * http://sources.redhat.com/pthreads-win32/contributors.html
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
*
- * This library 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
- * Lesser General Public License for more details.
+ * This library 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
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library in the file COPYING.LIB;
- * if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* --------------------------------------------------------------------------
*
@@ -47,7 +47,7 @@ struct _timeb currSysTimeStart;
struct _timeb currSysTimeStop;
#define GetDurationMilliSecs(_TStart, _TStop) ((_TStop.time*1000+_TStop.millitm) \
- - (_TStart.time*1000+_TStart.millitm))
+ - (_TStart.time*1000+_TStart.millitm))
static int washere = 0;
@@ -66,7 +66,6 @@ int
main()
{
long result = 0;
- int i;
pthread_t t;
int CPUs;
struct _timeb sysTime;