Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4317 → Rev 4153

/branches/network/kernel/test/fpu/fpu1_ia64.c
63,6 → 63,7
static atomic_t threads_ok;
static atomic_t threads_fault;
static waitq_t can_start;
static bool sh_quiet;
 
static void e(void *data)
{
84,7 → 85,8
}
if ((int) (100000000 * e) != E_10e8) {
TPRINTF("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);
if (!sh_quiet)
printf("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);
atomic_inc(&threads_fault);
break;
}
117,7 → 119,8
}
if ((int) (1000000 * pi) != PI_10e8) {
TPRINTF("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (1000000 * pi), (unative_t) (PI_10e8 / 100));
if (!sh_quiet)
printf("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (1000000 * pi), (unative_t) (PI_10e8 / 100));
atomic_inc(&threads_fault);
break;
}
125,21 → 128,24
atomic_inc(&threads_ok);
}
 
char *test_fpu1(void)
char * test_fpu1(bool quiet)
{
unsigned int i, total = 0;
sh_quiet = quiet;
waitq_initialize(&can_start);
atomic_set(&threads_ok, 0);
atomic_set(&threads_fault, 0);
TPRINTF("Creating %u threads... ", 2 * THREADS);
if (!quiet)
printf("Creating %u threads... ", 2 * THREADS);
for (i = 0; i < THREADS; i++) {
for (i = 0; i < THREADS; i++) {
thread_t *t;
if (!(t = thread_create(e, NULL, TASK, 0, "e", false))) {
TPRINTF("could not create thread %u\n", 2 * i);
if (!quiet)
printf("could not create thread %u\n", 2 * i);
break;
}
thread_ready(t);
146,7 → 152,8
total++;
if (!(t = thread_create(pi, NULL, TASK, 0, "pi", false))) {
TPRINTF("could not create thread %u\n", 2 * i + 1);
if (!quiet)
printf("could not create thread %u\n", 2 * i + 1);
break;
}
thread_ready(t);
153,13 → 160,15
total++;
}
TPRINTF("ok\n");
if (!quiet)
printf("ok\n");
thread_sleep(1);
waitq_wakeup(&can_start, WAKEUP_ALL);
while (atomic_get(&threads_ok) != (long) total) {
TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
if (!quiet)
printf("Threads left: %d\n", total - atomic_get(&threads_ok));
thread_sleep(1);
}
/branches/network/kernel/test/fpu/fpu1_x86.c
60,6 → 60,7
static atomic_t threads_ok;
static atomic_t threads_fault;
static waitq_t can_start;
static bool sh_quiet;
 
static void e(void *data)
{
81,7 → 82,8
}
if ((int) (100000000 * e) != E_10e8) {
TPRINTF("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);
if (!sh_quiet)
printf("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);
atomic_inc(&threads_fault);
break;
}
114,7 → 116,8
}
if ((int) (100000000 * pi) != PI_10e8) {
TPRINTF("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8);
if (!sh_quiet)
printf("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8);
atomic_inc(&threads_fault);
break;
}
122,21 → 125,24
atomic_inc(&threads_ok);
}
 
char *test_fpu1(void)
char * test_fpu1(bool quiet)
{
unsigned int i, total = 0;
sh_quiet = quiet;
waitq_initialize(&can_start);
atomic_set(&threads_ok, 0);
atomic_set(&threads_fault, 0);
TPRINTF("Creating %u threads... ", 2 * THREADS);
if (!quiet)
printf("Creating %u threads... ", 2 * THREADS);
for (i = 0; i < THREADS; i++) {
for (i = 0; i < THREADS; i++) {
thread_t *t;
if (!(t = thread_create(e, NULL, TASK, 0, "e", false))) {
TPRINTF("could not create thread %u\n", 2 * i);
if (!quiet)
printf("could not create thread %u\n", 2 * i);
break;
}
thread_ready(t);
143,7 → 149,8
total++;
if (!(t = thread_create(pi, NULL, TASK, 0, "pi", false))) {
TPRINTF("could not create thread %u\n", 2 * i + 1);
if (!quiet)
printf("could not create thread %u\n", 2 * i + 1);
break;
}
thread_ready(t);
150,13 → 157,15
total++;
}
TPRINTF("ok\n");
if (!quiet)
printf("ok\n");
thread_sleep(1);
waitq_wakeup(&can_start, WAKEUP_ALL);
while (atomic_get(&threads_ok) != (long) total) {
TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
if (!quiet)
printf("Threads left: %d\n", total - atomic_get(&threads_ok));
thread_sleep(1);
}
/branches/network/kernel/test/fpu/mips2_skip.c
28,7 → 28,7
 
#include <test.h>
 
char *test_mips2(void)
char * test_mips2(bool quiet)
{
return NULL;
}
/branches/network/kernel/test/fpu/fpu1_skip.c
28,7 → 28,7
 
#include <test.h>
 
char *test_fpu1(void)
char * test_fpu1(bool quiet)
{
return NULL;
}
/branches/network/kernel/test/fpu/sse1_skip.c
28,7 → 28,7
 
#include <test.h>
 
char *test_sse1(void)
char * test_sse1(bool quiet)
{
return NULL;
}
/branches/network/kernel/test/fpu/mips2.c
43,6 → 43,7
static atomic_t threads_ok;
static atomic_t threads_fault;
static waitq_t can_start;
static bool sh_quiet;
 
static void testit1(void *data)
{
68,7 → 69,8
);
if (arg != after_arg) {
TPRINTF("General reg tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
if (!sh_quiet)
printf("General reg tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
atomic_inc(&threads_fault);
break;
}
99,7 → 101,8
);
if (arg != after_arg) {
TPRINTF("General reg tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
if (!sh_quiet)
printf("General reg tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
atomic_inc(&threads_fault);
break;
}
108,21 → 111,24
}
 
 
char *test_mips2(void)
char * test_mips2(bool quiet)
{
unsigned int i, total = 0;
sh_quiet = quiet;
waitq_initialize(&can_start);
atomic_set(&threads_ok, 0);
atomic_set(&threads_fault, 0);
TPRINTF("Creating %u threads... ", 2 * THREADS);
if (!quiet)
printf("Creating %u threads... ", 2 * THREADS);
for (i = 0; i < THREADS; i++) {
thread_t *t;
if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) {
TPRINTF("could not create thread %u\n", 2 * i);
if (!quiet)
printf("could not create thread %u\n", 2 * i);
break;
}
thread_ready(t);
129,7 → 135,8
total++;
if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) {
TPRINTF("could not create thread %u\n", 2 * i + 1);
if (!quiet)
printf("could not create thread %u\n", 2 * i + 1);
break;
}
thread_ready(t);
136,13 → 143,15
total++;
}
TPRINTF("ok\n");
if (!quiet)
printf("ok\n");
thread_sleep(1);
waitq_wakeup(&can_start, WAKEUP_ALL);
while (atomic_get(&threads_ok) != (long) total) {
TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
if (!quiet)
printf("Threads left: %d\n", total - atomic_get(&threads_ok));
thread_sleep(1);
}
/branches/network/kernel/test/fpu/sse1.c
43,23 → 43,25
static atomic_t threads_ok;
static atomic_t threads_fault;
static waitq_t can_start;
static bool sh_quiet;
 
 
static void testit1(void *data)
{
int i;
int arg __attribute__((aligned(16))) = (int) ((unative_t) data);
int after_arg __attribute__((aligned(16)));
 
thread_detach(THREAD);
waitq_sleep(&can_start);
 
for (i = 0; i < ATTEMPTS; i++) {
asm volatile (
"movlpd %[arg], %%xmm2\n"
: [arg] "=m" (arg)
);
 
delay(DELAY);
asm volatile (
"movlpd %%xmm2, %[after_arg]\n"
67,7 → 69,8
);
if (arg != after_arg) {
TPRINTF("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
if (!sh_quiet)
printf("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
atomic_inc(&threads_fault);
break;
}
84,13 → 87,13
thread_detach(THREAD);
waitq_sleep(&can_start);
 
for (i = 0; i < ATTEMPTS; i++) {
asm volatile (
"movlpd %[arg], %%xmm2\n"
: [arg] "=m" (arg)
);
 
scheduler();
asm volatile (
"movlpd %%xmm2, %[after_arg]\n"
98,7 → 101,8
);
if (arg != after_arg) {
TPRINTF("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
if (!sh_quiet)
printf("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
atomic_inc(&threads_fault);
break;
}
106,21 → 110,25
atomic_inc(&threads_ok);
}
 
char *test_sse1(void)
 
char * test_sse1(bool quiet)
{
unsigned int i, total = 0;
sh_quiet = quiet;
waitq_initialize(&can_start);
atomic_set(&threads_ok, 0);
atomic_set(&threads_fault, 0);
TPRINTF("Creating %u threads... ", 2 * THREADS);
if (!quiet)
printf("Creating %u threads... ", 2 * THREADS);
 
for (i = 0; i < THREADS; i++) {
thread_t *t;
if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) {
TPRINTF("could not create thread %u\n", 2 * i);
if (!quiet)
printf("could not create thread %u\n", 2 * i);
break;
}
thread_ready(t);
127,7 → 135,8
total++;
if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) {
TPRINTF("could not create thread %u\n", 2 * i + 1);
if (!quiet)
printf("could not create thread %u\n", 2 * i + 1);
break;
}
thread_ready(t);
134,13 → 143,15
total++;
}
TPRINTF("ok\n");
if (!quiet)
printf("ok\n");
thread_sleep(1);
waitq_wakeup(&can_start, WAKEUP_ALL);
while (atomic_get(&threads_ok) != (long) total) {
TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
if (!quiet)
printf("Threads left: %d\n", total - atomic_get(&threads_ok));
thread_sleep(1);
}