summaryrefslogtreecommitdiff
path: root/lib/libc_r/TEST
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>2000-01-04 02:31:45 +0000
committerDavid Leonard <d@cvs.openbsd.org>2000-01-04 02:31:45 +0000
commit88f8f0b8e121df42cab8e6454ce9ebf023ede90e (patch)
treedc2cad07a58b3a1bff58975fc96bb63381e13eb8 /lib/libc_r/TEST
parentc635f510d7c1cd47f412912805cd641f45995331 (diff)
fix bugs in test. now succeeds
Diffstat (limited to 'lib/libc_r/TEST')
-rw-r--r--lib/libc_r/TEST/test_stdarg.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/libc_r/TEST/test_stdarg.c b/lib/libc_r/TEST/test_stdarg.c
index 0621d8daa83..f2b4781cff2 100644
--- a/lib/libc_r/TEST/test_stdarg.c
+++ b/lib/libc_r/TEST/test_stdarg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_stdarg.c,v 1.1 2000/01/04 00:18:15 d Exp $ */
+/* $OpenBSD: test_stdarg.c,v 1.2 2000/01/04 02:31:44 d Exp $ */
/*
* Test <stdarg.h>
*/
@@ -22,7 +22,7 @@ test1(char *fmt, ...)
va_start(ap, fmt);
for (; *fmt; fmt++)
- switch (*fmt++) {
+ switch (*fmt) {
case 'i':
i = va_arg(ap, int);
ASSERT(i == 1234);
@@ -51,19 +51,25 @@ run_test(arg)
void *arg;
{
char *msg = (char *)arg;
+ int i;
printf("Testing stdarg: %s\n", msg);
- ASSERT(test1("iclp", 1234, 'x', 123456789L, &thing) == 9);
+ for (i = 0; i < 1000000; i++) {
+ ASSERT(test1("iclp", 1234, 'x', 123456789L, &thing) == 9);
+ }
+ printf("ok\n");
return NULL;
}
int
main()
{
- pthread_t thread;
+ pthread_t t1, t2;
run_test("in main thread");
- CHECKr(pthread_create(&thread, NULL, run_test, "in child thread"));
- CHECKr(pthread_join(thread, NULL));
+ CHECKr(pthread_create(&t1, NULL, run_test, "in child thread 1"));
+ CHECKr(pthread_create(&t2, NULL, run_test, "in child thread 2"));
+ CHECKr(pthread_join(t1, NULL));
+ CHECKr(pthread_join(t2, NULL));
SUCCEED;
}