Subversion Repositories HelenOS

Compare Revisions

Regard whitespace Rev 2052 → Rev 2053

/trunk/kernel/test/synch/rwlock1.c
59,7 → 59,6
rwlock_read_unlock(&rwlock);
rwlock_read_unlock(&rwlock);
rwlock_write_lock(&rwlock);
rwlock_write_unlock(&rwlock);
 
/trunk/kernel/test/synch/rwlock2.c
38,26 → 38,27
#define WRITERS 50
 
static rwlock_t rwlock;
static bool sh_quiet;
 
static void writer(void *arg)
{
 
thread_detach(THREAD);
 
if (!sh_quiet)
printf("Trying to lock rwlock for writing....\n");
 
rwlock_write_lock(&rwlock);
rwlock_write_unlock(&rwlock);
if (!sh_quiet)
printf("Trying to lock rwlock for reading....\n");
rwlock_read_lock(&rwlock);
rwlock_read_unlock(&rwlock);
printf("Test passed.\n");
}
 
char * test_rwlock2(bool quiet)
{
thread_t *thrd;
sh_quiet = quiet;
rwlock_initialize(&rwlock);
 
79,5 → 80,8
rwlock_read_unlock(&rwlock);
rwlock_read_unlock(&rwlock);
thread_join(thrd);
thread_detach(thrd);
return NULL;
}
/trunk/kernel/test/synch/rwlock3.c
34,25 → 34,34
 
#include <synch/rwlock.h>
 
#define READERS 50
#define WRITERS 50
#define THREADS 4
 
static atomic_t thread_count;
static rwlock_t rwlock;
static bool sh_quiet;
 
static void reader(void *arg)
{
thread_detach(THREAD);
 
if (!sh_quiet)
printf("cpu%d, tid %d: trying to lock rwlock for reading....\n", CPU->id, THREAD->tid);
rwlock_read_lock(&rwlock);
rwlock_read_unlock(&rwlock);
if (!sh_quiet) {
printf("cpu%d, tid %d: success\n", CPU->id, THREAD->tid);
 
printf("cpu%d, tid %d: trying to lock rwlock for writing....\n", CPU->id, THREAD->tid);
}
 
rwlock_write_lock(&rwlock);
rwlock_write_unlock(&rwlock);
if (!sh_quiet)
printf("cpu%d, tid %d: success\n", CPU->id, THREAD->tid);
atomic_dec(&thread_count);
}
 
char * test_rwlock3(bool quiet)
59,21 → 68,29
{
int i;
thread_t *thrd;
sh_quiet = quiet;
atomic_set(&thread_count, THREADS);
rwlock_initialize(&rwlock);
rwlock_write_lock(&rwlock);
for (i = 0; i < 4; i++) {
for (i = 0; i < THREADS; i++) {
thrd = thread_create(reader, NULL, TASK, 0, "reader", false);
if (thrd)
thread_ready(thrd);
else
else if (!quiet)
printf("Could not create reader %d\n", i);
}
 
thread_sleep(1);
rwlock_write_unlock(&rwlock);
while (atomic_get(&thread_count) > 0) {
if (!quiet)
printf("Threads left: %d\n", atomic_get(&thread_count));
thread_sleep(1);
}
return NULL;
}
/trunk/kernel/test/synch/rwlock4.c
43,8 → 43,10
#define READERS 50
#define WRITERS 50
 
static atomic_t thread_count;
static rwlock_t rwlock;
static atomic_t threads_fault;
static bool sh_quiet;
 
SPINLOCK_INITIALIZE(rw_lock);
 
70,28 → 72,42
waitq_sleep(&can_start);
 
to = random(40000);
if (!sh_quiet)
printf("cpu%d, tid %d w+ (%d)\n", CPU->id, THREAD->tid, to);
rc = rwlock_write_lock_timeout(&rwlock, to);
if (SYNCH_FAILED(rc)) {
if (!sh_quiet)
printf("cpu%d, tid %d w!\n", CPU->id, THREAD->tid);
atomic_dec(&thread_count);
return;
}
if (!sh_quiet)
printf("cpu%d, tid %d w=\n", CPU->id, THREAD->tid);
 
if (rwlock.readers_in) {
if (!sh_quiet)
printf("Oops.");
atomic_inc(&threads_fault);
atomic_dec(&thread_count);
return;
}
thread_usleep(random(1000000));
if (rwlock.readers_in) {
if (!sh_quiet)
printf("Oops.");
atomic_inc(&threads_fault);
atomic_dec(&thread_count);
return;
}
 
rwlock_write_unlock(&rwlock);
if (!sh_quiet)
printf("cpu%d, tid %d w-\n", CPU->id, THREAD->tid);
atomic_dec(&thread_count);
}
 
static void reader(void *arg)
101,49 → 117,68
waitq_sleep(&can_start);
to = random(2000);
if (!sh_quiet)
printf("cpu%d, tid %d r+ (%d)\n", CPU->id, THREAD->tid, to);
rc = rwlock_read_lock_timeout(&rwlock, to);
if (SYNCH_FAILED(rc)) {
if (!sh_quiet)
printf("cpu%d, tid %d r!\n", CPU->id, THREAD->tid);
atomic_dec(&thread_count);
return;
}
if (!sh_quiet)
printf("cpu%d, tid %d r=\n", CPU->id, THREAD->tid);
thread_usleep(30000);
rwlock_read_unlock(&rwlock);
if (!sh_quiet)
printf("cpu%d, tid %d r-\n", CPU->id, THREAD->tid);
atomic_dec(&thread_count);
}
 
char * test_rwlock4(bool quiet)
{
context_t ctx;
uint32_t i, k;
uint32_t i;
sh_quiet = quiet;
waitq_initialize(&can_start);
rwlock_initialize(&rwlock);
atomic_set(&threads_fault, 0);
uint32_t rd = random(7) + 1;
uint32_t wr = random(5) + 1;
atomic_set(&thread_count, rd + wr);
thread_t *thrd;
context_save(&ctx);
if (!quiet) {
printf("sp=%#x, readers_in=%d\n", ctx.sp, rwlock.readers_in);
printf("Creating %d readers\n", rd);
}
k = random(7) + 1;
printf("Creating %d readers\n", k);
for (i = 0; i < k; i++) {
for (i = 0; i < rd; i++) {
thrd = thread_create(reader, NULL, TASK, 0, "reader", false);
if (thrd)
thread_ready(thrd);
else
else if (!quiet)
printf("Could not create reader %d\n", i);
}
 
k = random(5) + 1;
printf("Creating %d writers\n", k);
for (i = 0; i < k; i++) {
if (!quiet)
printf("Creating %d writers\n", wr);
for (i = 0; i < wr; i++) {
thrd = thread_create(writer, NULL, TASK, 0, "writer", false);
if (thrd)
thread_ready(thrd);
else
else if (!quiet)
printf("Could not create writer %d\n", i);
}
150,6 → 185,12
thread_usleep(20000);
waitq_wakeup(&can_start, WAKEUP_ALL);
while (atomic_get(&thread_count) > 0) {
if (!quiet)
printf("Threads left: %d\n", atomic_get(&thread_count));
thread_sleep(1);
}
if (atomic_get(&threads_fault) == 0)
return NULL;
/trunk/kernel/test/thread/thread1.c
40,6 → 40,7
 
static atomic_t finish;
static atomic_t threads_finished;
static bool sh_quiet;
 
static void threadtest(void *data)
{
46,6 → 47,7
thread_detach(THREAD);
 
while (atomic_get(&finish)) {
if (!sh_quiet)
printf("%d\n", (int) (THREAD->tid));
thread_usleep(100);
}
55,6 → 57,7
char * test_thread1(bool quiet)
{
unsigned int i, total = 0;
sh_quiet = quiet;
atomic_set(&finish, 1);
atomic_set(&threads_finished, 0);
62,6 → 65,7
for (i = 0; i < THREADS; i++) {
thread_t *t;
if (!(t = thread_create(threadtest, NULL, TASK, 0, "threadtest", false))) {
if (!quiet)
printf("Could not create thread %d\n", i);
break;
}
69,11 → 73,13
total++;
}
if (!quiet)
printf("Running threads for 10 seconds...\n");
thread_sleep(10);
atomic_set(&finish, 0);
while (atomic_get(&threads_finished) < total) {
if (!quiet)
printf("Threads left: %d\n", total - atomic_get(&threads_finished));
thread_sleep(1);
}
/trunk/kernel/test/mm/falloc1.c
55,12 → 55,15
 
for (run = 0; run < TEST_RUNS; run++) {
for (order = 0; order <= MAX_ORDER; order++) {
if (!quiet)
printf("Allocating %d frames blocks ... ", 1 << order);
allocated = 0;
for (i = 0; i < MAX_FRAMES >> order; i++) {
frames[allocated] = (uintptr_t) frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) {
if (!quiet)
printf("Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10);
return "Test failed";
}
68,11 → 71,13
if (frames[allocated])
allocated++;
else {
if (!quiet)
printf("done. ");
break;
}
}
if (!quiet)
printf("%d blocks allocated.\n", allocated);
if (run) {
81,9 → 86,13
} else
results[order] = allocated;
if (!quiet)
printf("Deallocating ... ");
for (i = 0; i < allocated; i++)
frame_free(KA2PA(frames[i]));
if (!quiet)
printf("done.\n");
}
}
/trunk/kernel/test/mm/falloc2.c
47,6 → 47,7
 
static atomic_t thread_count;
static atomic_t thread_fail;
static bool sh_quiet;
 
static void falloc(void * arg)
{
56,6 → 57,7
uintptr_t * frames = (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC);
if (frames == NULL) {
if (!sh_quiet)
printf("Thread #%d (cpu%d): Unable to allocate frames\n", THREAD->tid, CPU->id);
atomic_inc(&thread_fail);
atomic_dec(&thread_count);
66,7 → 68,9
 
for (run = 0; run < THREAD_RUNS; run++) {
for (order = 0; order <= MAX_ORDER; order++) {
if (!sh_quiet)
printf("Thread #%d (cpu%d): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order);
allocated = 0;
for (i = 0; i < (MAX_FRAMES >> order); i++) {
frames[allocated] = (uintptr_t)frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
76,12 → 80,17
} else
break;
}
if (!sh_quiet)
printf("Thread #%d (cpu%d): %d blocks allocated.\n", THREAD->tid, CPU->id, allocated);
 
if (!sh_quiet)
printf("Thread #%d (cpu%d): Deallocating ... \n", THREAD->tid, CPU->id);
for (i = 0; i < allocated; i++) {
for (k = 0; k <= ((FRAME_SIZE << order) - 1); k++) {
if (((uint8_t *) frames[i])[k] != val) {
if (!sh_quiet)
printf("Thread #%d (cpu%d): Unexpected data (%d) in block %p offset %#zx\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k);
atomic_inc(&thread_fail);
goto cleanup;
89,6 → 98,8
}
frame_free(KA2PA(frames[i]));
}
if (!sh_quiet)
printf("Thread #%d (cpu%d): Finished run.\n", THREAD->tid, CPU->id);
}
}
95,6 → 106,8
 
cleanup:
free(frames);
if (!sh_quiet)
printf("Thread #%d (cpu%d): Exiting\n", THREAD->tid, CPU->id);
atomic_dec(&thread_count);
}
102,6 → 115,7
char * test_falloc2(bool quiet)
{
unsigned int i;
sh_quiet = quiet;
 
atomic_set(&thread_count, THREADS);
atomic_set(&thread_fail, 0);
109,6 → 123,7
for (i = 0; i < THREADS; i++) {
thread_t * thrd = thread_create(falloc, NULL, TASK, 0, "falloc", false);
if (!thrd) {
if (!quiet)
printf("Could not create thread %d\n", i);
break;
}
116,6 → 131,7
}
while (atomic_get(&thread_count) > 0) {
if (!quiet)
printf("Threads left: %d\n", atomic_get(&thread_count));
thread_sleep(1);
}
/trunk/kernel/test/mm/slab1.c
37,65 → 37,87
 
static void * data[VAL_COUNT];
 
static void testit(int size, int count)
static void testit(int size, int count, bool quiet)
{
slab_cache_t *cache;
int i;
if (!quiet)
printf("Creating cache, object size: %d.\n", size);
cache = slab_cache_create("test_cache", size, 0, NULL, NULL,
SLAB_CACHE_NOMAGAZINE);
if (!quiet)
printf("Allocating %d items...", count);
for (i = 0; i < count; i++) {
data[i] = slab_alloc(cache, 0);
memsetb((uintptr_t) data[i], size, 0);
}
if (!quiet) {
printf("done.\n");
printf("Freeing %d items...", count);
for (i = 0; i < count; i++) {
}
for (i = 0; i < count; i++)
slab_free(cache, data[i]);
if (!quiet) {
printf("done.\n");
printf("Allocating %d items...", count);
}
printf("done.\n");
 
printf("Allocating %d items...", count);
for (i = 0; i < count; i++) {
data[i] = slab_alloc(cache, 0);
memsetb((uintptr_t) data[i], size, 0);
}
if (!quiet) {
printf("done.\n");
printf("Freeing %d items...", count / 2);
}
 
printf("Freeing %d items...", count / 2);
for (i = count - 1; i >= count / 2; i--) {
for (i = count - 1; i >= count / 2; i--)
slab_free(cache, data[i]);
if (!quiet) {
printf("done.\n");
printf("Allocating %d items...", count / 2);
}
printf("done.\n");
 
printf("Allocating %d items...", count / 2);
for (i = count / 2; i < count; i++) {
data[i] = slab_alloc(cache, 0);
memsetb((uintptr_t) data[i], size, 0);
}
if (!quiet) {
printf("done.\n");
printf("Freeing %d items...", count);
for (i = 0; i < count; i++) {
}
for (i = 0; i < count; i++)
slab_free(cache, data[i]);
}
if (!quiet)
printf("done.\n");
slab_cache_destroy(cache);
 
if (!quiet)
printf("Test complete.\n");
}
 
static void testsimple(void)
static void testsimple(bool quiet)
{
testit(100, VAL_COUNT);
testit(200, VAL_COUNT);
testit(1024, VAL_COUNT);
testit(2048, 512);
testit(4000, 128);
testit(8192, 128);
testit(16384, 128);
testit(16385, 128);
testit(100, VAL_COUNT, quiet);
testit(200, VAL_COUNT, quiet);
testit(1024, VAL_COUNT, quiet);
testit(2048, 512, quiet);
testit(4000, 128, quiet);
testit(8192, 128, quiet);
testit(16384, 128, quiet);
testit(16385, 128, quiet);
}
 
#define THREADS 6
105,6 → 127,7
static void * thr_data[THREADS][THR_MEM_COUNT];
static slab_cache_t *thr_cache;
static semaphore_t thr_sem;
static bool sh_quiet;
 
static void slabtest(void *data)
{
113,7 → 136,9
thread_detach(THREAD);
if (!sh_quiet)
printf("Starting thread #%d...\n",THREAD->tid);
for (j = 0; j < 10; j++) {
for (i = 0; i < THR_MEM_COUNT; i++)
thr_data[offs][i] = slab_alloc(thr_cache,0);
124,23 → 149,26
for (i = 0; i < THR_MEM_COUNT; i++)
slab_free(thr_cache, thr_data[offs][i]);
}
if (!sh_quiet)
printf("Thread #%d finished\n", THREAD->tid);
semaphore_up(&thr_sem);
}
 
static void testthreads(void)
static void testthreads(bool quiet)
{
thread_t *t;
int i;
 
thr_cache = slab_cache_create("thread_cache", THR_MEM_SIZE, 0,
NULL, NULL,
thr_cache = slab_cache_create("thread_cache", THR_MEM_SIZE, 0, NULL, NULL,
SLAB_CACHE_NOMAGAZINE);
semaphore_initialize(&thr_sem, 0);
for (i = 0; i < THREADS; i++) {
if (!(t = thread_create(slabtest, (void *) (unative_t) i, TASK, 0, "slabtest", false)))
if (!(t = thread_create(slabtest, (void *) (unative_t) i, TASK, 0, "slabtest", false))) {
if (!quiet)
printf("Could not create thread %d\n", i);
else
} else
thread_ready(t);
}
 
148,14 → 176,17
semaphore_down(&thr_sem);
slab_cache_destroy(thr_cache);
if (!quiet)
printf("Test complete.\n");
}
 
char * test_slab1(bool quiet)
{
testsimple();
testthreads();
sh_quiet = quiet;
testsimple(quiet);
testthreads(quiet);
return NULL;
}
/trunk/kernel/test/mm/slab2.c
42,7 → 42,7
* free one of the caches. We should have everything in magazines,
* now allocation should clean magazines and allow for full allocation.
*/
static void totalmemtest(void)
static void totalmemtest(bool quiet)
{
slab_cache_t *cache1;
slab_cache_t *cache2;
54,12 → 54,14
cache1 = slab_cache_create("cache1_tst", ITEM_SIZE, 0, NULL, NULL, 0);
cache2 = slab_cache_create("cache2_tst", ITEM_SIZE, 0, NULL, NULL, 0);
 
if (!quiet)
printf("Allocating...");
/* Use atomic alloc, so that we find end of memory */
do {
data1 = slab_alloc(cache1, FRAME_ATOMIC);
data2 = slab_alloc(cache2, FRAME_ATOMIC);
if (!data1 || !data2) {
if ((!data1) || (!data2)) {
if (data1)
slab_free(cache1,data1);
if (data2)
73,20 → 75,28
olddata1 = data1;
olddata2 = data2;
} while(1);
if (!quiet) {
printf("done.\n");
printf("Deallocating cache2...");
}
/* We do not have memory - now deallocate cache2 */
printf("Deallocating cache2...");
while (olddata2) {
data2 = *((void **)olddata2);
slab_free(cache2, olddata2);
olddata2 = data2;
}
if (!quiet) {
printf("done.\n");
printf("Allocating to cache1...\n");
}
 
printf("Allocating to cache1...\n");
for (i=0; i<30; i++) {
data1 = slab_alloc(cache1, FRAME_ATOMIC);
if (!data1) {
if (!quiet)
printf("Incorrect memory size - use another test.");
return;
}
96,21 → 106,27
}
while (1) {
data1 = slab_alloc(cache1, FRAME_ATOMIC);
if (!data1) {
if (!data1)
break;
}
memsetb((uintptr_t)data1, ITEM_SIZE, 0);
*((void **)data1) = olddata1;
olddata1 = data1;
}
if (!quiet)
printf("Deallocating cache1...");
while (olddata1) {
data1 = *((void **)olddata1);
slab_free(cache1, olddata1);
olddata1 = data1;
}
if (!quiet) {
printf("done.\n");
slab_print_list();
}
slab_cache_destroy(cache1);
slab_cache_destroy(cache2);
}
119,6 → 135,7
static semaphore_t thr_sem;
static condvar_t thread_starter;
static mutex_t starter_mutex;
static bool sh_quiet;
 
#define THREADS 8
 
132,10 → 149,13
condvar_wait(&thread_starter,&starter_mutex);
mutex_unlock(&starter_mutex);
if (!sh_quiet)
printf("Starting thread #%d...\n",THREAD->tid);
 
/* Alloc all */
if (!sh_quiet)
printf("Thread #%d allocating...\n", THREAD->tid);
while (1) {
/* Call with atomic to detect end of memory */
new = slab_alloc(thr_cache, FRAME_ATOMIC);
144,7 → 164,10
*((void **)new) = data;
data = new;
}
if (!sh_quiet)
printf("Thread #%d releasing...\n", THREAD->tid);
while (data) {
new = *((void **)data);
*((void **)data) = NULL;
151,7 → 174,10
slab_free(thr_cache, data);
data = new;
}
if (!sh_quiet)
printf("Thread #%d allocating...\n", THREAD->tid);
while (1) {
/* Call with atomic to detect end of memory */
new = slab_alloc(thr_cache, FRAME_ATOMIC);
160,7 → 186,10
*((void **)new) = data;
data = new;
}
if (!sh_quiet)
printf("Thread #%d releasing...\n", THREAD->tid);
while (data) {
new = *((void **)data);
*((void **)data) = NULL;
168,12 → 197,14
data = new;
}
 
if (!sh_quiet)
printf("Thread #%d finished\n", THREAD->tid);
slab_print_list();
semaphore_up(&thr_sem);
}
 
static void multitest(int size)
static void multitest(int size, bool quiet)
{
/* Start 8 threads that just allocate as much as possible,
* then release everything, then again allocate, then release
181,18 → 212,19
thread_t *t;
int i;
 
if (!quiet)
printf("Running stress test with size %d\n", size);
condvar_initialize(&thread_starter);
mutex_initialize(&starter_mutex);
 
thr_cache = slab_cache_create("thread_cache", size, 0,
NULL, NULL,
0);
thr_cache = slab_cache_create("thread_cache", size, 0, NULL, NULL, 0);
semaphore_initialize(&thr_sem,0);
for (i = 0; i < THREADS; i++) {
if (!(t = thread_create(slabtest, NULL, TASK, 0, "slabtest", false)))
if (!(t = thread_create(slabtest, NULL, TASK, 0, "slabtest", false))) {
if (!quiet)
printf("Could not create thread %d\n", i);
else
} else
thread_ready(t);
}
thread_sleep(1);
202,21 → 234,26
semaphore_down(&thr_sem);
slab_cache_destroy(thr_cache);
if (!quiet)
printf("Stress test complete.\n");
}
 
char * test_slab2(bool quiet)
{
sh_quiet = quiet;
if (!quiet)
printf("Running reclaim single-thread test .. pass 1\n");
totalmemtest();
totalmemtest(quiet);
if (!quiet)
printf("Running reclaim single-thread test .. pass 2\n");
totalmemtest();
totalmemtest(quiet);
if (!quiet)
printf("Reclaim test OK.\n");
 
multitest(128);
multitest(2048);
multitest(8192);
printf("All done.\n");
multitest(128, quiet);
multitest(2048, quiet);
multitest(8192, quiet);
return NULL;
}
/trunk/kernel/test/mm/mapping1.c
49,18 → 49,26
frame0 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
frame1 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
 
if (!quiet)
printf("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0));
*((uint32_t *) frame0) = VALUE0;
if (!quiet)
printf("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1));
*((uint32_t *) frame1) = VALUE1;
if (!quiet)
printf("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0));
page_mapping_insert(AS_KERNEL, PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE);
if (!quiet)
printf("Mapping virtual address %p to physical address %p.\n", PAGE1, KA2PA(frame1));
page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE);
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));
v0 = *((uint32_t *) PAGE0);
v1 = *((uint32_t *) PAGE1);
if (!quiet) {
printf("Value at virtual address %p is %#x.\n", PAGE0, v0);
printf("Value at virtual address %p is %#x.\n", PAGE1, v1);
}
if (v0 != VALUE0)
return "Value at v0 not equal to VALUE0";
67,8 → 75,10
if (v1 != VALUE1)
return "Value at v1 not equal to VALUE1";
 
if (!quiet)
printf("Writing %#x to virtual address %p.\n", 0, PAGE0);
*((uint32_t *) PAGE0) = 0;
if (!quiet)
printf("Writing %#x to virtual address %p.\n", 0, PAGE1);
*((uint32_t *) PAGE1) = 0;
 
75,8 → 85,10
v0 = *((uint32_t *) PAGE0);
v1 = *((uint32_t *) PAGE1);
if (!quiet) {
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));
}
 
if (v0 != 0)
return "Value at v0 not equal to 0";
/trunk/kernel/test/fpu/mips2.c
45,6 → 45,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)
{
70,6 → 71,7
);
if (arg != after_arg) {
if (!sh_quiet)
printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg);
atomic_inc(&threads_fault);
break;
101,6 → 103,7
);
if (arg != after_arg) {
if (!sh_quiet)
printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg);
atomic_inc(&threads_fault);
break;
113,10 → 116,13
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);
if (!quiet)
printf("Creating %d threads... ", 2 * THREADS);
 
for (i = 0; i < THREADS; i++) {
123,6 → 129,7
thread_t *t;
if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) {
if (!quiet)
printf("could not create thread %d\n", 2 * i);
break;
}
130,6 → 137,7
total++;
if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) {
if (!quiet)
printf("could not create thread %d\n", 2 * i + 1);
break;
}
136,6 → 144,8
thread_ready(t);
total++;
}
if (!quiet)
printf("ok\n");
thread_sleep(1);
142,6 → 152,7
waitq_wakeup(&can_start, WAKEUP_ALL);
while (atomic_get(&threads_ok) != total) {
if (!quiet)
printf("Threads left: %d\n", total - atomic_get(&threads_ok));
thread_sleep(1);
}
/trunk/kernel/test/sysinfo/sysinfo1.c
34,6 → 34,7
 
char * test_sysinfo1(bool quiet)
{
if (!quiet)
sysinfo_dump(NULL, 0);
return NULL;
}
/trunk/kernel/test/print/print1.c
32,6 → 32,7
 
char * test_print1(bool quiet)
{
if (!quiet) {
int retval;
unative_t nat = 0x12345678u;
64,6 → 65,7
printf("Print long text to %d char long buffer via snprintf.\n", BUFFER_SIZE);
retval = snprintf(buffer, BUFFER_SIZE, "Very long %s. This text`s length is more than %d. We are interested in the result.", "text" , BUFFER_SIZE);
printf("Result is: '%s', retval = %d\n", buffer, retval);
}
return NULL;
}