Changeset 0b33412


Ignore:
Timestamp:
Jun 16, 2017, 10:36:49 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
405c592
Parents:
ec35498
Message:

Updated tests to use verify instead of assert

Location:
src/libcfa
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/alarm.c

    rec35498 r0b33412  
    9999
    100100static inline void insert_at( alarm_list_t * this, alarm_node_t * n, __alarm_it_t p ) {
    101         assert( !n->next );
     101        verify( !n->next );
    102102        if( p == this->tail ) {
    103103                this->tail = &n->next;
     
    108108        *p = n;
    109109
    110         LIB_DEBUG_DO( assert( validate( this ) ) );
     110        verify( validate( this ) );
    111111}
    112112
     
    119119        insert_at( this, n, it );
    120120
    121         LIB_DEBUG_DO( assert( validate( this ) ) );
     121        verify( validate( this ) );
    122122}
    123123
     
    131131                head->next = NULL;
    132132        }
    133         LIB_DEBUG_DO( assert( validate( this ) ) );
     133        verify( validate( this ) );
    134134        return head;
    135135}
     
    145145        n->next = NULL;
    146146
    147         LIB_DEBUG_DO( assert( validate( this ) ) );
     147        verify( validate( this ) );
    148148}
    149149
     
    154154        }
    155155
    156         LIB_DEBUG_DO( assert( validate( this ) ) );
     156        verify( validate( this ) );
    157157
    158158        if( *it ) { remove_at( this, n, it ); }
    159159
    160         LIB_DEBUG_DO( assert( validate( this ) ) );
     160        verify( validate( this ) );
    161161}
    162162
    163163void register_self( alarm_node_t * this ) {
    164164        disable_interrupts();
    165         assert( !systemProcessor->pending_alarm );
     165        verify( !systemProcessor->pending_alarm );
    166166        lock( &systemProcessor->alarm_lock );
    167         LIB_DEBUG_DO( assert( validate( &systemProcessor->alarms ) ) );
    168167        {
     168                verify( validate( &systemProcessor->alarms ) );
    169169                bool first = !systemProcessor->alarms.head;
    170170
     
    190190        disable_interrupts();
    191191        lock( &systemProcessor->alarm_lock );
    192         LIB_DEBUG_DO( assert( validate( &systemProcessor->alarms ) ) );
    193         remove( &systemProcessor->alarms, this );
     192        {
     193                verify( validate( &systemProcessor->alarms ) );
     194                remove( &systemProcessor->alarms, this );
     195        }
    194196        unlock( &systemProcessor->alarm_lock );
    195197        disable_interrupts();
  • src/libcfa/concurrency/kernel.c

    rec35498 r0b33412  
    173173        (&this->proc){ cltr, runner };
    174174
    175         LIB_DEBUG_DO( assert( validate( &this->alarms ) ) );
     175        verify( validate( &this->alarms ) );
    176176}
    177177
     
    215215                        if(readyThread)
    216216                        {
    217                                 assert( disable_preempt_count > 0 );
     217                                verify( disable_preempt_count > 0 );
    218218
    219219                                runThread(this, readyThread);
    220220
    221                                 assert( disable_preempt_count > 0 );
     221                                verify( disable_preempt_count > 0 );
    222222
    223223                                //Some actions need to be taken from the kernel
     
    387387void BlockInternal() {
    388388        disable_interrupts();
    389         assert( disable_preempt_count > 0 );
     389        verify( disable_preempt_count > 0 );
    390390        suspend();
    391         assert( disable_preempt_count > 0 );
     391        verify( disable_preempt_count > 0 );
    392392        enable_interrupts( __PRETTY_FUNCTION__ );
    393393}
     
    397397        this_processor->finish.action_code = Release;
    398398        this_processor->finish.lock = lock;
    399         assert( disable_preempt_count > 0 );
     399
     400        verify( disable_preempt_count > 0 );
    400401        suspend();
    401         assert( disable_preempt_count > 0 );
     402        verify( disable_preempt_count > 0 );
     403
    402404        enable_interrupts( __PRETTY_FUNCTION__ );
    403405}
     
    407409        this_processor->finish.action_code = Schedule;
    408410        this_processor->finish.thrd = thrd;
    409         assert( disable_preempt_count > 0 );
     411
     412        verify( disable_preempt_count > 0 );
    410413        suspend();
    411         assert( disable_preempt_count > 0 );
     414        verify( disable_preempt_count > 0 );
     415
    412416        enable_interrupts( __PRETTY_FUNCTION__ );
    413417}
     
    418422        this_processor->finish.lock = lock;
    419423        this_processor->finish.thrd = thrd;
    420         assert( disable_preempt_count > 0 );
     424
     425        verify( disable_preempt_count > 0 );
    421426        suspend();
    422         assert( disable_preempt_count > 0 );
     427        verify( disable_preempt_count > 0 );
     428
    423429        enable_interrupts( __PRETTY_FUNCTION__ );
    424430}
     
    429435        this_processor->finish.locks = locks;
    430436        this_processor->finish.lock_count = count;
    431         assert( disable_preempt_count > 0 );
     437
     438        verify( disable_preempt_count > 0 );
    432439        suspend();
    433         assert( disable_preempt_count > 0 );
     440        verify( disable_preempt_count > 0 );
     441
    434442        enable_interrupts( __PRETTY_FUNCTION__ );
    435443}
     
    442450        this_processor->finish.thrds = thrds;
    443451        this_processor->finish.thrd_count = thrd_count;
    444         assert( disable_preempt_count > 0 );
     452
     453        verify( disable_preempt_count > 0 );
    445454        suspend();
    446         assert( disable_preempt_count > 0 );
     455        verify( disable_preempt_count > 0 );
     456
    447457        enable_interrupts( __PRETTY_FUNCTION__ );
    448458}
  • src/libcfa/concurrency/preemption.c

    rec35498 r0b33412  
    107107        }
    108108
    109         LIB_DEBUG_DO(
    110                 assert( validate( alarms ) );
     109        verify( validate( alarms ) );
     110        LIB_DEBUG_DO(
    111111                len = snprintf( text, 256, "Ticking preemption done\n" );
    112112                LIB_DEBUG_WRITE( STDERR_FILENO, text, len );
     
    165165        void disable_interrupts() {
    166166                __attribute__((unused)) unsigned short new_val = __atomic_add_fetch_2( &disable_preempt_count, 1, __ATOMIC_SEQ_CST );
    167                 assert( new_val < (unsigned short)65_000 );
    168                 assert( new_val != (unsigned short) 0 );
     167                verify( new_val < (unsigned short)65_000 );
     168                verify( new_val != (unsigned short) 0 );
    169169        }
    170170
    171171        void enable_interrupts_noRF() {
    172172                unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
    173                 assert( prev != (unsigned short) 0 );
     173                verify( prev != (unsigned short) 0 );
    174174        }
    175175
    176176        void enable_interrupts( const char * func ) {
    177177                unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
    178                 assert( prev != (unsigned short) 0 );
     178                verify( prev != (unsigned short) 0 );
    179179                if( prev == 1 && this_processor->pending_preemption ) {
    180180                        this_processor->pending_preemption = false;
  • src/libcfa/libhdr/libdebug.h

    rec35498 r0b33412  
    2222#else
    2323        #define LIB_DEBUG_DO(x)
    24         #define LIB_NO_DEBUG_DO(x) x     
     24        #define LIB_NO_DEBUG_DO(x) x
    2525#endif
    2626
Note: See TracChangeset for help on using the changeset viewer.