Changeset 7bdcac1 for src


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
Files:
1 added
13 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
  • src/tests/preempt_longrun/Makefile.am

    r85b1deb r7bdcac1  
    1919preempt=10ul\`ms
    2020debug=-debug
     21type=LONG
    2122
    2223REPEAT = ${abs_top_srcdir}/tools/repeat
     24WATCHDOG = ${abs_top_srcdir}/tools/watchdog
    2325TIME = /usr/bin/time -f "%E"
    2426
    25 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} -DLONG_TEST
     27BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} -I.. -I. -DTEST_$(shell echo $(type) | tr a-z A-Z)
    2628CFLAGS = ${BUILD_FLAGS}
    2729CC = @CFA_BINDIR@/@CFA_NAME@
     
    2931TESTS = block coroutine create disjoint enter enter3 processor stack wait yield
    3032
    31 .INTERMEDIATE: ${TESTS}
     33# .INTERMEDIATE: ${TESTS}
    3234
    3335all-local: ${TESTS:=.run}
     36
     37runall : ${TESTS:=.run}
     38        @ echo "All programs terminated normally"
     39
     40watchall : ${TESTS:=.watch}
     41        @ echo "All programs terminated normally"
     42
     43compileall : ${TESTS}
     44        @ echo "Compiled"
    3445
    3546clean-local:
     
    4455        @ echo -e "${<}: SUCCESS\n"
    4556
     57%.watch : % ${WATCHDOG}
     58        @ time ${WATCHDOG} ./${<}
     59        @ rm ${<}
     60        @ echo -e "${<}: SUCCESS\n"
     61
    4662%.time : % ${REPEAT}
    4763        @ ${REPEAT} -i -s -- $(repeats) $(TIME) -a -o times.log ./${<}
     
    4965        @ echo -e "${<}: SUCCESS\n"
    5066
    51 ${REPEAT}:
     67${REPEAT}: ${abs_top_srcdir}/tools/Makefile
    5268        @+make -C ${abs_top_srcdir}/tools/
     69
     70${WATCHDOG}: ${abs_top_srcdir}/tools/Makefile
     71        @+make -C ${abs_top_srcdir}/tools/
  • src/tests/preempt_longrun/Makefile.in

    r85b1deb r7bdcac1  
    452452preempt = 10ul\`ms
    453453debug = -debug
     454type = LONG
    454455REPEAT = ${abs_top_srcdir}/tools/repeat
     456WATCHDOG = ${abs_top_srcdir}/tools/watchdog
    455457TIME = /usr/bin/time -f "%E"
    456 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} -DLONG_TEST
     458BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} -I.. -I. -DTEST_$(shell echo $(type) | tr a-z A-Z)
    457459TESTS = block coroutine create disjoint enter enter3 processor stack wait yield
    458460all: all-am
     
    873875
    874876
    875 .INTERMEDIATE: ${TESTS}
     877# .INTERMEDIATE: ${TESTS}
    876878
    877879all-local: ${TESTS:=.run}
     880
     881runall : ${TESTS:=.run}
     882        @ echo "All programs terminated normally"
     883
     884watchall : ${TESTS:=.watch}
     885        @ echo "All programs terminated normally"
     886
     887compileall : ${TESTS}
     888        @ echo "Compiled"
    878889
    879890clean-local:
     
    888899        @ echo -e "${<}: SUCCESS\n"
    889900
     901%.watch : % ${WATCHDOG}
     902        @ time ${WATCHDOG} ./${<}
     903        @ rm ${<}
     904        @ echo -e "${<}: SUCCESS\n"
     905
    890906%.time : % ${REPEAT}
    891907        @ ${REPEAT} -i -s -- $(repeats) $(TIME) -a -o times.log ./${<}
     
    893909        @ echo -e "${<}: SUCCESS\n"
    894910
    895 ${REPEAT}:
     911${REPEAT}: ${abs_top_srcdir}/tools/Makefile
     912        @+make -C ${abs_top_srcdir}/tools/
     913
     914${WATCHDOG}: ${abs_top_srcdir}/tools/Makefile
    896915        @+make -C ${abs_top_srcdir}/tools/
    897916
  • src/tests/preempt_longrun/create.c

    r85b1deb r7bdcac1  
    22#include <thread>
    33#include <time>
     4
     5#include "long_tests.h"
    46
    57#ifndef PREEMPTION_RATE
     
    1921int main(int argc, char* argv[]) {
    2022        processor p;
    21         for(int i = 0; i < N; i++) {
     23        for(int i = 0; TEST(i < N); i++) {
    2224                worker_t w[7];
     25                KICK_WATCHDOG;
    2326        }
    2427}
  • src/tests/preempt_longrun/enter.c

    r85b1deb r7bdcac1  
    33#include <thread>
    44#include <time>
     5
     6#include "long_tests.h"
    57
    68#ifndef PREEMPTION_RATE
     
    1517
    1618monitor mon_t {};
    17 void foo( mon_t & mutex this ) {}
     19void foo( mon_t & mutex this ) {
     20        KICK_WATCHDOG;
     21}
    1822
    1923mon_t mon;
    2024thread worker_t {};
    2125void main( worker_t & this ) {
    22         for( unsigned long i = 0; i < N; i++ ) {
     26        for( unsigned long i = 0; TEST(i < N); i++ ) {
    2327                foo( mon );
    2428        }
  • src/tests/preempt_longrun/enter3.c

    r85b1deb r7bdcac1  
    33#include <thread>
    44#include <time>
     5
     6#include "long_tests.h"
    57
    68#ifndef PREEMPTION_RATE
     
    1820mon_t mon1, mon2, mon3;
    1921
    20 void foo( mon_t & mutex a, mon_t & mutex b, mon_t & mutex c ) {}
     22void foo( mon_t & mutex a, mon_t & mutex b, mon_t & mutex c ) {
     23        KICK_WATCHDOG;
     24}
    2125
    2226thread worker_t {};
    2327
    2428void main( worker_t & this ) {
    25         for( unsigned long i = 0; i < N; i++ ) {
     29        for( unsigned long i = 0; TEST(i < N); i++ ) {
    2630                foo( mon1, mon2, mon3 );
    2731        }
  • src/tests/preempt_longrun/processor.c

    r85b1deb r7bdcac1  
    44
    55#include <unistd.h>
     6
     7#include "long_tests.h"
    68
    79#ifndef PREEMPTION_RATE
     
    1719int main(int argc, char* argv[]) {
    1820        processor * p[15];
    19         write(STDOUT_FILENO, "Preparing\n", sizeof("Preparing\n"));
    2021        for ( int pi = 0; pi < 15; pi++ ) {
    2122                p[pi] = new();
    2223        }
    23         write(STDOUT_FILENO, "Starting\n", sizeof("Starting\n"));
    24         for ( int i = 0; i < N; i++) {
     24        for ( int i = 0; TEST(i < N); i++) {
    2525                int pi = i % 15;
    2626                delete( p[pi] );
    2727                p[pi] = new();
     28                KICK_WATCHDOG;
    2829        }
    29         write(STDOUT_FILENO, "Stopping\n", sizeof("Stopping\n"));
    3030        for ( int pi = 0; pi < 15; pi++ ) {
    3131                delete( p[pi] );
    3232        }
    33         write(STDOUT_FILENO, "Done\n", sizeof("Done\n"));
    3433}
  • src/tests/preempt_longrun/stack.c

    r85b1deb r7bdcac1  
    33#include <thread>
    44#include <time>
     5
     6#include "long_tests.h"
    57
    68#ifndef PREEMPTION_RATE
     
    1820        volatile long long a = 326_417ul;
    1921        volatile long long n = 1l;
    20         for (volatile long long i = 0; i < p; i++) {
     22        for (volatile long long i = 0; TEST(i < p); i++) {
    2123                n *= a;
    2224                n %= p;
     25                KICK_WATCHDOG;
    2326        }
    2427
    25         if( n != a ) {
     28        if( !TEST(n == a) ) {
    2629                abort();
    2730        }
  • src/tests/preempt_longrun/yield.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 = 9_750_000ul;
    1517#else
     
    2022
    2123void main(worker_t & this) {
    22         for(int i = 0; i < N; i++) {
     24        for(int i = 0; TEST(i < N); i++) {
    2325                yield();
     26                KICK_WATCHDOG;
    2427        }
    2528}
Note: See TracChangeset for help on using the changeset viewer.