Make messages more useful.

This commit is contained in:
is 2005-12-02 16:44:54 +00:00
parent 4470fd926f
commit 4493beadad

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu.c,v 1.1 2005/12/01 16:03:36 is Exp $ */ /* $NetBSD: fpu.c,v 1.2 2005/12/02 16:44:54 is Exp $ */
/* /*
* This is adapted from part of csw/cstest of the MPD implementation by * This is adapted from part of csw/cstest of the MPD implementation by
@ -50,8 +50,10 @@ main(int argc, char *argv[]) {
int rc; int rc;
printf("Testing threaded floating point computations...");
if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'v') { if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'v') {
verbose = 1; verbose = 1;
printf("\n");
} }
rc = pthread_mutex_init(&recursion_depth_lock, 0); rc = pthread_mutex_init(&recursion_depth_lock, 0);
if (0 != rc) { if (0 != rc) {
@ -72,7 +74,7 @@ stir(void *p) {
double y = *q++; double y = *q++;
double z = *q++; double z = *q++;
for (;;) { for (;;) {
Dprintf("\nstirring..."); Dprintf("stirring...");
x = sin ((y = cos (x + y + .4)) - (z = cos (x + z + .6))); x = sin ((y = cos (x + y + .4)) - (z = cos (x + z + .6)));
YIELD(); YIELD();
} }
@ -89,12 +91,11 @@ void *bar(void *p) {
double d; double d;
int rc; int rc;
puts("====== checking floating point =====");
d = mul3(mul3(2., 3., 5.), mul3(7., 11., 13.), d = mul3(mul3(2., 3., 5.), mul3(7., 11., 13.),
mul3(17., 19., 23.)); mul3(17., 19., 23.));
if (d != 223092870.) { if (d != 223092870.) {
printf("oops - product returned was %.20g\n", d); printf("\noops - product returned was %.20g\nFAILED\n", d);
exit(1); exit(1);
} }
@ -105,12 +106,13 @@ void *bar(void *p) {
dotest(); dotest();
} }
Dprintf("\n"); Dprintf("\n");
printf("OK\n");
exit(0); exit(0);
} }
void dotest() { void dotest() {
pthread_t s2; pthread_t s2;
Dprintf("\nrecursing..."); Dprintf("recursing...");
pthread_create(&s2, 0, bar, 0); pthread_create(&s2, 0, bar, 0);
sleep(20); /* XXX must be long enough for our slowest machine */ sleep(20); /* XXX must be long enough for our slowest machine */
} }