- Timestamp:
- Jun 20, 2018, 8:42:37 AM (8 years ago)
- 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:
- 4439008
- Parents:
- e04aec4 (diff), 270fdcf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- src/tests
- Files:
-
- 2 added
- 16 edited
-
.gitignore (modified) (1 diff)
-
Makefile.am (modified) (1 diff)
-
Makefile.in (modified) (1 diff)
-
concurrent/coroutineYield.c (modified) (4 diffs)
-
concurrent/preempt.c (modified) (4 diffs)
-
concurrent/signal/block.c (modified) (3 diffs)
-
concurrent/signal/disjoint.c (modified) (5 diffs)
-
concurrent/signal/wait.c (modified) (6 diffs)
-
long_tests.h (added)
-
preempt_longrun/Makefile.am (modified) (3 diffs)
-
preempt_longrun/Makefile.in (modified) (4 diffs)
-
preempt_longrun/create.c (modified) (2 diffs)
-
preempt_longrun/enter.c (modified) (2 diffs)
-
preempt_longrun/enter3.c (modified) (2 diffs)
-
preempt_longrun/processor.c (modified) (2 diffs)
-
preempt_longrun/stack.c (modified) (2 diffs)
-
preempt_longrun/update-type (added)
-
preempt_longrun/yield.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/tests/.gitignore
re04aec4 rdb4062d 1 1 .out/ 2 2 .err/ 3 .type -
src/tests/Makefile.am
re04aec4 rdb4062d 28 28 DEBUG_FLAGS = 29 29 30 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ 30 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -I. 31 31 if !BUILD_DEBUG 32 32 BUILD_FLAGS += -nodebug -
src/tests/Makefile.in
re04aec4 rdb4062d 309 309 # applies to both programs 310 310 DEBUG_FLAGS = 311 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ \311 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -I. \ 312 312 $(am__append_1) $(am__append_2) $(am__append_3) 313 313 TEST_FLAGS = $(if $(test), 2> $(test), ) -
src/tests/concurrent/coroutineYield.c
re04aec4 rdb4062d 4 4 #include <thread> 5 5 #include <time> 6 7 #define __kick_rate 150000ul 8 #include "long_tests.h" 6 9 7 10 #ifndef PREEMPTION_RATE … … 13 16 } 14 17 15 #ifdef LONG_TEST18 #ifdef TEST_LONG 16 19 static const unsigned long N = 600_000ul; 17 20 #else … … 23 26 void main(Coroutine& this) { 24 27 while(true) { 25 sout | "Coroutine 1" | endl; 28 #if !defined(TEST_FOREVER) 29 sout | "Coroutine 1" | endl; 30 #endif 26 31 yield(); 27 sout | "Coroutine 2" | endl; 32 #if !defined(TEST_FOREVER) 33 sout | "Coroutine 2" | endl; 34 #endif 28 35 suspend(); 29 36 } … … 33 40 int main(int argc, char* argv[]) { 34 41 Coroutine c; 35 for(int i = 0; i < N; i++) { 36 sout | "Thread 1" | endl; 42 for(int i = 0; TEST(i < N); i++) { 43 #if !defined(TEST_FOREVER) 44 sout | "Thread 1" | endl; 45 #endif 37 46 resume(c); 38 sout | "Thread 2" | endl; 47 #if !defined(TEST_FOREVER) 48 sout | "Thread 2" | endl; 49 #endif 39 50 yield(); 51 KICK_WATCHDOG; 40 52 } 41 53 } -
src/tests/concurrent/preempt.c
re04aec4 rdb4062d 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
re04aec4 rdb4062d 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
re04aec4 rdb4062d 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 … … 67 69 } 68 70 69 d.counter++; 71 #if !defined(TEST_FOREVER) 72 d.counter++; 73 if( (d.counter % 1000) == 0 ) sout | d.counter | endl; 74 #endif 70 75 71 if( (d.counter % 1000) == 0 ) sout | d.counter | endl; 72 73 return d.counter < N; 76 return TEST(d.counter < N); 74 77 } 75 78 … … 77 80 78 81 void main( Waiter & this ) { 79 while( wait( mut, data ) ) { yield(); }82 while( wait( mut, data ) ) { KICK_WATCHDOG; yield(); } 80 83 } 81 84 … … 94 97 95 98 //This is technically a mutual exclusion violation but the mutex monitor protects us 96 bool running = data.counter < N&& data.counter > 0;99 bool running = TEST(data.counter < N) && data.counter > 0; 97 100 if( data.state != SIGNAL && running ) { 98 101 sout | "ERROR Eager signal" | data.state | endl; -
src/tests/concurrent/signal/wait.c
re04aec4 rdb4062d 12 12 #include <time> 13 13 14 #define __kick_rate 12000ul 15 #include "long_tests.h" 16 14 17 #ifndef PREEMPTION_RATE 15 18 #define PREEMPTION_RATE 10`ms … … 20 23 } 21 24 22 #ifdef LONG_TEST25 #ifdef TEST_LONG 23 26 static const unsigned long N = 375_000ul; 24 27 #else … … 90 93 // Waiter ABC 91 94 void main( WaiterABC & this ) { 92 for( int i = 0; i < N; i++ ) {95 for( int i = 0; TEST(i < N); i++ ) { 93 96 wait( condABC, globalA, globalB, globalC ); 97 KICK_WATCHDOG; 94 98 } 95 99 … … 100 104 // Waiter AB 101 105 void main( WaiterAB & this ) { 102 for( int i = 0; i < N; i++ ) {106 for( int i = 0; TEST(i < N); i++ ) { 103 107 wait( condAB , globalA, globalB ); 108 KICK_WATCHDOG; 104 109 } 105 110 … … 110 115 // Waiter AC 111 116 void main( WaiterAC & this ) { 112 for( int i = 0; i < N; i++ ) {117 for( int i = 0; TEST(i < N); i++ ) { 113 118 wait( condAC , globalA, globalC ); 119 KICK_WATCHDOG; 114 120 } 115 121 … … 120 126 // Waiter BC 121 127 void main( WaiterBC & this ) { 122 for( int i = 0; i < N; i++ ) {128 for( int i = 0; TEST(i < N); i++ ) { 123 129 wait( condBC , globalB, globalC ); 130 KICK_WATCHDOG; 124 131 } 125 132 -
src/tests/preempt_longrun/Makefile.am
re04aec4 rdb4062d 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_TEST 27 # $(shell ./update-type $(type)) 28 # ./update-type $(type) 29 30 UPDATED_TYPE = $(shell ./update-type $(type)) 31 32 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} -I.. -I. -DTEST_$(shell cat .type | tr a-z A-Z) 26 33 CFLAGS = ${BUILD_FLAGS} 27 34 CC = @CFA_BINDIR@/@CFA_NAME@ … … 29 36 TESTS = block coroutine create disjoint enter enter3 processor stack wait yield 30 37 31 .INTERMEDIATE: ${TESTS}38 # .INTERMEDIATE: ${TESTS} 32 39 33 40 all-local: ${TESTS:=.run} 34 41 42 runall : ${TESTS:=.run} 43 @ echo "All programs terminated normally" 44 45 watchall : ${TESTS:=.watch} 46 @ echo "All programs terminated normally" 47 48 compileall : ${TESTS} 49 @ echo "Compiled" 50 35 51 clean-local: 36 rm -f ${TESTS} core* out.log 52 rm -f ${TESTS} core* out.log .type 37 53 38 % : %.c ${CC} 54 % : %.c ${CC} ${UPDATED_TYPE} 39 55 ${AM_V_GEN}${CC} ${CFLAGS} ${<} $(debug) -o ${@} 40 56 41 57 %.run : % ${REPEAT} 42 58 @ time ${REPEAT} -r out.log -i -s $(repeats) timeout ${max_time} ./${<} 59 @ rm ${<} 60 @ echo -e "${<}: SUCCESS\n" 61 62 %.watch : % ${WATCHDOG} 63 @ time ${WATCHDOG} ./${<} 43 64 @ rm ${<} 44 65 @ echo -e "${<}: SUCCESS\n" … … 49 70 @ echo -e "${<}: SUCCESS\n" 50 71 51 ${REPEAT}: 72 ${REPEAT}: ${abs_top_srcdir}/tools/Makefile 52 73 @+make -C ${abs_top_srcdir}/tools/ 74 75 ${WATCHDOG}: ${abs_top_srcdir}/tools/Makefile 76 @+make -C ${abs_top_srcdir}/tools/ -
src/tests/preempt_longrun/Makefile.in
re04aec4 rdb4062d 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_TEST 458 459 # $(shell ./update-type $(type)) 460 # ./update-type $(type) 461 UPDATED_TYPE = $(shell ./update-type $(type)) 462 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} -I.. -I. -DTEST_$(shell cat .type | tr a-z A-Z) 457 463 TESTS = block coroutine create disjoint enter enter3 processor stack wait yield 458 464 all: all-am … … 873 879 874 880 875 .INTERMEDIATE: ${TESTS}881 # .INTERMEDIATE: ${TESTS} 876 882 877 883 all-local: ${TESTS:=.run} 878 884 885 runall : ${TESTS:=.run} 886 @ echo "All programs terminated normally" 887 888 watchall : ${TESTS:=.watch} 889 @ echo "All programs terminated normally" 890 891 compileall : ${TESTS} 892 @ echo "Compiled" 893 879 894 clean-local: 880 rm -f ${TESTS} core* out.log 881 882 % : %.c ${CC} 895 rm -f ${TESTS} core* out.log .type 896 897 % : %.c ${CC} ${UPDATED_TYPE} 883 898 ${AM_V_GEN}${CC} ${CFLAGS} ${<} $(debug) -o ${@} 884 899 … … 888 903 @ echo -e "${<}: SUCCESS\n" 889 904 905 %.watch : % ${WATCHDOG} 906 @ time ${WATCHDOG} ./${<} 907 @ rm ${<} 908 @ echo -e "${<}: SUCCESS\n" 909 890 910 %.time : % ${REPEAT} 891 911 @ ${REPEAT} -i -s -- $(repeats) $(TIME) -a -o times.log ./${<} … … 893 913 @ echo -e "${<}: SUCCESS\n" 894 914 895 ${REPEAT}: 915 ${REPEAT}: ${abs_top_srcdir}/tools/Makefile 916 @+make -C ${abs_top_srcdir}/tools/ 917 918 ${WATCHDOG}: ${abs_top_srcdir}/tools/Makefile 896 919 @+make -C ${abs_top_srcdir}/tools/ 897 920 -
src/tests/preempt_longrun/create.c
re04aec4 rdb4062d 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
re04aec4 rdb4062d 3 3 #include <thread> 4 4 #include <time> 5 6 #define __kick_rate 75000ul 7 #include "long_tests.h" 5 8 6 9 #ifndef PREEMPTION_RATE … … 15 18 16 19 monitor mon_t {}; 17 void foo( mon_t & mutex this ) {} 20 void foo( mon_t & mutex this ) { 21 KICK_WATCHDOG; 22 } 18 23 19 24 mon_t mon; 20 25 thread worker_t {}; 21 26 void main( worker_t & this ) { 22 for( unsigned long i = 0; i < N; i++ ) {27 for( unsigned long i = 0; TEST(i < N); i++ ) { 23 28 foo( mon ); 24 29 } -
src/tests/preempt_longrun/enter3.c
re04aec4 rdb4062d 3 3 #include <thread> 4 4 #include <time> 5 6 #define __kick_rate 75000ul 7 #include "long_tests.h" 5 8 6 9 #ifndef PREEMPTION_RATE … … 18 21 mon_t mon1, mon2, mon3; 19 22 20 void foo( mon_t & mutex a, mon_t & mutex b, mon_t & mutex c ) {} 23 void foo( mon_t & mutex a, mon_t & mutex b, mon_t & mutex c ) { 24 KICK_WATCHDOG; 25 } 21 26 22 27 thread worker_t {}; 23 28 24 29 void main( worker_t & this ) { 25 for( unsigned long i = 0; i < N; i++ ) {30 for( unsigned long i = 0; TEST(i < N); i++ ) { 26 31 foo( mon1, mon2, mon3 ); 27 32 } -
src/tests/preempt_longrun/processor.c
re04aec4 rdb4062d 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
re04aec4 rdb4062d 3 3 #include <thread> 4 4 #include <time> 5 6 #define __kick_rate 5000000ul 7 #include "long_tests.h" 5 8 6 9 #ifndef PREEMPTION_RATE … … 15 18 16 19 void main(worker_t & this) { 17 volatile long long p = 5_021_609ul; 18 volatile long long a = 326_417ul; 19 volatile long long n = 1l; 20 for (volatile long long i = 0; i < p; i++) { 21 n *= a; 22 n %= p; 23 } 20 while(TEST(0)) { 21 volatile long long p = 5_021_609ul; 22 volatile long long a = 326_417ul; 23 volatile long long n = 1l; 24 for (volatile long long i = 0; i < p; i++) { 25 n *= a; 26 n %= p; 27 KICK_WATCHDOG; 28 } 24 29 25 if( n != a ) { 26 abort(); 30 if( !TEST(n == a) ) { 31 abort(); 32 } 27 33 } 28 34 } -
src/tests/preempt_longrun/yield.c
re04aec4 rdb4062d 2 2 #include <thread> 3 3 #include <time> 4 5 #define __kick_rate 550000ul 6 #include "long_tests.h" 4 7 5 8 #ifndef PREEMPTION_RATE … … 11 14 } 12 15 13 #ifdef LONG_TEST16 #ifdef TEST_LONG 14 17 static const unsigned long N = 9_750_000ul; 15 18 #else … … 20 23 21 24 void main(worker_t & this) { 22 for(int i = 0; i < N; i++) {25 for(int i = 0; TEST(i < N); i++) { 23 26 yield(); 27 KICK_WATCHDOG; 24 28 } 25 29 }
Note:
See TracChangeset
for help on using the changeset viewer.