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