- Timestamp:
- Feb 8, 2022, 11:53:13 AM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- cc7bbe6
- Parents:
- 97c215f (diff), 1cf8a9f (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:
- tests
- Files:
-
- 2 added
- 6 edited
-
concurrent/.expect/ctor-check.txt (modified) (1 diff)
-
concurrent/.expect/preempt2.txt (added)
-
concurrent/mutexstmt/.expect/locks.txt (modified) (1 diff)
-
concurrent/mutexstmt/locks.cfa (modified) (3 diffs)
-
concurrent/preempt.cfa (modified) (3 diffs)
-
concurrent/preempt2.cfa (added)
-
include/.expect/includes.nast.txt (modified) (1 diff)
-
include/includes.cfa (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/.expect/ctor-check.txt
r97c215f rf5a51db 2 2 ?{}: function 3 3 ... with parameters 4 lvalue reference to instance of struct Empty with body4 this: lvalue reference to instance of struct Empty with body 5 5 ... returning nothing 6 6 with body -
tests/concurrent/mutexstmt/.expect/locks.txt
r97c215f rf5a51db 3 3 Start Test: multi lock deadlock/mutual exclusion 4 4 End Test: multi lock deadlock/mutual exclusion 5 Start Test: single scoped lock mutual exclusion 6 End Test: single scoped lock mutual exclusion 7 Start Test: multi scoped lock deadlock/mutual exclusion 8 End Test: multi scoped lock deadlock/mutual exclusion -
tests/concurrent/mutexstmt/locks.cfa
r97c215f rf5a51db 59 59 } 60 60 61 thread T_Mutex_Scoped {}; 61 62 63 void main( T_Mutex_Scoped & this ) { 64 for (unsigned int i = 0; i < num_times; i++) { 65 { 66 scoped_lock(single_acquisition_lock) s{m1}; 67 count++; 68 } 69 { 70 scoped_lock(single_acquisition_lock) s{m1}; 71 assert(!insideFlag); 72 insideFlag = true; 73 assert(insideFlag); 74 insideFlag = false; 75 } 76 } 77 } 78 79 thread T_Multi_Scoped {}; 80 81 void main( T_Multi_Scoped & this ) { 82 for (unsigned int i = 0; i < num_times; i++) { 83 { 84 scoped_lock(single_acquisition_lock) s{m1}; 85 assert(!insideFlag); 86 insideFlag = true; 87 assert(insideFlag); 88 insideFlag = false; 89 } 90 { 91 scoped_lock(single_acquisition_lock) s1{m1}; 92 scoped_lock(single_acquisition_lock) s2{m2}; 93 scoped_lock(single_acquisition_lock) s3{m3}; 94 scoped_lock(single_acquisition_lock) s4{m4}; 95 scoped_lock(single_acquisition_lock) s5{m5}; 96 assert(!insideFlag); 97 insideFlag = true; 98 assert(insideFlag); 99 insideFlag = false; 100 } 101 { 102 scoped_lock(single_acquisition_lock) s1{m1}; 103 scoped_lock(single_acquisition_lock) s3{m3}; 104 assert(!insideFlag); 105 insideFlag = true; 106 assert(insideFlag); 107 insideFlag = false; 108 } 109 { 110 scoped_lock(single_acquisition_lock) s1{m1}; 111 scoped_lock(single_acquisition_lock) s2{m2}; 112 scoped_lock(single_acquisition_lock) s4{m4}; 113 assert(!insideFlag); 114 insideFlag = true; 115 assert(insideFlag); 116 insideFlag = false; 117 } 118 { 119 scoped_lock(single_acquisition_lock) s1{m1}; 120 scoped_lock(single_acquisition_lock) s3{m3}; 121 scoped_lock(single_acquisition_lock) s4{m4}; 122 scoped_lock(single_acquisition_lock) s5{m5}; 123 assert(!insideFlag); 124 insideFlag = true; 125 assert(insideFlag); 126 insideFlag = false; 127 } 128 } 129 } 130 131 int num_tasks = 10; 62 132 int main() { 63 133 processor p[10]; … … 67 137 T_Mutex t[10]; 68 138 } 139 assert(count == num_tasks * num_times); 69 140 printf("End Test: single lock mutual exclusion\n"); 70 141 printf("Start Test: multi lock deadlock/mutual exclusion\n"); … … 73 144 } 74 145 printf("End Test: multi lock deadlock/mutual exclusion\n"); 146 147 count = 0; 148 printf("Start Test: single scoped lock mutual exclusion\n"); 149 { 150 T_Mutex_Scoped t[10]; 151 } 152 assert(count == num_tasks * num_times); 153 printf("End Test: single scoped lock mutual exclusion\n"); 154 printf("Start Test: multi scoped lock deadlock/mutual exclusion\n"); 155 { 156 T_Multi_Scoped t[10]; 157 } 158 printf("End Test: multi scoped lock deadlock/mutual exclusion\n"); 75 159 } -
tests/concurrent/preempt.cfa
r97c215f rf5a51db 1 #include <clock.hfa> 2 #include <fstream.hfa> 1 3 #include <kernel.hfa> 2 4 #include <thread.hfa> … … 21 23 extern void __cfaabi_check_preemption(); 22 24 23 static volatile int counter = 0; 25 static struct { 26 volatile int counter; 27 volatile Time prev; 28 Duration durations[6]; 29 } globals; 24 30 25 31 thread worker_t { 26 32 int value; 33 unsigned long long spin; 27 34 }; 28 35 29 36 void ?{}( worker_t & this, int value ) { 30 37 this.value = value; 38 this.spin = 0; 31 39 } 32 40 33 41 void main(worker_t & this) { 34 while(TEST(counter < N)) { 42 while(TEST(globals.counter < N)) { 43 if(this.spin > 50_000_000_000) abort | "Worker" | this.value | "has been spinning too long! (" | this.spin | ")"; 35 44 __cfaabi_check_preemption(); 36 if( ( counter % 7) == this.value ) {45 if( (globals.counter % 7) == this.value ) { 37 46 __cfaabi_check_preemption(); 38 int next = __atomic_add_fetch( &counter, 1, __ATOMIC_SEQ_CST ); 47 #if !defined(TEST_LONG) 48 Time now = timeHiRes(); 49 Duration diff = now - globals.prev; 50 globals.prev = now; 51 #endif 52 int next = __atomic_add_fetch( &globals.counter, 1, __ATOMIC_SEQ_CST ); 39 53 __cfaabi_check_preemption(); 40 if( (next % 100) == 0 ) printf("%d\n", (int)next); 54 if( (next % 100) == 0 ) { 55 #if !defined(TEST_LONG) 56 unsigned idx = next / 100; 57 if (idx >= 6) abort | "Idx from next is invalid: " | idx | "vs" | next; 58 globals.durations[idx] = diff; 59 if(diff > 12`s) serr | "Duration suspiciously large:" | diff; 60 #endif 61 printf("%d\n", (int)next); 62 63 } 41 64 __cfaabi_check_preemption(); 65 this.spin = 0; 42 66 } 43 67 __cfaabi_check_preemption(); 44 68 KICK_WATCHDOG; 69 this.spin++; 45 70 } 46 71 } … … 48 73 int main(int argc, char* argv[]) { 49 74 processor p; 75 globals.counter = 0; 76 globals.durations[0] = 0; 77 globals.durations[1] = 0; 78 globals.durations[2] = 0; 79 globals.durations[3] = 0; 80 globals.durations[4] = 0; 81 globals.durations[5] = 0; 50 82 { 83 globals.prev = timeHiRes(); 51 84 worker_t w0 = 0; 52 85 worker_t w1 = 1; -
tests/include/.expect/includes.nast.txt
r97c215f rf5a51db 1 include/includes.cfa:15 4:25: warning: Compiled1 include/includes.cfa:153:25: warning: Compiled -
tests/include/includes.cfa
r97c215f rf5a51db 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jun 5 10:06:46 202113 // Update Count : 7 5112 // Last Modified On : Thu Feb 3 22:06:07 2022 13 // Update Count : 774 14 14 // 15 15 … … 18 18 #endif // __CFA__ 19 19 20 #if 1 20 21 //#define _GNU_SOURCE 21 22 #include <aio.h> … … 40 41 #include <errno.h> 41 42 #include <error.h> 42 //#include <eti.h> // may not be installed, comes with ncurses43 //#include <eti.h> // may not be installed, comes with ncurses 43 44 #include <execinfo.h> 44 45 #include <expat.h> … … 49 50 #include <fmtmsg.h> 50 51 #include <fnmatch.h> 51 //#include <form.h> // may not be installed, comes with ncurses52 //#include <form.h> // may not be installed, comes with ncurses 52 53 #include <fstab.h> 53 54 #include <fts.h> … … 77 78 #include <mcheck.h> 78 79 #include <memory.h> 79 //#include <menu.h> // may not be installed, comes with ncurses80 //#include <menu.h> // may not be installed, comes with ncurses 80 81 #include <mntent.h> 81 82 #include <monetary.h> 82 83 #include <mqueue.h> 83 //#include <ncurses_dll.h> // may not be installed, comes with ncurses84 //#include <ncurses_dll.h> // may not be installed, comes with ncurses 84 85 #include <netdb.h> 85 86 #include <nl_types.h> 86 87 #include <nss.h> 87 88 #include <obstack.h> 88 //#include <panel.h> // may not be installed, comes with ncurses89 //#include <panel.h> // may not be installed, comes with ncurses 89 90 #include <paths.h> 90 91 #include <poll.h> … … 117 118 #include <syslog.h> 118 119 #include <tar.h> 119 //#include <term.h> // may not be installed, comes with ncurses120 //#include <termcap.h> // may not be installed, comes with ncurses120 //#include <term.h> // may not be installed, comes with ncurses 121 //#include <termcap.h> // may not be installed, comes with ncurses 121 122 #include <termio.h> 122 123 #include <termios.h> … … 130 131 #include <ucontext.h> 131 132 #include <ulimit.h> 132 //#include <unctrl.h> // may not be installed, comes with ncurses133 //#include <unctrl.h> // may not be installed, comes with ncurses 133 134 #include <unistd.h> 134 135 #include <utime.h> … … 143 144 #include <wctype.h> 144 145 #include <wordexp.h> 145 146 #if 0147 146 #endif // 0 148 147 … … 151 150 #endif // __CFA__ 152 151 153 int main( int argc, char const * argv[] ) {154 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!!152 int main( int argc, char const * argv[] ) { 153 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 155 154 } 156 155
Note:
See TracChangeset
for help on using the changeset viewer.