Changeset 7e13972 in mainline for kernel/test/synch/rwlock4.c


Ignore:
Timestamp:
2006-12-12T18:51:06Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cce6acf
Parents:
96348adc
Message:

remove asserts and panics from tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/synch/rwlock4.c

    r96348adc r7e13972  
    3535#include <arch/context.h>
    3636#include <context.h>
    37 #include <panic.h>
    3837
    3938#include <synch/waitq.h>
     
    4645
    4746static rwlock_t rwlock;
     47static atomic_t threads_fault;
    4848
    4949SPINLOCK_INITIALIZE(rw_lock);
     
    7979        printf("cpu%d, tid %d w=\n", CPU->id, THREAD->tid);
    8080
    81         if (rwlock.readers_in) panic("Oops.");
     81        if (rwlock.readers_in) {
     82                printf("Oops.");
     83                atomic_inc(&threads_fault);
     84                return;
     85        }
    8286        thread_usleep(random(1000000));
    83         if (rwlock.readers_in) panic("Oops."); 
     87        if (rwlock.readers_in) {
     88                printf("Oops.");       
     89                atomic_inc(&threads_fault);
     90                return;
     91        }
    8492
    8593        rwlock_write_unlock(&rwlock);
     
    113121        waitq_initialize(&can_start);
    114122        rwlock_initialize(&rwlock);
     123        atomic_set(&threads_fault, 0);
    115124       
    116125        thread_t *thrd;
     
    131140        k = random(5) + 1;
    132141        printf("Creating %d writers\n", k);
    133         for (i=0; i<k; i++) {
     142        for (i = 0; i < k; i++) {
    134143                thrd = thread_create(writer, NULL, TASK, 0, "writer");
    135144                if (thrd)
     
    142151        waitq_wakeup(&can_start, WAKEUP_ALL);
    143152       
    144         return NULL;
     153        if (atomic_get(&threads_fault) == 0)
     154                return NULL;
     155       
     156        return "Test failed";
    145157}
Note: See TracChangeset for help on using the changeset viewer.