Ignore:
Timestamp:
Jun 11, 2018, 10:16:04 AM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
3fc59bdb
Parents:
85b1deb
Message:

Added the option to make longrun tests run until failure

Location:
src/tests/concurrent
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/tests/concurrent/coroutineYield.c

    r85b1deb r7bdcac1  
    44#include <thread>
    55#include <time>
     6
     7#include "long_tests.h"
    68
    79#ifndef PREEMPTION_RATE
     
    1315}
    1416
    15 #ifdef LONG_TEST
     17#ifdef TEST_LONG
    1618static const unsigned long N = 600_000ul;
    1719#else
     
    3335int main(int argc, char* argv[]) {
    3436        Coroutine c;
    35         for(int i = 0; i < N; i++) {
     37        for(int i = 0; TEST(i < N); i++) {
    3638                sout | "Thread 1" | endl;
    3739                resume(c);
    3840                sout | "Thread 2" | endl;
    3941                yield();
     42                KICK_WATCHDOG;
    4043        }
    4144}
  • src/tests/concurrent/preempt.c

    r85b1deb r7bdcac1  
    22#include <thread>
    33#include <time>
     4
     5#include "long_tests.h"
    46
    57#ifndef PREEMPTION_RATE
     
    1113}
    1214
    13 #ifdef LONG_TEST
     15#ifdef TEST_LONG
    1416static const unsigned long N = 30_000ul;
    1517#else
     
    3032
    3133void main(worker_t & this) {
    32         while(counter < N) {
     34        while(TEST(counter < N)) {
    3335                __cfaabi_check_preemption();
    3436                if( (counter % 7) == this.value ) {
     
    4042                }
    4143                __cfaabi_check_preemption();
     44                KICK_WATCHDOG;
    4245        }
    4346}
  • src/tests/concurrent/signal/block.c

    r85b1deb r7bdcac1  
    1414#include <time>
    1515
     16#include "long_tests.h"
     17
    1618#ifndef PREEMPTION_RATE
    1719#define PREEMPTION_RATE 10`ms
     
    2224}
    2325
    24 #ifdef LONG_TEST
     26#ifdef TEST_LONG
    2527static const unsigned long N = 150_000ul;
    2628#else
     
    6668thread Waiter {};
    6769void main( Waiter & this ) {
    68         for( int i = 0; i < N; i++ ) {
     70        for( int i = 0; TEST(i < N); i++ ) {
    6971                wait_op( globalA, globalB, i );
     72                KICK_WATCHDOG;
    7073        }
    7174}
  • src/tests/concurrent/signal/disjoint.c

    r85b1deb r7bdcac1  
    44#include <thread>
    55#include <time>
     6
     7#include "long_tests.h"
    68
    79#ifndef PREEMPTION_RATE
     
    1315}
    1416
    15 #ifdef LONG_TEST
     17#ifdef TEST_LONG
    1618static const unsigned long N = 300_000ul;
    1719#else
     
    7173        if( (d.counter % 1000) == 0 ) sout | d.counter | endl;
    7274
    73         return d.counter < N;
     75        return TEST(d.counter < N);
    7476}
    7577
     
    7779
    7880void main( Waiter & this ) {
    79         while( wait( mut, data ) ) { yield(); }
     81        while( wait( mut, data ) ) { KICK_WATCHDOG; yield(); }
    8082}
    8183
     
    9496
    9597        //This is technically a mutual exclusion violation but the mutex monitor protects us
    96         bool running = data.counter < N && data.counter > 0;
     98        bool running = TEST(data.counter < N) && data.counter > 0;
    9799        if( data.state != SIGNAL && running ) {
    98100                sout | "ERROR Eager signal" | data.state | endl;
  • src/tests/concurrent/signal/wait.c

    r85b1deb r7bdcac1  
    1212#include <time>
    1313
     14#include "long_tests.h"
     15
    1416#ifndef PREEMPTION_RATE
    1517#define PREEMPTION_RATE 10`ms
     
    2022}
    2123
    22 #ifdef LONG_TEST
     24#ifdef TEST_LONG
    2325static const unsigned long N = 375_000ul;
    2426#else
     
    9092// Waiter ABC
    9193void main( WaiterABC & this ) {
    92         for( int i = 0; i < N; i++ ) {
     94        for( int i = 0; TEST(i < N); i++ ) {
    9395                wait( condABC, globalA, globalB, globalC );
     96                KICK_WATCHDOG;
    9497        }
    9598
     
    100103// Waiter AB
    101104void main( WaiterAB & this ) {
    102         for( int i = 0; i < N; i++ ) {
     105        for( int i = 0; TEST(i < N); i++ ) {
    103106                wait( condAB , globalA, globalB );
     107                KICK_WATCHDOG;
    104108        }
    105109
     
    110114// Waiter AC
    111115void main( WaiterAC & this ) {
    112         for( int i = 0; i < N; i++ ) {
     116        for( int i = 0; TEST(i < N); i++ ) {
    113117                wait( condAC , globalA, globalC );
     118                KICK_WATCHDOG;
    114119        }
    115120
     
    120125// Waiter BC
    121126void main( WaiterBC & this ) {
    122         for( int i = 0; i < N; i++ ) {
     127        for( int i = 0; TEST(i < N); i++ ) {
    123128                wait( condBC , globalB, globalC );
     129                KICK_WATCHDOG;
    124130        }
    125131
Note: See TracChangeset for help on using the changeset viewer.