/trunk/kernel/test/synch/rwlock4.c |
---|
34,7 → 34,6 |
#include <arch/types.h> |
#include <arch/context.h> |
#include <context.h> |
#include <panic.h> |
#include <synch/waitq.h> |
#include <synch/rwlock.h> |
45,6 → 44,7 |
#define WRITERS 50 |
static rwlock_t rwlock; |
static atomic_t threads_fault; |
SPINLOCK_INITIALIZE(rw_lock); |
78,9 → 78,17 |
} |
printf("cpu%d, tid %d w=\n", CPU->id, THREAD->tid); |
if (rwlock.readers_in) panic("Oops."); |
if (rwlock.readers_in) { |
printf("Oops."); |
atomic_inc(&threads_fault); |
return; |
} |
thread_usleep(random(1000000)); |
if (rwlock.readers_in) panic("Oops."); |
if (rwlock.readers_in) { |
printf("Oops."); |
atomic_inc(&threads_fault); |
return; |
} |
rwlock_write_unlock(&rwlock); |
printf("cpu%d, tid %d w-\n", CPU->id, THREAD->tid); |
112,6 → 120,7 |
waitq_initialize(&can_start); |
rwlock_initialize(&rwlock); |
atomic_set(&threads_fault, 0); |
thread_t *thrd; |
130,7 → 139,7 |
k = random(5) + 1; |
printf("Creating %d writers\n", k); |
for (i=0; i<k; i++) { |
for (i = 0; i < k; i++) { |
thrd = thread_create(writer, NULL, TASK, 0, "writer"); |
if (thrd) |
thread_ready(thrd); |
141,5 → 150,8 |
thread_usleep(20000); |
waitq_wakeup(&can_start, WAKEUP_ALL); |
return NULL; |
if (atomic_get(&threads_fault) == 0) |
return NULL; |
return "Test failed"; |
} |
/trunk/kernel/test/debug/mips1.c |
---|
30,7 → 30,6 |
#include <print.h> |
#include <debug.h> |
#include <panic.h> |
#include <test.h> |
#include <atomic.h> |
/trunk/kernel/test/thread/thread1.c |
---|
29,7 → 29,6 |
#include <print.h> |
#include <debug.h> |
#include <panic.h> |
#include <test.h> |
#include <atomic.h> |
/trunk/kernel/test/mm/falloc1.c |
---|
46,8 → 46,10 |
int i, order, run; |
int allocated; |
ASSERT(TEST_RUNS > 1); |
if (TEST_RUNS < 2) |
return "Test is compiled with TEST_RUNS < 2"; |
if (frames == NULL) |
return "Unable to allocate frames"; |
/trunk/kernel/test/mm/slab1.c |
---|
31,7 → 31,6 |
#include <print.h> |
#include <proc/thread.h> |
#include <arch.h> |
#include <panic.h> |
#include <memstr.h> |
#define VAL_COUNT 1024 |
/trunk/kernel/test/mm/slab2.c |
---|
31,7 → 31,6 |
#include <print.h> |
#include <proc/thread.h> |
#include <arch.h> |
#include <panic.h> |
#include <mm/frame.h> |
#include <memstr.h> |
#include <synch/condvar.h> |
88,7 → 87,8 |
for (i=0; i<30; i++) { |
data1 = slab_alloc(cache1, FRAME_ATOMIC); |
if (!data1) { |
panic("Incorrect memory size - use another test."); |
printf("Incorrect memory size - use another test."); |
return; |
} |
memsetb((uintptr_t)data1, ITEM_SIZE, 0); |
*((void **)data1) = olddata1; |
/trunk/kernel/test/mm/mapping1.c |
---|
62,8 → 62,10 |
printf("Value at virtual address %p is %#x.\n", PAGE0, v0 = *((uint32_t *) PAGE0)); |
printf("Value at virtual address %p is %#x.\n", PAGE1, v1 = *((uint32_t *) PAGE1)); |
ASSERT(v0 == VALUE0); |
ASSERT(v1 == VALUE1); |
if (v0 != VALUE0) |
return "Value at v0 not equal to VALUE0"; |
if (v1 != VALUE1) |
return "Value at v1 not equal to VALUE1"; |
printf("Writing %#x to virtual address %p.\n", 0, PAGE0); |
*((uint32_t *) PAGE0) = 0; |
76,8 → 78,10 |
printf("Value at virtual address %p is %#x.\n", PAGE0, *((uint32_t *) PAGE0)); |
printf("Value at virtual address %p is %#x.\n", PAGE1, *((uint32_t *) PAGE1)); |
ASSERT(v0 == 0); |
ASSERT(v1 == 0); |
if (v0 != 0) |
return "Value at v0 not equal to 0"; |
if (v1 != 0) |
return "Value at v1 not equal to 0"; |
return NULL; |
} |
/trunk/kernel/test/fpu/mips2.c |
---|
30,7 → 30,6 |
#include <print.h> |
#include <debug.h> |
#include <panic.h> |
#include <test.h> |
#include <atomic.h> |
102,7 → 101,7 |
); |
if (arg != after_arg) { |
panic("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
atomic_inc(&threads_fault); |
break; |
} |
/trunk/kernel/test/fpu/fpu1.c |
---|
31,7 → 31,6 |
#include <print.h> |
#include <debug.h> |
#include <panic.h> |
#include <test.h> |
#include <atomic.h> |
/trunk/kernel/test/fpu/sse1.c |
---|
30,7 → 30,6 |
#include <print.h> |
#include <debug.h> |
#include <panic.h> |
#include <test.h> |
#include <atomic.h> |
/trunk/kernel/test/sysinfo/sysinfo1.c |
---|
28,7 → 28,6 |
#include <print.h> |
#include <debug.h> |
#include <panic.h> |
#include <test.h> |
#include <sysinfo/sysinfo.h> |
/trunk/kernel/test/fault/fault1.c |
---|
29,7 → 29,6 |
#include <print.h> |
#include <debug.h> |
#include <panic.h> |
#include <test.h> |
#include <atomic.h> |