summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco S Hyman <marc@cvs.openbsd.org>2002-10-12 18:59:14 +0000
committerMarco S Hyman <marc@cvs.openbsd.org>2002-10-12 18:59:14 +0000
commitdbf5894c02c9ab39c5159f4ab0d1f8681041bf44 (patch)
tree50252fcbf610c3f32222b52464be021b920cbba5
parent439b5a8e46350413139ea2b054a0b2149f640b7c (diff)
reduce the amount of output on this test so you can see when things
go wrong. Remove dead code.
-rw-r--r--regress/lib/libc_r/switch/switch.c16
-rw-r--r--regress/lib/libpthread/switch/switch.c16
2 files changed, 18 insertions, 14 deletions
diff --git a/regress/lib/libc_r/switch/switch.c b/regress/lib/libc_r/switch/switch.c
index 4c21eafe392..1d150a461af 100644
--- a/regress/lib/libc_r/switch/switch.c
+++ b/regress/lib/libc_r/switch/switch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: switch.c,v 1.2 2002/06/16 23:06:53 marc Exp $ */
+/* $OpenBSD: switch.c,v 1.3 2002/10/12 18:59:13 marc Exp $ */
/*
* Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
* proven@mit.edu All rights reserved.
@@ -46,6 +46,7 @@
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
+
#include "test.h"
const char buf[] = "abcdefghijklmnopqrstuvwxyz";
@@ -59,7 +60,8 @@ volatile int ending = 0;
*/
void usage(void)
{
- printf("test_switch [-d?] [-c count]\n");
+ extern char *__progname;
+ printf("usage: %s [-?] [-c count]\n", __progname);
printf("count must be between 2 and 26\n");
errno = 0;
}
@@ -68,10 +70,14 @@ void *
new_thread(arg)
void *arg;
{
+ int i;
+
SET_NAME("writer");
while (!ending) {
CHECKe(write (fd, (char *) arg, 1));
x[(char *)arg - buf] = 1;
+ for (i = 0; i < 999999; i += 1)
+ ;
}
return NULL;
}
@@ -83,7 +89,6 @@ main(argc, argv)
{
pthread_t thread;
int count = 4;
- int debug = 0;
int eof = 0;
long i;
@@ -97,9 +102,6 @@ main(argc, argv)
case EOF:
eof = 1;
break;
- case 'd':
- debug++;
- break;
case 'c':
count = atoi(optarg);
if ((count > 26) || (count < 2)) {
@@ -120,7 +122,7 @@ main(argc, argv)
(void*)(buf+i)));
/* give all threads a chance to run */
- sleep (4);
+ sleep (2);
ending = 1;
for (i = 0; i < count; i++)
diff --git a/regress/lib/libpthread/switch/switch.c b/regress/lib/libpthread/switch/switch.c
index 4c21eafe392..1d150a461af 100644
--- a/regress/lib/libpthread/switch/switch.c
+++ b/regress/lib/libpthread/switch/switch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: switch.c,v 1.2 2002/06/16 23:06:53 marc Exp $ */
+/* $OpenBSD: switch.c,v 1.3 2002/10/12 18:59:13 marc Exp $ */
/*
* Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
* proven@mit.edu All rights reserved.
@@ -46,6 +46,7 @@
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
+
#include "test.h"
const char buf[] = "abcdefghijklmnopqrstuvwxyz";
@@ -59,7 +60,8 @@ volatile int ending = 0;
*/
void usage(void)
{
- printf("test_switch [-d?] [-c count]\n");
+ extern char *__progname;
+ printf("usage: %s [-?] [-c count]\n", __progname);
printf("count must be between 2 and 26\n");
errno = 0;
}
@@ -68,10 +70,14 @@ void *
new_thread(arg)
void *arg;
{
+ int i;
+
SET_NAME("writer");
while (!ending) {
CHECKe(write (fd, (char *) arg, 1));
x[(char *)arg - buf] = 1;
+ for (i = 0; i < 999999; i += 1)
+ ;
}
return NULL;
}
@@ -83,7 +89,6 @@ main(argc, argv)
{
pthread_t thread;
int count = 4;
- int debug = 0;
int eof = 0;
long i;
@@ -97,9 +102,6 @@ main(argc, argv)
case EOF:
eof = 1;
break;
- case 'd':
- debug++;
- break;
case 'c':
count = atoi(optarg);
if ((count > 26) || (count < 2)) {
@@ -120,7 +122,7 @@ main(argc, argv)
(void*)(buf+i)));
/* give all threads a chance to run */
- sleep (4);
+ sleep (2);
ending = 1;
for (i = 0; i < count; i++)