Changes in / [1057e3d:ee163895]
- Files:
-
- 6 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/concurrent/coroutineYield.c
r1057e3d ree163895 4 4 #include <thread> 5 5 #include <time> 6 7 #include "long_tests.h" 6 8 7 9 #ifndef PREEMPTION_RATE … … 13 15 } 14 16 15 #ifdef LONG_TEST17 #ifdef TEST_LONG 16 18 static const unsigned long N = 600_000ul; 17 19 #else … … 33 35 int main(int argc, char* argv[]) { 34 36 Coroutine c; 35 for(int i = 0; i < N; i++) {37 for(int i = 0; TEST(i < N); i++) { 36 38 sout | "Thread 1" | endl; 37 39 resume(c); 38 40 sout | "Thread 2" | endl; 39 41 yield(); 42 KICK_WATCHDOG; 40 43 } 41 44 } -
src/tests/concurrent/preempt.c
r1057e3d ree163895 2 2 #include <thread> 3 3 #include <time> 4 5 #include "long_tests.h" 4 6 5 7 #ifndef PREEMPTION_RATE … … 11 13 } 12 14 13 #ifdef LONG_TEST15 #ifdef TEST_LONG 14 16 static const unsigned long N = 30_000ul; 15 17 #else … … 30 32 31 33 void main(worker_t & this) { 32 while( counter < N) {34 while(TEST(counter < N)) { 33 35 __cfaabi_check_preemption(); 34 36 if( (counter % 7) == this.value ) { … … 40 42 } 41 43 __cfaabi_check_preemption(); 44 KICK_WATCHDOG; 42 45 } 43 46 } -
src/tests/concurrent/signal/block.c
r1057e3d ree163895 14 14 #include <time> 15 15 16 #include "long_tests.h" 17 16 18 #ifndef PREEMPTION_RATE 17 19 #define PREEMPTION_RATE 10`ms … … 22 24 } 23 25 24 #ifdef LONG_TEST26 #ifdef TEST_LONG 25 27 static const unsigned long N = 150_000ul; 26 28 #else … … 66 68 thread Waiter {}; 67 69 void main( Waiter & this ) { 68 for( int i = 0; i < N; i++ ) {70 for( int i = 0; TEST(i < N); i++ ) { 69 71 wait_op( globalA, globalB, i ); 72 KICK_WATCHDOG; 70 73 } 71 74 } -
src/tests/concurrent/signal/disjoint.c
r1057e3d ree163895 4 4 #include <thread> 5 5 #include <time> 6 7 #include "long_tests.h" 6 8 7 9 #ifndef PREEMPTION_RATE … … 13 15 } 14 16 15 #ifdef LONG_TEST17 #ifdef TEST_LONG 16 18 static const unsigned long N = 300_000ul; 17 19 #else … … 71 73 if( (d.counter % 1000) == 0 ) sout | d.counter | endl; 72 74 73 return d.counter < N;75 return TEST(d.counter < N); 74 76 } 75 77 … … 77 79 78 80 void main( Waiter & this ) { 79 while( wait( mut, data ) ) { yield(); }81 while( wait( mut, data ) ) { KICK_WATCHDOG; yield(); } 80 82 } 81 83 … … 94 96 95 97 //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; 97 99 if( data.state != SIGNAL && running ) { 98 100 sout | "ERROR Eager signal" | data.state | endl; -
src/tests/concurrent/signal/wait.c
r1057e3d ree163895 12 12 #include <time> 13 13 14 #include "long_tests.h" 15 14 16 #ifndef PREEMPTION_RATE 15 17 #define PREEMPTION_RATE 10`ms … … 20 22 } 21 23 22 #ifdef LONG_TEST24 #ifdef TEST_LONG 23 25 static const unsigned long N = 375_000ul; 24 26 #else … … 90 92 // Waiter ABC 91 93 void main( WaiterABC & this ) { 92 for( int i = 0; i < N; i++ ) {94 for( int i = 0; TEST(i < N); i++ ) { 93 95 wait( condABC, globalA, globalB, globalC ); 96 KICK_WATCHDOG; 94 97 } 95 98 … … 100 103 // Waiter AB 101 104 void main( WaiterAB & this ) { 102 for( int i = 0; i < N; i++ ) {105 for( int i = 0; TEST(i < N); i++ ) { 103 106 wait( condAB , globalA, globalB ); 107 KICK_WATCHDOG; 104 108 } 105 109 … … 110 114 // Waiter AC 111 115 void main( WaiterAC & this ) { 112 for( int i = 0; i < N; i++ ) {116 for( int i = 0; TEST(i < N); i++ ) { 113 117 wait( condAC , globalA, globalC ); 118 KICK_WATCHDOG; 114 119 } 115 120 … … 120 125 // Waiter BC 121 126 void main( WaiterBC & this ) { 122 for( int i = 0; i < N; i++ ) {127 for( int i = 0; TEST(i < N); i++ ) { 123 128 wait( condBC , globalB, globalC ); 129 KICK_WATCHDOG; 124 130 } 125 131 -
src/tests/preempt_longrun/Makefile.am
r1057e3d ree163895 19 19 preempt=10ul\`ms 20 20 debug=-debug 21 type=LONG 21 22 22 23 REPEAT = ${abs_top_srcdir}/tools/repeat 24 WATCHDOG = ${abs_top_srcdir}/tools/watchdog 23 25 TIME = /usr/bin/time -f "%E" 24 26 25 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} - DLONG_TEST27 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} -I.. -I. -DTEST_$(shell echo $(type) | tr a-z A-Z) 26 28 CFLAGS = ${BUILD_FLAGS} 27 29 CC = @CFA_BINDIR@/@CFA_NAME@ … … 29 31 TESTS = block coroutine create disjoint enter enter3 processor stack wait yield 30 32 31 .INTERMEDIATE: ${TESTS}33 # .INTERMEDIATE: ${TESTS} 32 34 33 35 all-local: ${TESTS:=.run} 36 37 runall : ${TESTS:=.run} 38 @ echo "All programs terminated normally" 39 40 watchall : ${TESTS:=.watch} 41 @ echo "All programs terminated normally" 42 43 compileall : ${TESTS} 44 @ echo "Compiled" 34 45 35 46 clean-local: … … 44 55 @ echo -e "${<}: SUCCESS\n" 45 56 57 %.watch : % ${WATCHDOG} 58 @ time ${WATCHDOG} ./${<} 59 @ rm ${<} 60 @ echo -e "${<}: SUCCESS\n" 61 46 62 %.time : % ${REPEAT} 47 63 @ ${REPEAT} -i -s -- $(repeats) $(TIME) -a -o times.log ./${<} … … 49 65 @ echo -e "${<}: SUCCESS\n" 50 66 51 ${REPEAT}: 67 ${REPEAT}: ${abs_top_srcdir}/tools/Makefile 52 68 @+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
r1057e3d ree163895 452 452 preempt = 10ul\`ms 453 453 debug = -debug 454 type = LONG 454 455 REPEAT = ${abs_top_srcdir}/tools/repeat 456 WATCHDOG = ${abs_top_srcdir}/tools/watchdog 455 457 TIME = /usr/bin/time -f "%E" 456 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} - DLONG_TEST458 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} -I.. -I. -DTEST_$(shell echo $(type) | tr a-z A-Z) 457 459 TESTS = block coroutine create disjoint enter enter3 processor stack wait yield 458 460 all: all-am … … 873 875 874 876 875 .INTERMEDIATE: ${TESTS}877 # .INTERMEDIATE: ${TESTS} 876 878 877 879 all-local: ${TESTS:=.run} 880 881 runall : ${TESTS:=.run} 882 @ echo "All programs terminated normally" 883 884 watchall : ${TESTS:=.watch} 885 @ echo "All programs terminated normally" 886 887 compileall : ${TESTS} 888 @ echo "Compiled" 878 889 879 890 clean-local: … … 888 899 @ echo -e "${<}: SUCCESS\n" 889 900 901 %.watch : % ${WATCHDOG} 902 @ time ${WATCHDOG} ./${<} 903 @ rm ${<} 904 @ echo -e "${<}: SUCCESS\n" 905 890 906 %.time : % ${REPEAT} 891 907 @ ${REPEAT} -i -s -- $(repeats) $(TIME) -a -o times.log ./${<} … … 893 909 @ echo -e "${<}: SUCCESS\n" 894 910 895 ${REPEAT}: 911 ${REPEAT}: ${abs_top_srcdir}/tools/Makefile 912 @+make -C ${abs_top_srcdir}/tools/ 913 914 ${WATCHDOG}: ${abs_top_srcdir}/tools/Makefile 896 915 @+make -C ${abs_top_srcdir}/tools/ 897 916 -
src/tests/preempt_longrun/create.c
r1057e3d ree163895 2 2 #include <thread> 3 3 #include <time> 4 5 #include "long_tests.h" 4 6 5 7 #ifndef PREEMPTION_RATE … … 19 21 int main(int argc, char* argv[]) { 20 22 processor p; 21 for(int i = 0; i < N; i++) {23 for(int i = 0; TEST(i < N); i++) { 22 24 worker_t w[7]; 25 KICK_WATCHDOG; 23 26 } 24 27 } -
src/tests/preempt_longrun/enter.c
r1057e3d ree163895 3 3 #include <thread> 4 4 #include <time> 5 6 #include "long_tests.h" 5 7 6 8 #ifndef PREEMPTION_RATE … … 15 17 16 18 monitor mon_t {}; 17 void foo( mon_t & mutex this ) {} 19 void foo( mon_t & mutex this ) { 20 KICK_WATCHDOG; 21 } 18 22 19 23 mon_t mon; 20 24 thread worker_t {}; 21 25 void main( worker_t & this ) { 22 for( unsigned long i = 0; i < N; i++ ) {26 for( unsigned long i = 0; TEST(i < N); i++ ) { 23 27 foo( mon ); 24 28 } -
src/tests/preempt_longrun/enter3.c
r1057e3d ree163895 3 3 #include <thread> 4 4 #include <time> 5 6 #include "long_tests.h" 5 7 6 8 #ifndef PREEMPTION_RATE … … 18 20 mon_t mon1, mon2, mon3; 19 21 20 void foo( mon_t & mutex a, mon_t & mutex b, mon_t & mutex c ) {} 22 void foo( mon_t & mutex a, mon_t & mutex b, mon_t & mutex c ) { 23 KICK_WATCHDOG; 24 } 21 25 22 26 thread worker_t {}; 23 27 24 28 void main( worker_t & this ) { 25 for( unsigned long i = 0; i < N; i++ ) {29 for( unsigned long i = 0; TEST(i < N); i++ ) { 26 30 foo( mon1, mon2, mon3 ); 27 31 } -
src/tests/preempt_longrun/processor.c
r1057e3d ree163895 4 4 5 5 #include <unistd.h> 6 7 #include "long_tests.h" 6 8 7 9 #ifndef PREEMPTION_RATE … … 17 19 int main(int argc, char* argv[]) { 18 20 processor * p[15]; 19 write(STDOUT_FILENO, "Preparing\n", sizeof("Preparing\n"));20 21 for ( int pi = 0; pi < 15; pi++ ) { 21 22 p[pi] = new(); 22 23 } 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++) { 25 25 int pi = i % 15; 26 26 delete( p[pi] ); 27 27 p[pi] = new(); 28 KICK_WATCHDOG; 28 29 } 29 write(STDOUT_FILENO, "Stopping\n", sizeof("Stopping\n"));30 30 for ( int pi = 0; pi < 15; pi++ ) { 31 31 delete( p[pi] ); 32 32 } 33 write(STDOUT_FILENO, "Done\n", sizeof("Done\n"));34 33 } -
src/tests/preempt_longrun/stack.c
r1057e3d ree163895 3 3 #include <thread> 4 4 #include <time> 5 6 #include "long_tests.h" 5 7 6 8 #ifndef PREEMPTION_RATE … … 18 20 volatile long long a = 326_417ul; 19 21 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++) { 21 23 n *= a; 22 24 n %= p; 25 KICK_WATCHDOG; 23 26 } 24 27 25 if( n != a) {28 if( !TEST(n == a) ) { 26 29 abort(); 27 30 } -
src/tests/preempt_longrun/yield.c
r1057e3d ree163895 2 2 #include <thread> 3 3 #include <time> 4 5 #include "long_tests.h" 4 6 5 7 #ifndef PREEMPTION_RATE … … 11 13 } 12 14 13 #ifdef LONG_TEST15 #ifdef TEST_LONG 14 16 static const unsigned long N = 9_750_000ul; 15 17 #else … … 20 22 21 23 void main(worker_t & this) { 22 for(int i = 0; i < N; i++) {24 for(int i = 0; TEST(i < N); i++) { 23 25 yield(); 26 KICK_WATCHDOG; 24 27 } 25 28 } -
tools/Makefile.am
r1057e3d ree163895 18 18 CFLAGS = -Wall -Wextra -O2 -g 19 19 20 noinst_PROGRAMS = busy catchsig repeat 20 noinst_PROGRAMS = busy catchsig repeat watchdog 21 21 22 22 busy_SOURCES = busy.c … … 24 24 catchsig_SOURCES = catchsig.c 25 25 repeat_SOURCES = repeat.c 26 watchdog_SOURCES = watchdog.c -
tools/Makefile.in
r1057e3d ree163895 92 92 build_triplet = @build@ 93 93 host_triplet = @host@ 94 noinst_PROGRAMS = busy$(EXEEXT) catchsig$(EXEEXT) repeat$(EXEEXT) 94 noinst_PROGRAMS = busy$(EXEEXT) catchsig$(EXEEXT) repeat$(EXEEXT) \ 95 watchdog$(EXEEXT) 95 96 subdir = tools 96 97 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 … … 115 116 repeat_OBJECTS = $(am_repeat_OBJECTS) 116 117 repeat_LDADD = $(LDADD) 118 am_watchdog_OBJECTS = watchdog.$(OBJEXT) 119 watchdog_OBJECTS = $(am_watchdog_OBJECTS) 120 watchdog_LDADD = $(LDADD) 117 121 AM_V_P = $(am__v_P_@AM_V@) 118 122 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) … … 143 147 am__v_CCLD_0 = @echo " CCLD " $@; 144 148 am__v_CCLD_1 = 145 SOURCES = $(busy_SOURCES) $(catchsig_SOURCES) $(repeat_SOURCES) 146 DIST_SOURCES = $(busy_SOURCES) $(catchsig_SOURCES) $(repeat_SOURCES) 149 SOURCES = $(busy_SOURCES) $(catchsig_SOURCES) $(repeat_SOURCES) \ 150 $(watchdog_SOURCES) 151 DIST_SOURCES = $(busy_SOURCES) $(catchsig_SOURCES) $(repeat_SOURCES) \ 152 $(watchdog_SOURCES) 147 153 am__can_run_installinfo = \ 148 154 case $$AM_UPDATE_INFO_DIR in \ … … 295 301 catchsig_SOURCES = catchsig.c 296 302 repeat_SOURCES = repeat.c 303 watchdog_SOURCES = watchdog.c 297 304 all: all-am 298 305 … … 344 351 $(AM_V_CCLD)$(LINK) $(repeat_OBJECTS) $(repeat_LDADD) $(LIBS) 345 352 353 watchdog$(EXEEXT): $(watchdog_OBJECTS) $(watchdog_DEPENDENCIES) $(EXTRA_watchdog_DEPENDENCIES) 354 @rm -f watchdog$(EXEEXT) 355 $(AM_V_CCLD)$(LINK) $(watchdog_OBJECTS) $(watchdog_LDADD) $(LIBS) 356 346 357 mostlyclean-compile: 347 358 -rm -f *.$(OBJEXT) … … 353 364 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/catchsig.Po@am__quote@ 354 365 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/repeat.Po@am__quote@ 366 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/watchdog.Po@am__quote@ 355 367 356 368 .c.o:
Note: See TracChangeset
for help on using the changeset viewer.