diff --git a/lingua-franca b/lingua-franca index 53c0d4b13..e2ed34ecb 160000 --- a/lingua-franca +++ b/lingua-franca @@ -1 +1 @@ -Subproject commit 53c0d4b13a02248c4f0075256e997bcd428893ba +Subproject commit e2ed34ecbe5b93d4404b54ab6a8c15e7c21f1f52 diff --git a/test/known-good/C/src/ActionDelay.html b/test/known-good/C/src/ActionDelay.html index d9401929a..732fd75b4 100644 --- a/test/known-good/C/src/ActionDelay.html +++ b/test/known-good/C/src/ActionDelay.html @@ -468,7 +468,43 @@ " -Logical, physical, and elapsed logical: %lld %lld %lld. +Logical, physical, and elapsed logical: + + +" + + + PRINTF_TIME + + +" + + + + + +" + + + PRINTF_TIME + + +" + + + + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -515,7 +551,31 @@ " -FAILURE: Expected %lld but got %lld. +FAILURE: Expected + + +" + + + PRINTF_TIME + + +" + + + but got + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/ActionWithNoReaction.html b/test/known-good/C/src/ActionWithNoReaction.html index c2a854935..1d2ec8863 100644 --- a/test/known-good/C/src/ActionWithNoReaction.html +++ b/test/known-good/C/src/ActionWithNoReaction.html @@ -311,7 +311,16 @@ " -Current logical time is: %lld +Current logical time is: + + +" + + + PRINTF_TIME + + +" \n @@ -330,7 +339,16 @@ " -Current physical time is: %lld +Current physical time is: + + +" + + + PRINTF_TIME + + +" \n diff --git a/test/known-good/C/src/After.html b/test/known-good/C/src/After.html index a550aa10c..e6efbdc53 100644 --- a/test/known-good/C/src/After.html +++ b/test/known-good/C/src/After.html @@ -417,7 +417,16 @@ " -Current logical time is: %lld +Current logical time is: + + +" + + + PRINTF_TIME + + +" \n @@ -436,7 +445,16 @@ " -Current physical time is: %lld +Current physical time is: + + +" + + + PRINTF_TIME + + +" \n @@ -471,7 +489,19 @@ " -ERROR: Expected logical time to be %lld. +ERROR: Expected logical time to be + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/AfterCycles.html b/test/known-good/C/src/AfterCycles.html index fba467302..4cd6f0b84 100644 --- a/test/known-good/C/src/AfterCycles.html +++ b/test/known-good/C/src/AfterCycles.html @@ -527,7 +527,19 @@ " -Received %d from worker 0 at time %lld. +Received %d from worker 0 at time + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -742,7 +754,19 @@ " -Received %d from worker 1 at time %lld. +Received %d from worker 1 at time + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/AfterOverlapped.html b/test/known-good/C/src/AfterOverlapped.html index dc538509a..044a17de1 100644 --- a/test/known-good/C/src/AfterOverlapped.html +++ b/test/known-good/C/src/AfterOverlapped.html @@ -357,7 +357,16 @@ " -Current logical time is: %lld +Current logical time is: + + +" + + + PRINTF_TIME + + +" \n @@ -442,7 +451,28 @@ " -ERROR: Expected logical time to be %lld but got %lld +ERROR: Expected logical time to be + + +" + + + PRINTF_TIME + + +" + + + but got + + +" + + + PRINTF_TIME + + +" \n diff --git a/test/known-good/C/src/AfterZero.html b/test/known-good/C/src/AfterZero.html index fb42cb6c2..14ef47004 100644 --- a/test/known-good/C/src/AfterZero.html +++ b/test/known-good/C/src/AfterZero.html @@ -136,7 +136,7 @@ - SET(y, + lf_set(y, 2 @@ -411,7 +411,16 @@ " -Current logical time is: %lld +Current logical time is: + + +" + + + PRINTF_TIME + + +" \n @@ -430,7 +439,16 @@ " -Current microstep is: %lld +Current microstep is: + + +" + + + PRINTF_TIME + + +" \n @@ -455,7 +473,16 @@ " -Current physical time is: %lld +Current physical time is: + + +" + + + PRINTF_TIME + + +" \n @@ -490,7 +517,19 @@ " -ERROR: Expected logical time to be %lld. +ERROR: Expected logical time to be + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -890,7 +929,7 @@ - SET( + lf_set( f diff --git a/test/known-good/C/src/Alignment.html b/test/known-good/C/src/Alignment.html index dd02753a3..42009b2db 100644 --- a/test/known-good/C/src/Alignment.html +++ b/test/known-good/C/src/Alignment.html @@ -1176,7 +1176,19 @@ " -Destination: Input %d is prime at tag (%lld, %d). +Destination: Input %d is prime at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %d). " @@ -1263,7 +1275,19 @@ " -Invoked at tag (%lld, %d), +Invoked at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %d), " @@ -1276,7 +1300,19 @@ " -but previously invoked at tag (%lld, %d). +but previously invoked at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %d). " diff --git a/test/known-good/C/src/ArrayAsType.html b/test/known-good/C/src/ArrayAsType.html index 46743b433..355568497 100644 --- a/test/known-good/C/src/ArrayAsType.html +++ b/test/known-good/C/src/ArrayAsType.html @@ -178,7 +178,7 @@ - SET_PRESENT(out); + lf_set_present(out); diff --git a/test/known-good/C/src/ArrayFreeMultiple.html b/test/known-good/C/src/ArrayFreeMultiple.html index 9c6c85fbd..4b64facaf 100644 --- a/test/known-good/C/src/ArrayFreeMultiple.html +++ b/test/known-good/C/src/ArrayFreeMultiple.html @@ -258,34 +258,48 @@ - SET_NEW_ARRAY(out, + int + + +* + + + array + + += + + + (int + + +* + + +)malloc( 3 -); + + + +* - - + sizeof(int)); -// Above allocates the array, which then must be populated. +// Populate the array. - out - - --> - - -value[ + array[ 0 @@ -316,13 +330,7 @@ - out - - --> - - -value[ + array[ 1 @@ -353,13 +361,7 @@ - out - - --> - - -value[ + array[ 2 @@ -389,6 +391,23 @@ ; + + + + +// Set the output, specifying the array length. + + + + lf_set_array(out, array, + + +3 + + +); + + diff --git a/test/known-good/C/src/ArrayPrint.html b/test/known-good/C/src/ArrayPrint.html index cfac35269..782a1b523 100644 --- a/test/known-good/C/src/ArrayPrint.html +++ b/test/known-good/C/src/ArrayPrint.html @@ -207,56 +207,49 @@ // Dynamically allocate an output array of length 3. - - + + int - -// Note that the receiving reactors need to know that the length is 3. + +* - - - + + array - -// A better design is given at: + += - - - + + (int - -// https://www.lf-lang.org/docs/handbook/target-language-details?target=c#dynamically-allocated-data + +* - - SET_NEW_ARRAY(out, +)malloc( 3 -); + + + +* - - + sizeof(int)); -// Above allocates the array, which then must be populated. +// Populate the array. - out - - --> - - -value[ + array[ 0 @@ -287,13 +280,7 @@ - out - - --> - - -value[ + array[ 1 @@ -324,13 +311,7 @@ - out - - --> - - -value[ + array[ 2 @@ -360,6 +341,23 @@ ; + + + + +// Set the output, specifying the array length. + + + + lf_set_array(out, array, + + +3 + + +); + + diff --git a/test/known-good/C/src/CompositionInheritance.html b/test/known-good/C/src/CompositionInheritance.html index c0ddb5d1c..6da4fc8dc 100644 --- a/test/known-good/C/src/CompositionInheritance.html +++ b/test/known-good/C/src/CompositionInheritance.html @@ -222,7 +222,19 @@ " -Hello World. At time %lld, my count is: %d. +Hello World. At time + + +" + + + PRINTF_TIME + + +" + + +, my count is: %d. \n @@ -395,7 +407,19 @@ " -At time %lld, source sending %d. +At time + + +" + + + PRINTF_TIME + + +" + + +, source sending %d. \n diff --git a/test/known-good/C/src/DelayArrayWithAfter.html b/test/known-good/C/src/DelayArrayWithAfter.html index 97a752140..ef02057d0 100644 --- a/test/known-good/C/src/DelayArrayWithAfter.html +++ b/test/known-good/C/src/DelayArrayWithAfter.html @@ -186,59 +186,48 @@ - SET_NEW_ARRAY(out, + int - -3 + +* -); + array - - - printf( + += - -" + + (int - -At time %lld, sending array at address %p + +* - -\n + +)malloc( - -" + +3 -, lf_time_logical_elapsed(), out + --> - - -value); +* - - + sizeof(int)); -// Above allocates the array, which then must be populated. +// Populate the array. - out - - --> - - -value[ + array[ 0 @@ -272,13 +261,7 @@ - out - - --> - - -value[ + array[ 1 @@ -312,13 +295,7 @@ - out - - --> - - -value[ + array[ 2 @@ -351,6 +328,23 @@ iteration; + + + + +// Set the output, specifying the array length. + + + + lf_set_array(out, array, + + +3 + + +); + + self @@ -597,7 +591,19 @@ " -At time %lld, received array at address %p +At time + + +" + + + PRINTF_TIME + + +" + + +, received array at address %p \n diff --git a/test/known-good/C/src/DelayInt.html b/test/known-good/C/src/DelayInt.html index fed306174..817416f3b 100644 --- a/test/known-good/C/src/DelayInt.html +++ b/test/known-good/C/src/DelayInt.html @@ -522,7 +522,19 @@ " -After %lld nsec of logical time. +After + + +" + + + PRINTF_TIME + + +" + + + nsec of logical time. \n @@ -551,7 +563,19 @@ " -ERROR: Expected elapsed time to be 100000000. It was %lld. +ERROR: Expected elapsed time to be 100000000. It was + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/DelayString.html b/test/known-good/C/src/DelayString.html index fc4071f9d..deeb2e4e2 100644 --- a/test/known-good/C/src/DelayString.html +++ b/test/known-good/C/src/DelayString.html @@ -424,7 +424,19 @@ " -After %lld nsec of logical time. +After + + +" + + + PRINTF_TIME + + +" + + + nsec of logical time. \n @@ -453,7 +465,19 @@ " -ERROR: Expected elapsed time to be 100000000. It was %lld. +ERROR: Expected elapsed time to be 100000000. It was + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/DelayStruct.html b/test/known-good/C/src/DelayStruct.html index 9738dc127..bc6a8f598 100644 --- a/test/known-good/C/src/DelayStruct.html +++ b/test/known-good/C/src/DelayStruct.html @@ -403,8 +403,33 @@ // Dynamically allocate an output struct. + + + + +// Note that the default destructor and copy constructor are sufficient here. + + + + hello_t + + +* + - SET_NEW(out); + hello + + += + + + (hello_t + + +* + + +)malloc(sizeof(hello_t)); @@ -415,17 +440,11 @@ -// Above allocates a struct, which then must be populated. +// Populate the struct. - out - - --> - - -value + hello -> @@ -453,13 +472,7 @@ - out - - --> - - -value + hello -> @@ -480,6 +493,21 @@ ; + + + + + + + + +// Set the output. + + + + lf_set(out, hello); + + @@ -558,6 +586,40 @@ * + + + + +state + + + + + +invoked + + +: + + + + + +bool + + + + + += + + + + + +false + + @@ -578,6 +640,28 @@ = + + self + + +-> + + +invoked + + += + + + + + +true + + +; + + printf( @@ -698,6 +782,97 @@ } + + + + + + + + +reaction + + +( + + +shutdown + + +) { + + += + + + + if (self + + +-> + + +invoked + + += + + += + + + + + +false + + +) { + + + + fprintf(stderr, + + +" + + +ERROR: No data received. + + +\n + + +" + + +); + + + + exit( + + +2 + + +); + + + + } + + + + + + += + + +} + + } diff --git a/test/known-good/C/src/DelayStructWithAfter.html b/test/known-good/C/src/DelayStructWithAfter.html index 64abdd81b..7bdcc71ed 100644 --- a/test/known-good/C/src/DelayStructWithAfter.html +++ b/test/known-good/C/src/DelayStructWithAfter.html @@ -45,36 +45,8 @@ - -preamble - - - { - - -= - - - - - - -#include "hello.h" - - - -= - - -} - - - - - - - -reactor + +import @@ -83,102 +55,16 @@ Source - { +, - - - - - -output + +Print - -out - - -: - - - - - -hello_t - - -* - - - - - - - - - - -reaction - - -( - - -startup - - -) - - --> - - - out { - - -= - - - - - - -// Dynamically allocate an output struct. - - - - SET_NEW(out); - - - - - - - - - - -// Above allocates a struct, which then must be populated. - - - - out - - --> - - -value - - --> - - -name - - -= + +from @@ -187,254 +73,33 @@ " -Earth +DelayStruct.lf " - -; - - - - out - - --> - - -value - - --> - - -value - - -= - - - - - -42 - - -; - - - - - - -= - - -} - - - -} - - -// expected parameter is for testing. - - - -reactor - - - - - -Print - - -(expected: - - -int - - - - - -= - - - - - -42 - - -) { - - - - - - -input - - - - - -in - - -: - - - - - -hello_t - - -* - - - - - - - - - -reaction - - -( - - -in) { - - -= - - - - printf( - - -" - - -Received: name = %s, value = %d - - -\n - - -" - - -, in - - --> - - -value - - --> - - -name, in - - --> - - -value - - --> - - -value); - - - - if (in - - --> - - -value - - --> +preamble -value ! + { = - - self - - --> - - -expected) { - - - printf( - - -" - - -ERROR: Expected value to be %d. - - -\n - - -" - - -, self - - --> - - -expected); - - - - exit( - - -1 - - -); + + - - - } + +#include "hello.h" - - - = @@ -442,10 +107,6 @@ } - -} - - diff --git a/test/known-good/C/src/DelayStructWithAfterOverlapped.html b/test/known-good/C/src/DelayStructWithAfterOverlapped.html index 59f429f84..c74879b8d 100644 --- a/test/known-good/C/src/DelayStructWithAfterOverlapped.html +++ b/test/known-good/C/src/DelayStructWithAfterOverlapped.html @@ -254,8 +254,33 @@ // Dynamically allocate an output struct. + + + + +// Note that the default destructor and copy constructor are sufficient here. + + - SET_NEW(out); + hello_t + + +* + + + hello + + += + + + (hello_t + + +* + + +)malloc(sizeof(hello_t)); @@ -266,17 +291,11 @@ -// Above allocates a struct, which then must be populated. +// Populate the struct. - out - - --> - - -value + hello -> @@ -304,13 +323,7 @@ - out - - --> - - -value + hello -> @@ -343,6 +356,21 @@ s; + + + + + + + + +// Set the output. + + + + lf_set(out, hello); + + diff --git a/test/known-good/C/src/DelayedAction.html b/test/known-good/C/src/DelayedAction.html index da257c5da..cc31217fc 100644 --- a/test/known-good/C/src/DelayedAction.html +++ b/test/known-good/C/src/DelayedAction.html @@ -241,7 +241,19 @@ " -Nanoseconds since start: %lld. +Nanoseconds since start: + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -260,7 +272,19 @@ " -Physical nanoseconds since start: %lld. +Physical nanoseconds since start: + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -336,7 +360,31 @@ " -Expected %lld but got %lld. +Expected + + +" + + + PRINTF_TIME + + +" + + + but got + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/DelayedReaction.html b/test/known-good/C/src/DelayedReaction.html index b42583d15..dd36f629a 100644 --- a/test/known-good/C/src/DelayedReaction.html +++ b/test/known-good/C/src/DelayedReaction.html @@ -187,7 +187,19 @@ " -Nanoseconds since start: %lld. +Nanoseconds since start: + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/DoublePort.html b/test/known-good/C/src/DoublePort.html index 679a694b9..90305935f 100644 --- a/test/known-good/C/src/DoublePort.html +++ b/test/known-good/C/src/DoublePort.html @@ -441,7 +441,19 @@ " -At tag (%lld, %u), received in = %d and in2 = %d. +At tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u), received in = %d and in2 = %d. \n diff --git a/test/known-good/C/src/GetTime.html b/test/known-good/C/src/GetTime.html index 60458587a..55f8ec555 100644 --- a/test/known-good/C/src/GetTime.html +++ b/test/known-good/C/src/GetTime.html @@ -146,7 +146,19 @@ " -Logical time is %lld. +Logical time is + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -185,7 +197,19 @@ " -Elapsed logical time is %lld. +Elapsed logical time is + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -224,7 +248,19 @@ " -Physical time is %lld. +Physical time is + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -263,7 +299,19 @@ " -Elapsed physical time is %lld. +Elapsed physical time is + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -286,7 +334,19 @@ " -Time lag is %lld. +Time lag is + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/Hello.html b/test/known-good/C/src/Hello.html index 7ab837eed..90402ad90 100644 --- a/test/known-good/C/src/Hello.html +++ b/test/known-good/C/src/Hello.html @@ -381,7 +381,16 @@ " -Current time is %lld +Current time is + + +" + + + PRINTF_TIME + + +" \n @@ -406,7 +415,19 @@ " -Which is %sPlus %lld nanoseconds. +Which is %sPlus + + +" + + + PRINTF_TIME + + +" + + + nanoseconds. \n @@ -492,7 +513,16 @@ " -***** action %d at time %lld +***** action %d at time + + +" + + + PRINTF_TIME + + +" \n @@ -611,7 +641,19 @@ " -FAILURE: Expected 200ms of logical time to elapse but got %lld nanoseconds. +FAILURE: Expected 200ms of logical time to elapse but got + + +" + + + PRINTF_TIME + + +" + + + nanoseconds. \n diff --git a/test/known-good/C/src/ImportComposition.html b/test/known-good/C/src/ImportComposition.html index 783c0f6c0..bd9e5423f 100644 --- a/test/known-good/C/src/ImportComposition.html +++ b/test/known-good/C/src/ImportComposition.html @@ -248,7 +248,16 @@ " -Received %d at time %lld +Received %d at time + + +" + + + PRINTF_TIME + + +" \n diff --git a/test/known-good/C/src/ManualDelayedReaction.html b/test/known-good/C/src/ManualDelayedReaction.html index 32f42e6d0..444a06525 100644 --- a/test/known-good/C/src/ManualDelayedReaction.html +++ b/test/known-good/C/src/ManualDelayedReaction.html @@ -527,7 +527,43 @@ " -Nanoseconds since start: %lld %lld %lld. +Nanoseconds since start: + + +" + + + PRINTF_TIME + + +" + + + + + +" + + + PRINTF_TIME + + +" + + + + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -568,7 +604,31 @@ " -Expected %lld but got %lld. +Expected + + +" + + + PRINTF_TIME + + +" + + + but got + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/Microsteps.html b/test/known-good/C/src/Microsteps.html index 3bd3c7d76..636613ae9 100644 --- a/test/known-good/C/src/Microsteps.html +++ b/test/known-good/C/src/Microsteps.html @@ -106,7 +106,19 @@ " -Time since start: %lld. +Time since start: + + +" + + + PRINTF_TIME + + +" + + +. \n @@ -135,7 +147,19 @@ " -Expected elapsed time to be 0, but it was %lld. +Expected elapsed time to be 0, but it was + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/NativeListsAndTimes.html b/test/known-good/C/src/NativeListsAndTimes.html index 91d957667..0221e5e31 100644 --- a/test/known-good/C/src/NativeListsAndTimes.html +++ b/test/known-good/C/src/NativeListsAndTimes.html @@ -70,7 +70,7 @@ 0 -, +, // Units are missing but not required @@ -95,7 +95,7 @@ msec -, +, // Type is missing but not required @@ -138,12 +138,19 @@ 4 -}, +}, // List of integers + + + + +// list of time values + + q: @@ -188,56 +195,6 @@ - - -msec - - -}, - - -// list of time values - - - - - - -// List of time values - - - - g: - - -time - - -[] - - -= - - - { - - -1 - - - - - -msec - - -, - - -2 - - - msec diff --git a/test/known-good/C/src/PersistentInputs.html b/test/known-good/C/src/PersistentInputs.html index 2e734541b..c37f149f1 100644 --- a/test/known-good/C/src/PersistentInputs.html +++ b/test/known-good/C/src/PersistentInputs.html @@ -391,7 +391,16 @@ " -Value of the input is %d at time %lld +Value of the input is %d at time + + +" + + + PRINTF_TIME + + +" \n diff --git a/test/known-good/C/src/PhysicalConnection.html b/test/known-good/C/src/PhysicalConnection.html index ce3f4ece9..f64434735 100644 --- a/test/known-good/C/src/PhysicalConnection.html +++ b/test/known-good/C/src/PhysicalConnection.html @@ -192,7 +192,19 @@ " -Received %d at logical time %lld. +Received %d at logical time + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/RequestStop.html b/test/known-good/C/src/RequestStop.html index 99cf2b43b..93d336951 100644 --- a/test/known-good/C/src/RequestStop.html +++ b/test/known-good/C/src/RequestStop.html @@ -65,7 +65,19 @@ " -Shutdown invoked at tag (%lld, %d). Calling lf_request_stop(), which should have no effect. +Shutdown invoked at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %d). Calling lf_request_stop(), which should have no effect. " diff --git a/test/known-good/C/src/Schedule.html b/test/known-good/C/src/Schedule.html index 2dde2179d..1367f5d44 100644 --- a/test/known-good/C/src/Schedule.html +++ b/test/known-good/C/src/Schedule.html @@ -153,7 +153,19 @@ " -Action triggered at logical time %lld nsec after start. +Action triggered at logical time + + +" + + + PRINTF_TIME + + +" + + + nsec after start. \n @@ -182,7 +194,19 @@ " -Expected action time to be 200 msec. It was %lld nsec. +Expected action time to be 200 msec. It was + + +" + + + PRINTF_TIME + + +" + + + nsec. \n diff --git a/test/known-good/C/src/ScheduleLogicalAction.html b/test/known-good/C/src/ScheduleLogicalAction.html index 79f509e6a..faa4e31ee 100644 --- a/test/known-good/C/src/ScheduleLogicalAction.html +++ b/test/known-good/C/src/ScheduleLogicalAction.html @@ -404,7 +404,16 @@ " -Current logical time is: %lld +Current logical time is: + + +" + + + PRINTF_TIME + + +" \n @@ -423,7 +432,16 @@ " -Current physical time is: %lld +Current physical time is: + + +" + + + PRINTF_TIME + + +" \n @@ -458,7 +476,19 @@ " -ERROR: Expected logical time to be %lld. +ERROR: Expected logical time to be + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/SetArray.html b/test/known-good/C/src/SetArray.html index cca539682..f61b77529 100644 --- a/test/known-good/C/src/SetArray.html +++ b/test/known-good/C/src/SetArray.html @@ -128,16 +128,6 @@ sizeof(int)); - - SET_ARRAY(out, array, sizeof(int), - - -3 - - -); - - @@ -150,13 +140,7 @@ - out - - --> - - -value[ + array[ 0 @@ -178,13 +162,7 @@ - out - - --> - - -value[ + array[ 1 @@ -206,13 +184,7 @@ - out - - --> - - -value[ + array[ 2 @@ -233,6 +205,20 @@ ; + + + + + + lf_set_array(out, array, + + +3 + + +); + + diff --git a/test/known-good/C/src/SlowingClock.html b/test/known-good/C/src/SlowingClock.html index 10affa603..bfeab45aa 100644 --- a/test/known-good/C/src/SlowingClock.html +++ b/test/known-good/C/src/SlowingClock.html @@ -296,7 +296,19 @@ " -Logical time since start: \%lld nsec. +Logical time since start: + + +" + + + PRINTF_TIME + + +" + + + nsec. \n @@ -339,7 +351,19 @@ " -ERROR: Expected time to be: \%lld nsec. +ERROR: Expected time to be: + + +" + + + PRINTF_TIME + + +" + + + nsec. \n @@ -532,7 +556,19 @@ " -It was: \%lld nsec. +It was: + + +" + + + PRINTF_TIME + + +" + + + nsec. \n diff --git a/test/known-good/C/src/SlowingClockPhysical.html b/test/known-good/C/src/SlowingClockPhysical.html index 30969330c..f0bf4dfe6 100644 --- a/test/known-good/C/src/SlowingClockPhysical.html +++ b/test/known-good/C/src/SlowingClockPhysical.html @@ -309,7 +309,19 @@ " -Logical time since start: \%lld nsec. +Logical time since start: + + +" + + + PRINTF_TIME + + +" + + + nsec. \n @@ -346,7 +358,19 @@ " -ERROR: Expected logical time to be at least: \%lld nsec. +ERROR: Expected logical time to be at least: + + +" + + + PRINTF_TIME + + +" + + + nsec. \n @@ -462,7 +486,19 @@ " -Scheduling next to occur approximately after: \%lld nsec. +Scheduling next to occur approximately after: + + +" + + + PRINTF_TIME + + +" + + + nsec. \n @@ -555,7 +591,19 @@ " -It was: \%lld nsec. +It was: + + +" + + + PRINTF_TIME + + +" + + + nsec. \n diff --git a/test/known-good/C/src/Starvation.html b/test/known-good/C/src/Starvation.html index a3e2458b3..11b9cc213 100644 --- a/test/known-good/C/src/Starvation.html +++ b/test/known-good/C/src/Starvation.html @@ -387,7 +387,19 @@ " -Shutting down at tag (%lld, %u). +Shutting down at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -559,7 +571,19 @@ " -Received %d at tag (%lld, %u). +Received %d at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -773,7 +797,19 @@ " -Shutting down at tag (%lld, %u). +Shutting down at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/Stop.html b/test/known-good/C/src/Stop.html index b5cf1c7aa..088b3fc27 100644 --- a/test/known-good/C/src/Stop.html +++ b/test/known-good/C/src/Stop.html @@ -527,7 +527,19 @@ " -Shutdown invoked at tag (%lld, %u). +Shutdown invoked at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/StopZero.html b/test/known-good/C/src/StopZero.html index 2ad4065af..85158e0b0 100644 --- a/test/known-good/C/src/StopZero.html +++ b/test/known-good/C/src/StopZero.html @@ -188,7 +188,19 @@ " -Sending 42 at (%lld, %u). +Sending 42 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -341,7 +353,19 @@ " -Requesting stop at (%lld, %u). +Requesting stop at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -388,7 +412,19 @@ " -ERROR: Reaction called after shutdown at (%lld, %u). +ERROR: Reaction called after shutdown at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -632,7 +668,19 @@ " -Stopping at (%lld, %u). +Stopping at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -701,7 +749,19 @@ " -Stopping at (%lld, %u). +Stopping at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -748,7 +808,19 @@ " -SUCCESS: Successfully stopped the program at (%lld, %u). +SUCCESS: Successfully stopped the program at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -854,7 +926,19 @@ " -Received %d at (%lld, %u). +Received %d at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -960,7 +1044,19 @@ " -Requesting stop at (%lld, %u). +Requesting stop at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -1099,7 +1195,19 @@ " -Stopping at (%lld, %u). +Stopping at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -1146,7 +1254,19 @@ " -SUCCESS: Successfully stopped the program at (%lld, %u). +SUCCESS: Successfully stopped the program at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/StructAsTypeDirect.html b/test/known-good/C/src/StructAsTypeDirect.html index bab971d36..e537867ff 100644 --- a/test/known-good/C/src/StructAsTypeDirect.html +++ b/test/known-good/C/src/StructAsTypeDirect.html @@ -206,7 +206,7 @@ - SET_PRESENT(out); + lf_set_present(out); diff --git a/test/known-good/C/src/StructParallel.html b/test/known-good/C/src/StructParallel.html index fb9f2375f..17969ee05 100644 --- a/test/known-good/C/src/StructParallel.html +++ b/test/known-good/C/src/StructParallel.html @@ -72,7 +72,7 @@ " -StructScale.lf +DelayStruct.lf " diff --git a/test/known-good/C/src/StructPrint.html b/test/known-good/C/src/StructPrint.html index e8e2e5e2c..f076d3d38 100644 --- a/test/known-good/C/src/StructPrint.html +++ b/test/known-good/C/src/StructPrint.html @@ -46,136 +46,26 @@ - -preamble - - - { - - -= - - - - - - -#include "hello.h" - - - -= - - -} - - - - - - - -reactor + +import -Print - - - { - - - - - - -output +Source - +, - -out + +Print -: - - - -hello_t - - -* - - - - - - - - - - -reaction - - -( - - -startup - - -) - - --> - - - out { - - -= - - - - - - -// Dynamically allocate an output struct. - - - - SET_NEW(out); - - - - - - -// Above allocates a struct, which then must be populated. - - - - out - - --> - - -value - - --> - - -name - - -= + +from @@ -184,254 +74,33 @@ " -Earth +DelayStruct.lf " - -; - - - - out - - --> - - -value - - --> - - -value - - -= - - - - - -42 - - -; - - - - - - -= - - -} - - - -} - - - - - - - -// expected parameter is for testing. - - - -reactor - - - - - -Check - - -(expected: - - -int - - - - - -= - - - - - -42 - - -) { - - - - - - -input - - - - - -in - - -: - - - - - -hello_t - - -* - - - - -reaction - - -( - - -in) { - - -= - - - - printf( - - -" - - -Received: name = %s, value = %d - - -\n - - -" - - -, in - - --> - - -value - - --> - - -name, in - - --> - - -value - - --> - - -value); - - - - if (in - - --> - - -value - - --> +preamble -value ! + { = - - self - - --> - - -expected) { - - - - printf( - - -" - - -ERROR: Expected value to be %d. - - -\n - - -" - - -, self - - --> - - -expected); - - - exit( - - -1 - - -); + + - - - } + +#include "hello.h" - - - = @@ -439,10 +108,6 @@ } - -} - - @@ -482,7 +147,7 @@ -Print +Source () @@ -510,7 +175,7 @@ -Check +Print () diff --git a/test/known-good/C/src/StructScale.html b/test/known-good/C/src/StructScale.html index d79538f15..5bbbf23b8 100644 --- a/test/known-good/C/src/StructScale.html +++ b/test/known-good/C/src/StructScale.html @@ -50,36 +50,8 @@ - -preamble - - - { - - -= - - - - - - -#include "hello.h" - - - -= - - -} - - - - - - - -reactor + +import @@ -88,501 +60,51 @@ Source - { - - - - - - -output - - - - - -out - - -: - - - - - -hello_t - - -* - - - - - - - - - - -reaction - - -( - - -startup - - -) - - --> - - - out { - - -= - - - - - - -// Dynamically allocate an output struct. - - - - SET_NEW(out); - - - - - - -// Above allocates a struct, which then must be populated. - - - - out - - --> - - -value - - --> - - -name - - -= - - - - - -" - - -Earth - - -" - - -; - - - - out - - --> - - -value - - --> - - -value - - -= - - - - - -42 - - -; - - - - - - -= - - -} - - - -} - - - - - - - -// expected parameter is for testing. - - - -reactor - - - +, -TestInput - - -(expected: - - -int - - - - - -= - - - - - -42 - - -) { - - - - - - -input - - - - - -in - - -: - - - - - -hello_t - - -* - - - - - - -state - - - - - -invoked +Print -: - - - - - -bool - - - -= + +from - - -false - - - - - - - - - - -reaction - - -( - - -in) { - - -= - - - - printf( - - -" - - -Received: name = %s, value = %d - - -\n - - -" - - -, in - - --> - - -value - - --> - - -name, in - - --> - - -value - - --> - - -value); - - - - if (in - - --> - - -value - - --> - - -value ! - - -= - - - self - - --> - - -expected) { - - - - printf( " -ERROR: Expected value to be %d. - - -\n +DelayStruct.lf " - -, self - - --> - - -expected); - - - - exit( - - -1 - - -); - - } - - - self - - --> - - -invoked - - -= - - - - - -true - - -; - - - - -= - - -} - - - - - - - - - -reaction - - -( - - -shutdown - - -) { - - -= - - - - if (self - - --> +preamble -invoked - - -= + { = - - - - -false - - -) { - - - fprintf(stderr, - - -" - - -ERROR: No data received. - - -\n - - -" - - -); - - - - exit( - - -2 - - -); + + - - - } + +#include "hello.h" - - - = @@ -590,10 +112,6 @@ } - -} - - @@ -605,7 +123,7 @@ -Print +Scale (scale: @@ -850,7 +368,7 @@ -Print +Scale () @@ -878,7 +396,7 @@ -TestInput +Print (expected diff --git a/test/known-good/C/src/TimeState.html b/test/known-good/C/src/TimeState.html index 890e758f2..0ee1f495a 100644 --- a/test/known-good/C/src/TimeState.html +++ b/test/known-good/C/src/TimeState.html @@ -113,7 +113,16 @@ " -Baz: %lld +Baz: + + +" + + + PRINTF_TIME + + +" \n diff --git a/test/known-good/C/src/Timeout.html b/test/known-good/C/src/Timeout.html index db8666813..1052d3949 100644 --- a/test/known-good/C/src/Timeout.html +++ b/test/known-good/C/src/Timeout.html @@ -255,7 +255,19 @@ " -ERROR: Tag (%lld, %d) received. Failed to enforce timeout. +ERROR: Tag ( + + +" + + + PRINTF_TIME + + +" + + +, %d) received. Failed to enforce timeout. \n @@ -452,7 +464,19 @@ " -Shutdown invoked at tag (%lld, %u). +Shutdown invoked at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/TimeoutZero.html b/test/known-good/C/src/TimeoutZero.html index 547ffd8a2..f2f0e3f43 100644 --- a/test/known-good/C/src/TimeoutZero.html +++ b/test/known-good/C/src/TimeoutZero.html @@ -255,7 +255,19 @@ " -ERROR: Tag (%lld, %d) received. Failed to enforce timeout. +ERROR: Tag ( + + +" + + + PRINTF_TIME + + +" + + +, %d) received. Failed to enforce timeout. \n @@ -452,7 +464,19 @@ " -Shutdown invoked at tag (%lld, %u). +Shutdown invoked at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/concurrent/AsyncCallback.html b/test/known-good/C/src/concurrent/AsyncCallback.html index 6a0c7b2ed..1b152dc1e 100644 --- a/test/known-good/C/src/concurrent/AsyncCallback.html +++ b/test/known-good/C/src/concurrent/AsyncCallback.html @@ -627,7 +627,19 @@ " -Asynchronous callback %d: Assigned logical time greater than start time by %lld nsec. +Asynchronous callback %d: Assigned logical time greater than start time by + + +" + + + PRINTF_TIME + + +" + + + nsec. \n @@ -681,7 +693,19 @@ " -ERROR: Expected logical time to be larger than %lld. +ERROR: Expected logical time to be larger than + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/concurrent/AsyncCallbackDrop.html b/test/known-good/C/src/concurrent/AsyncCallbackDrop.html index d07c44f0b..4e48704d5 100644 --- a/test/known-good/C/src/concurrent/AsyncCallbackDrop.html +++ b/test/known-good/C/src/concurrent/AsyncCallbackDrop.html @@ -640,7 +640,19 @@ " -Asynchronous callback %d: Assigned logical time greater than start time by %lld nsec. +Asynchronous callback %d: Assigned logical time greater than start time by + + +" + + + PRINTF_TIME + + +" + + + nsec. \n @@ -690,7 +702,19 @@ " -ERROR: Expected logical time to be larger than %lld. +ERROR: Expected logical time to be larger than + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/concurrent/AsyncCallbackReplace.html b/test/known-good/C/src/concurrent/AsyncCallbackReplace.html index aa97cc34e..1e724996e 100644 --- a/test/known-good/C/src/concurrent/AsyncCallbackReplace.html +++ b/test/known-good/C/src/concurrent/AsyncCallbackReplace.html @@ -637,7 +637,19 @@ " -Asynchronous callback %d: Assigned logical time greater than start time by %lld nsec. +Asynchronous callback %d: Assigned logical time greater than start time by + + +" + + + PRINTF_TIME + + +" + + + nsec. \n @@ -687,7 +699,19 @@ " -ERROR: Expected logical time to be larger than %lld. +ERROR: Expected logical time to be larger than + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/concurrent/DelayIntThreaded.html b/test/known-good/C/src/concurrent/DelayIntThreaded.html index aca122671..f2efbb8c0 100644 --- a/test/known-good/C/src/concurrent/DelayIntThreaded.html +++ b/test/known-good/C/src/concurrent/DelayIntThreaded.html @@ -510,7 +510,19 @@ " -After %lld nsec of logical time. +After + + +" + + + PRINTF_TIME + + +" + + + nsec of logical time. \n @@ -539,7 +551,19 @@ " -ERROR: Expected elapsed time to be 100000000. It was %lld. +ERROR: Expected elapsed time to be 100000000. It was + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/concurrent/HelloThreaded.html b/test/known-good/C/src/concurrent/HelloThreaded.html index 5a9f6ff83..a3f684557 100644 --- a/test/known-good/C/src/concurrent/HelloThreaded.html +++ b/test/known-good/C/src/concurrent/HelloThreaded.html @@ -381,7 +381,16 @@ " -Current time is %lld +Current time is + + +" + + + PRINTF_TIME + + +" \n @@ -406,7 +415,19 @@ " -Which is %sPlus %lld nanoseconds. +Which is %sPlus + + +" + + + PRINTF_TIME + + +" + + + nanoseconds. \n @@ -492,7 +513,16 @@ " -***** action %d at time %lld +***** action %d at time + + +" + + + PRINTF_TIME + + +" \n @@ -561,7 +591,7 @@ - long long + instant_t time @@ -611,7 +641,19 @@ " -FAILURE: Expected 200ms of logical time to elapse but got %lld nanoseconds. +FAILURE: Expected 200ms of logical time to elapse but got + + +" + + + PRINTF_TIME + + +" + + + nanoseconds. \n diff --git a/test/known-good/C/src/concurrent/ScheduleAt.html b/test/known-good/C/src/concurrent/ScheduleAt.html index 4745cf3f8..57dbf106e 100644 --- a/test/known-good/C/src/concurrent/ScheduleAt.html +++ b/test/known-good/C/src/concurrent/ScheduleAt.html @@ -1150,7 +1150,19 @@ " -Triggered at tag (%lld, %u). +Triggered at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/concurrent/ScheduleTwice.html b/test/known-good/C/src/concurrent/ScheduleTwice.html index 8d9027568..e4dd6719f 100644 --- a/test/known-good/C/src/concurrent/ScheduleTwice.html +++ b/test/known-good/C/src/concurrent/ScheduleTwice.html @@ -221,7 +221,19 @@ " -Received %d at tag(%lld, %u). +Received %d at tag( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/concurrent/ScheduleTwiceThreaded.html b/test/known-good/C/src/concurrent/ScheduleTwiceThreaded.html index 16b01a3bf..95744a859 100644 --- a/test/known-good/C/src/concurrent/ScheduleTwiceThreaded.html +++ b/test/known-good/C/src/concurrent/ScheduleTwiceThreaded.html @@ -185,7 +185,19 @@ " -Received %d at tag(%lld, %u). +Received %d at tag( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/concurrent/StarvationThreaded.html b/test/known-good/C/src/concurrent/StarvationThreaded.html index a179a26d9..328239395 100644 --- a/test/known-good/C/src/concurrent/StarvationThreaded.html +++ b/test/known-good/C/src/concurrent/StarvationThreaded.html @@ -387,7 +387,19 @@ " -Shutting down at tag (%lld, %u). +Shutting down at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -559,7 +571,19 @@ " -Received %d at tag (%lld, %u). +Received %d at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -773,7 +797,19 @@ " -Shutting down at tag (%lld, %u). +Shutting down at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/concurrent/StopThreaded.html b/test/known-good/C/src/concurrent/StopThreaded.html index 2d5952351..ccae69c29 100644 --- a/test/known-good/C/src/concurrent/StopThreaded.html +++ b/test/known-good/C/src/concurrent/StopThreaded.html @@ -598,7 +598,19 @@ " -Shutdown invoked at tag (%lld, %u). +Shutdown invoked at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). " diff --git a/test/known-good/C/src/concurrent/StopZeroThreaded.html b/test/known-good/C/src/concurrent/StopZeroThreaded.html index 5f2efc05d..bc04baffb 100644 --- a/test/known-good/C/src/concurrent/StopZeroThreaded.html +++ b/test/known-good/C/src/concurrent/StopZeroThreaded.html @@ -184,7 +184,19 @@ " -Sending 42 at (%lld, %u). +Sending 42 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -337,7 +349,19 @@ " -Requesting stop at (%lld, %u). +Requesting stop at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -384,7 +408,19 @@ " -ERROR: Reaction called after shutdown at (%lld, %u). +ERROR: Reaction called after shutdown at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -628,7 +664,19 @@ " -Stopping at (%lld, %u). +Stopping at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -697,7 +745,19 @@ " -Stopping at (%lld, %u). +Stopping at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -744,7 +804,19 @@ " -SUCCESS: Successfully stopped the program at (%lld, %u). +SUCCESS: Successfully stopped the program at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -850,7 +922,19 @@ " -Received %d at (%lld, %u). +Received %d at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -956,7 +1040,19 @@ " -Requesting stop at (%lld, %u). +Requesting stop at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -1095,7 +1191,19 @@ " -Stopping at (%lld, %u). +Stopping at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -1142,7 +1250,19 @@ " -SUCCESS: Successfully stopped the program at (%lld, %u). +SUCCESS: Successfully stopped the program at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/concurrent/Threaded.html b/test/known-good/C/src/concurrent/Threaded.html index d1725a932..5f4caf67c 100644 --- a/test/known-good/C/src/concurrent/Threaded.html +++ b/test/known-good/C/src/concurrent/Threaded.html @@ -54,28 +54,6 @@ sec - -, - - - - flags - - -: - - -" - - -" - - - - - -// Disable compiler optimization so that TakeTime actually takes time. - } diff --git a/test/known-good/C/src/concurrent/ThreadedMultiport.html b/test/known-good/C/src/concurrent/ThreadedMultiport.html index df2b8c0b8..ef19d7dce 100644 --- a/test/known-good/C/src/concurrent/ThreadedMultiport.html +++ b/test/known-good/C/src/concurrent/ThreadedMultiport.html @@ -30,28 +30,6 @@ sec - -, - - - - flags - - -: - - -" - - -" - - - - - -// Disable compiler optimization so that TakeTime actually takes time. - } diff --git a/test/known-good/C/src/concurrent/ThreadedThreaded.html b/test/known-good/C/src/concurrent/ThreadedThreaded.html index e0a90de23..0676cf111 100644 --- a/test/known-good/C/src/concurrent/ThreadedThreaded.html +++ b/test/known-good/C/src/concurrent/ThreadedThreaded.html @@ -63,28 +63,6 @@ true - -, - - - - flags - - -: - - -" - - -" - - - - - -// Disable compiler optimization so that TakeTime actually takes time. - } diff --git a/test/known-good/C/src/concurrent/TimeoutThreaded.html b/test/known-good/C/src/concurrent/TimeoutThreaded.html index 3506dae64..3cd656541 100644 --- a/test/known-good/C/src/concurrent/TimeoutThreaded.html +++ b/test/known-good/C/src/concurrent/TimeoutThreaded.html @@ -255,7 +255,19 @@ " -ERROR: Tag (%lld, %d) received. Failed to enforce timeout. +ERROR: Tag ( + + +" + + + PRINTF_TIME + + +" + + +, %d) received. Failed to enforce timeout. \n @@ -452,7 +464,19 @@ " -Shutdown invoked at tag (%lld, %u). +Shutdown invoked at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/concurrent/TimeoutZeroThreaded.html b/test/known-good/C/src/concurrent/TimeoutZeroThreaded.html index 9a7ed0514..2384d40cd 100644 --- a/test/known-good/C/src/concurrent/TimeoutZeroThreaded.html +++ b/test/known-good/C/src/concurrent/TimeoutZeroThreaded.html @@ -259,7 +259,19 @@ " -ERROR: Tag (%lld, %d) received. Failed to enforce timeout. +ERROR: Tag ( + + +" + + + PRINTF_TIME + + +" + + +, %d) received. Failed to enforce timeout. \n @@ -462,7 +474,19 @@ " -Shutdown invoked at tag (%lld, %u). +Shutdown invoked at tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/concurrent/Tracing.html b/test/known-good/C/src/concurrent/Tracing.html index a34474657..afeacb0f2 100644 --- a/test/known-good/C/src/concurrent/Tracing.html +++ b/test/known-good/C/src/concurrent/Tracing.html @@ -47,25 +47,6 @@ , - - flags - - -: - - -" - - -" - - -, - - -// Disable compiler optimization so that TakeTime actually takes time. - - logging diff --git a/test/known-good/C/src/concurrent/failing/Watchdog.html b/test/known-good/C/src/concurrent/Watchdog.html similarity index 90% rename from test/known-good/C/src/concurrent/failing/Watchdog.html rename to test/known-good/C/src/concurrent/Watchdog.html index 3c5a7f4a4..912b8261e 100644 --- a/test/known-good/C/src/concurrent/failing/Watchdog.html +++ b/test/known-good/C/src/concurrent/Watchdog.html @@ -198,7 +198,7 @@ - instant_t p + instant_t p = @@ -208,7 +208,7 @@ - lf_print( + lf_print( " @@ -224,7 +224,7 @@ - self + self -> @@ -279,7 +279,7 @@ - lf_watchdog_start(poodle, + lf_watchdog_start(poodle, 0 @@ -289,7 +289,7 @@ - lf_print( + lf_print( " @@ -305,7 +305,7 @@ - lf_print( + lf_print( " @@ -333,7 +333,7 @@ - lf_set(d, + lf_set(d, 42 @@ -379,7 +379,7 @@ - lf_print( + lf_print( " @@ -395,7 +395,7 @@ - lf_set(d, + lf_set(d, 1 @@ -444,18 +444,18 @@ - lf_watchdog_stop(poodle); + lf_watchdog_stop(poodle); - + // Watchdog may expire in tests even without the sleep, but it should at least expire twice. - if (self + if (self -> @@ -471,7 +471,7 @@ - lf_print_error_and_exit( + lf_print_error_and_exit( " @@ -493,7 +493,7 @@ - } + } @@ -618,6 +618,75 @@ + + +reaction + + +( + + +startup + + +) { + + += + + + + if (NUMBER_OF_WATCHDOGS ! + + += + + + + + +1 + + +) { + + + + lf_print_error_and_exit( + + +" + + +NUMBER_OF_WATCHDOGS was %d + + +" + + +, NUMBER_OF_WATCHDOGS); + + + + } + + + + + + += + + +} + + + + + + + + reaction @@ -642,7 +711,7 @@ - lf_print( + lf_print( " @@ -676,7 +745,7 @@ - self + self -> @@ -695,7 +764,7 @@ - if (self + if (self -> @@ -732,7 +801,7 @@ - lf_print( + lf_print( " @@ -748,7 +817,7 @@ - lf_sleep(MSEC( + lf_sleep(MSEC( 1600 @@ -758,7 +827,7 @@ - } + } @@ -795,7 +864,7 @@ - if (self + if (self -> @@ -811,7 +880,7 @@ - lf_print_error_and_exit( + lf_print_error_and_exit( " @@ -833,7 +902,7 @@ - } + } diff --git a/test/known-good/C/src/concurrent/WatchdogMultiple.html b/test/known-good/C/src/concurrent/WatchdogMultiple.html new file mode 100644 index 000000000..d5127786f --- /dev/null +++ b/test/known-good/C/src/concurrent/WatchdogMultiple.html @@ -0,0 +1,526 @@ + +/** + + + + * This tests that the order of reactions triggered when a watchdog expires is as expected. + + + + * @author Erling Rennemo Jellum + + + + + + +*/ + + + +target + + + + + +C + + + + + + + +reactor + + + + + +WithWatchdog + + + { + + + + + + +state + + + + + +cnt + + +: + + + + + +int + + + + + += + + + + + +0 + + + + + + + + watchdog watch( + + +10 + + + + + +msec + + +) { + + += + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + watch { + + += + + + + lf_watchdog_start(watch, + + +0 + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +watch) { + + += + + + + self + + +-> + + +cnt + + ++ + + ++ + + +; + + + + if (lf_time_logical_elapsed() ! + + += + + + MSEC( + + +10 + + +)) { + + + + lf_print_error_and_exit( + + +" + + +Watchdog handler triggered at wrong tag. + + +" + + +); + + + + } + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +shutdown + + +) { + + += + + + + if (self + + +-> + + +cnt ! + + += + + + + + +1 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Watchdog did not timeout + + +" + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +w1 + + + + + += + + + + + +new + + + + + +WithWatchdog + + +() + + + + + + +w2 + + + + + += + + + + + +new + + + + + +WithWatchdog + + +() + + + + + + +timer + + + t( + + +2 + + + + + +sec + + +) + + + + + + + + + + +reaction + + +( + + +startup + + +) { + + += + + + + if (NUMBER_OF_WATCHDOGS ! + + += + + + + + +2 + + +) { + + + + lf_print_error_and_exit( + + +" + + +NUMBER_OF_WATCHDOGS was %d + + +" + + +, NUMBER_OF_WATCHDOGS); + + + + } + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +t) { + + += + + + + + += + + +} + + + +} + + + + + + diff --git a/test/known-good/C/src/concurrent/WatchdogMutex.html b/test/known-good/C/src/concurrent/WatchdogMutex.html new file mode 100644 index 000000000..228b0c4f8 --- /dev/null +++ b/test/known-good/C/src/concurrent/WatchdogMutex.html @@ -0,0 +1,679 @@ + +/** + + + + * This tests that the order of reactions triggered when a watchdog expires is as expected. + + + + * @author Erling Rennemo Jellum + + + + + + +*/ + + + +target + + + + + +C + + + + + + + +preamble + + + { + + += + + + + typedef enum { + + + + INVALID + + += + + + + + +0 + + +, + + + + STARTUP_DONE + + += + + +1 + + +, + + + + WATCHDOG_HANDLE_DONE + + += + + + + + +2 + + +, + + + + WATCHDOG_TRIGGERED_REACTION_DONE + + += + + + + + +3 + + +, + + + + } state + + +_t + + +; + + + += + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +state + + + + + +test + + +: + + + + + +state_t + + + + + += + + + { + + += + + + INVALID + + += + + +} + + + + + + +timer + + + t( + + +1 + + + + + +sec + + +) + + + + + + + + watchdog watch( + + +1 + + + + + +msec + + +) { + + += + + + + lf_print( + + +" + + +Watchdog handler + + +" + + +); + + + + if(self + + +-> + + +test ! + + += + + + STARTUP_DONE) { + + + + lf_print_error_and_exit( + + +" + + +Startup reaction not done + + +" + + +); + + + + } + + + + self + + +-> + + +test + + += + + + WATCHDOG_HANDLE_DONE; + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + watch { + + += + + + + if (NUMBER_OF_WATCHDOGS ! + + += + + + + + +1 + + +) { + + + + lf_print_error_and_exit( + + +" + + +NUMBER_OF_WATCHDOGS was %d + + +" + + +, NUMBER_OF_WATCHDOGS); + + + + } + + + + + + + + lf_watchdog_start(watch, + + +0 + + +); + + + + if(self + + +-> + + +test ! + + += + + + + + +0 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Startup reaction interrupted + + +" + + +); + + + + } + + + + lf_sleep(MSEC( + + +100 + + +)); + + + + if(self + + +-> + + +test ! + + += + + + + + +0 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Startup reaction interrupted + + +" + + +); + + + + } + + + + self + + +-> + + +test + + += + + + STARTUP_DONE; + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +watch) { + + += + + + + lf_print( + + +" + + +Watchdog trigger + + +" + + +); + + + + if(self + + +-> + + +test ! + + += + + + WATCHDOG_HANDLE_DONE) { + + + + lf_print_error_and_exit( + + +" + + +Watchdog handle not finished + + +" + + +); + + + + } + + + + self + + +-> + + +test + + += + + + WATCHDOG_TRIGGERED_REACTION_DONE; + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +t) { + + += + + + + if(self + + +-> + + +test ! + + += + + + WATCHDOG_TRIGGERED_REACTION_DONE) { + + + + lf_print_error_and_exit( + + +" + + +Watchdog did not expire + + +" + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + diff --git a/test/known-good/C/src/concurrent/WatchdogRestartTerminated.html b/test/known-good/C/src/concurrent/WatchdogRestartTerminated.html new file mode 100644 index 000000000..eb9c6b9a9 --- /dev/null +++ b/test/known-good/C/src/concurrent/WatchdogRestartTerminated.html @@ -0,0 +1,524 @@ + +/** + + + + * Test that the resetting of the watchdog thread works. This test expects 10 watchdog timeouts + + + + * occurring at the correct logical tag. + + + + * @author Erling Rennemo Jellum + + + + + + +*/ + + + +target + + + + + +C + + + + + + + +main + + + + + +reactor + + + { + + + + + + +state + + + + + +n_timeouts + + +: + + + + + +int + + + + + += + + + + + +0 + + + + + + +state + + + + + +expected_trigger + + +: + + + + + +time + + + + + += + + + + + +0 + + + + + + +timer + + + t( + + +2 + + + + + +sec + + +) + + + + + + + + watchdog watch( + + +1 + + + + + +msec + + +) { + + += + + + + + + +// lf_print("Watchdog handler @ " PRINTF_TIME "," PRINTF_TIME, lf_time_physical_elapsed(), lf_time_logical_elapsed()); + + + + self + + +-> + + +n_timeouts + + ++ + + ++ + + +; + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + watch { + + += + + + + lf_watchdog_start(watch, + + +0 + + +); + + + + self + + +-> + + +expected_trigger + + += + + + lf_time_logical() + + ++ + + + MSEC( + + +1 + + +); + + + + + + +// lf_print("Startup done @ " PRINTF_TIME "," PRINTF_TIME, lf_time_physical_elapsed(), lf_time_logical_elapsed()); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +watch) + + +-> + + + watch { + + += + + + + + + +// lf_print("Watchdog trigger @ " PRINTF_TIME "," PRINTF_TIME, lf_time_physical_elapsed(), lf_time_logical_elapsed()); + + + + if (self + + +-> + + +expected_trigger ! + + += + + + lf_time_logical()) { + + + + lf_print_error_and_exit( + + +" + + +Watchdog triggered @ + + +" + + + PRINTF_TIME + + +" + + + expected + + +" + + + PRINTF_TIME, lf_time_logical(), self + + +-> + + +expected_trigger); + + + + } + + + + if (self + + +-> + + +n_timeouts < + + +10 + + +) { + + + + lf_watchdog_start(watch, + + +0 + + +); + + + + self + + +-> + + +expected_trigger + + += + + + lf_time_logical() + + ++ + + + MSEC( + + +1 + + +); + + + + } + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +t) { + + += + + + + if (self + + +-> + + +n_timeouts ! + + += + + + + + +10 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Got %u timeouts, expected 10 + + +" + + +, self + + +-> + + +n_timeouts); + + + + } + + + + + + += + + +} + + + +} + + + + + + diff --git a/test/known-good/C/src/concurrent/failing/WatchdogBank.html b/test/known-good/C/src/concurrent/failing/WatchdogBank.html new file mode 100644 index 000000000..689f8d37b --- /dev/null +++ b/test/known-good/C/src/concurrent/failing/WatchdogBank.html @@ -0,0 +1,380 @@ + +/** + + + +* This tests that the order of reactions triggered when a watchdog expires is as expected. + + + +* @author Erling Rennemo Jellum + + + +*/ + + + +target + + + + + +C + + + + + + + + + + + +reactor + + + + + +WithWatchdog + + + { + + + + + + +state + + + + + +cnt + + +: + + +int + + + + + += + + + + + +0 + + + + + + + + watchdog watch( + + +10 + + + + + +msec + + +) { + + += + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + watch { + + += + + + + lf_watchdog_start(watch, + + +0 + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +watch) { + + += + + + + self + + +-> + + +cnt + + ++ + + ++ + + +; + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +shutdown + + +) { + + += + + + + if (self + + +-> + + +cnt ! + + += + + + + + +1 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Watchdog did not timeout + + +" + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +w + + + + + += + + + + + +new + + + + + +[3] WithWatchdog + + +() + + + + + + +timer + + + t( + + +2 + + + + + +sec + + +) + + + + + + +reaction + + +( + + +t) { + + += + + += + + +} + + + +} + + diff --git a/test/known-good/C/src/docker/federated/DistributedStopDecentralizedContainerized.html b/test/known-good/C/src/docker/federated/DistributedStopDecentralizedContainerized.html index ef40aa3d5..3eb527f0e 100644 --- a/test/known-good/C/src/docker/federated/DistributedStopDecentralizedContainerized.html +++ b/test/known-good/C/src/docker/federated/DistributedStopDecentralizedContainerized.html @@ -64,7 +64,7 @@ " -rti:latest +rti:local " diff --git a/test/known-good/C/src/federated/failing/ClockSync.html b/test/known-good/C/src/federated/ClockSync.html similarity index 81% rename from test/known-good/C/src/federated/failing/ClockSync.html rename to test/known-good/C/src/federated/ClockSync.html index fcd218b78..f6cdcacde 100644 --- a/test/known-good/C/src/federated/failing/ClockSync.html +++ b/test/known-good/C/src/federated/ClockSync.html @@ -3,19 +3,31 @@ - * This program tests clock synchronization. It checks the clock synchronization error and fails if + * This program tests clock synchronization. It sets an initial clock sync error of 2 s and checks - * it exceeds a threshold. Note that failures could occur here intermittently because clock + * that the clock synchronization error at startup and at shutdown is no larger than 10x this. This - * synchronization accuracy depends on many conditions. But the threshold is quite high, so failures + * is, of course, extremely pessimistic, but the test is mainly ensuring the clock sync compiles and - * should be rare. + * runs correctly. The pessimistic threshold is designed to ensure the test does not fail even with + + + + * the extreme timing anomalies of GitHub testing, particularly on macOS. On a normal Mac, the clock + + + + * sync algorithm brings the offset to within a few microseconds. + + + + * @@ -98,7 +110,7 @@ - local-federates-on + local-federates-on : @@ -114,35 +126,35 @@ - + // Collect useful statistics like average network delay and the standard deviation for the - + // network delay over one clock synchronization cycle. Generates a warning if the standard - + // deviation is higher than the clock sync guard. Artificially offsets clocks by multiples of - + // 200 msec. - collect-stats + collect-stats : @@ -155,26 +167,20 @@ - test-offset + test-offset : -200 - - - - - -msec +2 -, + s, - period + period : @@ -196,7 +202,7 @@ - trials + trials : @@ -212,7 +218,7 @@ - attenuation + attenuation : @@ -239,6 +245,35 @@ + +preamble + + + { + + += + + + + extern interval_t _lf_clock_sync_offset; + + + + extern interval_t _lf_clock_sync_constant_bias; + + + += + + +} + + + + + + /** @@ -353,14 +388,19 @@ = + - lf_set(out, + lf_set(out, 42 -); +); + + + + = @@ -446,29 +486,41 @@ - interval_t offset + interval_t offset = - _lf_time_physical_clock_offset + _lf_clock_sync_offset + - _lf_time_test_physical_clock_offset; + _lf_clock_sync_constant_bias; - lf_print( + lf_print( + + +" + + +Clock sync error at startup is + + +" + + + PRINTF_TIME " -Clock sync error at startup is %lld ns. + ns. " @@ -477,6 +529,55 @@ , offset); + + + + +// Error out if the offset is bigger than 20 s. + + + + if (offset > SEC( + + +20 + + +) || + + +- + + +offset > SEC( + + +20 + + +)) { + + + + lf_print_error_and_exit( + + +" + + +Clock sync error at startup exceeds initial test offset of 20 s. + + +" + + +); + + + + } + + @@ -506,8 +607,9 @@ = + - lf_print( + lf_print( " @@ -525,7 +627,11 @@ -> -value); +value); + + + + = @@ -558,29 +664,41 @@ - interval_t offset + interval_t offset = - _lf_time_physical_clock_offset + _lf_clock_sync_offset + - _lf_time_test_physical_clock_offset; + _lf_clock_sync_constant_bias; - lf_print( + lf_print( " -Clock sync error at shutdown is %lld ns. +Clock sync error at shutdown is + + +" + + + PRINTF_TIME + + +" + + + ns. " @@ -590,30 +708,42 @@ - + -// Error out if the offset is bigger than 100 msec. +// Error out if the offset is bigger than 20 s. - if (offset > MSEC( + if (offset > SEC( -100 +20 + + +) || + + +- + + +offset > SEC( + + +20 )) { - lf_print_error( + lf_print_error_and_exit( " -Offset exceeds test threshold of 100 msec. +Clock sync error at shutdown exceeds initial test offset of 20 s. " @@ -623,17 +753,7 @@ - exit( - - -1 - - -); - - - - } + } diff --git a/test/known-good/C/src/federated/DistributedCountDecentralized.html b/test/known-good/C/src/federated/DistributedCountDecentralized.html index 2a2db6840..5405ed0a2 100644 --- a/test/known-good/C/src/federated/DistributedCountDecentralized.html +++ b/test/known-good/C/src/federated/DistributedCountDecentralized.html @@ -300,7 +300,7 @@ - (long long int)elapsed_time, + elapsed_time, @@ -324,7 +324,7 @@ - (long long int)(in + (in -> diff --git a/test/known-good/C/src/federated/failing/DistributedDoublePortLooped.html b/test/known-good/C/src/federated/DistributedDoublePortLooped.html similarity index 97% rename from test/known-good/C/src/federated/failing/DistributedDoublePortLooped.html rename to test/known-good/C/src/federated/DistributedDoublePortLooped.html index b47e3fd87..af05ae21a 100644 --- a/test/known-good/C/src/federated/failing/DistributedDoublePortLooped.html +++ b/test/known-good/C/src/federated/DistributedDoublePortLooped.html @@ -176,14 +176,19 @@ = + - lf_set(out, + lf_set(out, 0 -); +); + + + + = @@ -452,8 +457,9 @@ = + - lf_set(out2, self + lf_set(out2, self -> @@ -468,7 +474,11 @@ + -); +); + + + + = @@ -664,8 +674,9 @@ = + - lf_schedule_int(act, + lf_schedule_int(act, 0 @@ -686,7 +697,11 @@ + -); +); + + + + = @@ -720,14 +735,19 @@ = + - lf_set(out, act + lf_set(out, act -> -value); +value); + + + + = @@ -900,7 +920,7 @@ - interval_t elapsed_time + interval_t elapsed_time = @@ -910,13 +930,25 @@ - lf_print( + lf_print( + + +" + + +At tag ( + + +" + + + PRINTF_TIME " -At tag (%lld, %u), received in = %d and in2 = %d. +, %u), received in = %d and in2 = %d. " @@ -944,7 +976,7 @@ - if (in1 + if (in1 -> @@ -960,7 +992,7 @@ - lf_print_error_and_exit( + lf_print_error_and_exit( " @@ -976,11 +1008,11 @@ - } + } - lf_set(out, in1 + lf_set(out, in1 -> diff --git a/test/known-good/C/src/federated/failing/DistributedDoublePortLooped2.html b/test/known-good/C/src/federated/DistributedDoublePortLooped2.html similarity index 95% rename from test/known-good/C/src/federated/failing/DistributedDoublePortLooped2.html rename to test/known-good/C/src/federated/DistributedDoublePortLooped2.html index 83a4adc97..2d56a7511 100644 --- a/test/known-good/C/src/federated/failing/DistributedDoublePortLooped2.html +++ b/test/known-good/C/src/federated/DistributedDoublePortLooped2.html @@ -234,7 +234,7 @@ - lf_print( + lf_print( " @@ -256,7 +256,7 @@ - lf_set(out, self + lf_set(out, self -> @@ -303,8 +303,9 @@ = + - lf_print( + lf_print( " @@ -322,7 +323,11 @@ -> -value); +value); + + + + = @@ -489,8 +494,9 @@ = + - lf_schedule_int(act, + lf_schedule_int(act, 0 @@ -511,7 +517,11 @@ + -); +); + + + + = @@ -545,14 +555,19 @@ = + - lf_set(out, act + lf_set(out, act -> -value); +value); + + + + = @@ -703,7 +718,7 @@ - interval_t elapsed_time + interval_t elapsed_time = @@ -713,7 +728,7 @@ - if (in + if (in -> @@ -723,13 +738,25 @@ - lf_print( + lf_print( + + +" + + +At tag ( " + + PRINTF_TIME + -At tag (%lld, %u), received in = %d. +" + + +, %u), received in = %d. " @@ -751,11 +778,11 @@ - } + } - if (in2 + if (in2 -> @@ -765,13 +792,25 @@ - lf_print( + lf_print( " -At tag (%lld, %u), received in2 = %d. +At tag ( + + +" + + + PRINTF_TIME + + +" + + +, %u), received in2 = %d. " @@ -793,11 +832,11 @@ - } + } - if (in + if (in -> @@ -813,7 +852,7 @@ - lf_print_error_and_exit( + lf_print_error_and_exit( " @@ -829,11 +868,11 @@ - } + } - lf_set(out, in + lf_set(out, in -> @@ -873,7 +912,7 @@ - + // Do nothing @@ -911,8 +950,9 @@ = + - lf_print( + lf_print( " @@ -924,7 +964,11 @@ " -); +); + + + + = diff --git a/test/known-good/C/src/federated/DistributedMultiportToken.html b/test/known-good/C/src/federated/DistributedMultiportToken.html index 2ca4e6c9b..315086d59 100644 --- a/test/known-good/C/src/federated/DistributedMultiportToken.html +++ b/test/known-good/C/src/federated/DistributedMultiportToken.html @@ -273,6 +273,10 @@ ; + + + + @@ -281,7 +285,35 @@ - SET_NEW_ARRAY(out[i], length); + char + + +* + + + array + + += + + + (char + + +* + + +)malloc(length + + +* + + + sizeof(char)); + + + + @@ -292,13 +324,7 @@ - snprintf(out[i] - - --> - - -value, length, + snprintf(array, length, " @@ -361,17 +387,26 @@ - out[i] + array - --> + + + ); + -value + + + + + + + +// Set the output. - ); + lf_set_array(out[i], array, length); diff --git a/test/known-good/C/src/federated/DistributedToken.html b/test/known-good/C/src/federated/DistributedToken.html index 2d9f0eb91..665a19c67 100644 --- a/test/known-good/C/src/federated/DistributedToken.html +++ b/test/known-good/C/src/federated/DistributedToken.html @@ -381,6 +381,10 @@ ; + + + + @@ -389,7 +393,35 @@ - SET_NEW_ARRAY(message, length); + char + + +* + + + array + + += + + + (char + + +* + + +)malloc(length + + +* + + + sizeof(char)); + + + + @@ -400,13 +432,7 @@ - snprintf(message - - --> - - -value, length, + snprintf(array, length, " @@ -478,17 +504,26 @@ - message + array - --> + + + ); + -value + + + + + + + +// Set the output. - ); + lf_set_array(message, array, length); diff --git a/test/known-good/C/src/federated/EnclaveFederatedRequestStop.html b/test/known-good/C/src/federated/EnclaveFederatedRequestStop.html index 2c98fdb74..c17573128 100644 --- a/test/known-good/C/src/federated/EnclaveFederatedRequestStop.html +++ b/test/known-good/C/src/federated/EnclaveFederatedRequestStop.html @@ -7,7 +7,15 @@ - * request a stop. + * request a stop. Note that the test has no timeout because any finite timeout can, in theory, + + + + * cause the test to fail. The first federate to request a stop does so at 50 ms, so the program + + + + * should terminate quickly if all goes well. @@ -26,29 +34,6 @@ C - - { - - - - timeout - - -: - - -1 - - - - - -sec - - - -} - @@ -64,55 +49,36 @@ Stop -(stop_time: - - -time - - - - - -= - - - +( - -5 + + + - - s) { + +// Zero value here means "don't stop". - + stop_time: - -preamble + +time - { + = - - - - - -#include "platform.h" // Defines PRINTF_TIME - - - + - -= + +0 -} +) { @@ -146,7 +112,19 @@ - lf_request_stop(); + if (self + + +-> + + +stop_time > + + +0 + + +) lf_request_stop(); @@ -307,10 +285,10 @@ -5 +0 - s) { +) { diff --git a/test/known-good/C/src/federated/LoopDistributedCentralizedPhysicalAction.html b/test/known-good/C/src/federated/LoopDistributedCentralizedPhysicalAction.html index a09ba5ef6..95c4feada 100644 --- a/test/known-good/C/src/federated/LoopDistributedCentralizedPhysicalAction.html +++ b/test/known-good/C/src/federated/LoopDistributedCentralizedPhysicalAction.html @@ -34,25 +34,6 @@ { - - flags - - -: - - -" - - --Wall - - -" - - -, - - coordination diff --git a/test/known-good/C/src/federated/LoopDistributedCentralizedPrecedence.html b/test/known-good/C/src/federated/LoopDistributedCentralizedPrecedence.html index 6670cbf16..4916e6acf 100644 --- a/test/known-good/C/src/federated/LoopDistributedCentralizedPrecedence.html +++ b/test/known-good/C/src/federated/LoopDistributedCentralizedPrecedence.html @@ -42,25 +42,6 @@ { - - flags - - -: - - -" - - --Wall - - -" - - -, - - coordination diff --git a/test/known-good/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.html b/test/known-good/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.html index 1fa9b7fe7..20b5643fa 100644 --- a/test/known-good/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.html +++ b/test/known-good/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.html @@ -42,25 +42,6 @@ { - - flags - - -: - - -" - - --Wall - - -" - - -, - - coordination diff --git a/test/known-good/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.html b/test/known-good/C/src/federated/LoopDistributedDecentralizedPrecedence.html similarity index 85% rename from test/known-good/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.html rename to test/known-good/C/src/federated/LoopDistributedDecentralizedPrecedence.html index 874bbfbf5..940bc6610 100644 --- a/test/known-good/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.html +++ b/test/known-good/C/src/federated/LoopDistributedDecentralizedPrecedence.html @@ -7,7 +7,59 @@ - * present in decentralized coordination. + * present in decentralized coordination. The Looper reactors have the default zero STP offset, so + + + + * they can advance their time to the timer time immediately. Their second reaction, however, has + + + + * larger STAA offset (100 ms), so they stall to wait for input. The test ensures that their third + + + + * reaction is not invoked before the second. + + + + * + + + + * To tolerate timing variability (particularly in the CI tests), if the third reaction is invoked + + + + * at a tag without the second reaction having been invoked, then it checks that the lag is at least + + + + * 100 ms. This means that the input was late by at least 100 ms and was therefore assumed to be + + + + * absent, as is normal for decentralized coordination. If the input later arrives, then there will + + + + * be an STP violation, which will result in printing a warning, but not in a test failure. + + + + * + + + + * This test is designed to not be flaky. The timing properties are set so that warnings are printed + + + + * if the execution timing is wildly off, specifically if communication between federates takes more + + + + * than 100 ms. But the test will not fail in these cases. @@ -42,25 +94,6 @@ { - - flags - - -: - - -" - - --Wall - - -" - - -, - - coordination @@ -150,7 +183,7 @@ msec -, stp_offset: +, stp: time @@ -338,7 +371,7 @@ - lf_set(out, self + lf_set(out, self -> @@ -348,7 +381,7 @@ - self + self -> @@ -403,7 +436,7 @@ - instant_t time_lag + instant_t time_lag = @@ -419,24 +452,15 @@ - char time_buffer[ - - -28 - - -]; - - -// 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + char time_buffer[LF_TIME_BUFFER_LENGTH]; - lf_readable_time(time_buffer, time_lag); + lf_readable_time(time_buffer, time_lag); - lf_print( + lf_print( " @@ -458,7 +482,7 @@ - self + self -> @@ -492,14 +516,14 @@ STP -(stp_offset) { +(stp) { = - instant_t time_lag + instant_t time_lag = @@ -515,24 +539,15 @@ - char time_buffer[ - - -28 - - -]; - - -// 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + char time_buffer[LF_TIME_BUFFER_LENGTH]; - lf_readable_time(time_buffer, time_lag); + lf_readable_time(time_buffer, time_lag); - lf_print( + lf_print_warning( " @@ -544,35 +559,21 @@ " -, in - - --> - - -value, time_buffer); +, - self + in -> -received_count - - -= +value, time_buffer + - self - - --> - - -count; + ); @@ -591,7 +592,7 @@ ( -10 +100 @@ -607,7 +608,7 @@ - instant_t time_lag + instant_t time_lag = @@ -623,24 +624,15 @@ - char time_buffer[ - - -28 - - -]; - - -// 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + char time_buffer[LF_TIME_BUFFER_LENGTH]; - lf_readable_time(time_buffer, time_lag); + lf_readable_time(time_buffer, time_lag); - lf_print( + lf_print_warning( " @@ -652,17 +644,25 @@ " -, in +, + + + + in -> -value, time_buffer); +value, time_buffer - self + ); + + + + self -> @@ -714,7 +714,7 @@ - if (self + if (self -> @@ -736,7 +736,33 @@ - lf_print_error_and_exit( + interval_t lag + + += + + + lf_time_physical() + + +- + + + lf_time_logical(); + + + + if (lag < self + + +-> + + +stp) { + + + + lf_print_error_and_exit( " @@ -752,7 +778,31 @@ - } + } else { + + + + lf_print_warning( + + +" + + +Assumed input was absent because STAA expired. + + +" + + +); + + + + } + + + + } @@ -789,7 +839,7 @@ - lf_print( + lf_print( " @@ -805,7 +855,7 @@ - if (self + if (self -> @@ -839,7 +889,7 @@ - lf_print_error_and_exit( + lf_print_error_and_exit( " @@ -855,7 +905,7 @@ - } + } @@ -932,7 +982,7 @@ Looper -(stp_offset +(stp = @@ -941,7 +991,7 @@ -5 +50 @@ -978,13 +1028,10 @@ Looper -(incr +(incr = - - - - @@ -993,7 +1040,7 @@ 1 -, stp_offset +, stp = @@ -1002,7 +1049,7 @@ -5 +50 diff --git a/test/known-good/C/src/federated/LoopDistributedDecentralizedPrecedenceHierarchy.html b/test/known-good/C/src/federated/LoopDistributedDecentralizedPrecedenceHierarchy.html new file mode 100644 index 000000000..0b4faceef --- /dev/null +++ b/test/known-good/C/src/federated/LoopDistributedDecentralizedPrecedenceHierarchy.html @@ -0,0 +1,1408 @@ + +/** + + + + * This tests that the precedence order of reaction invocation is kept in the hierarchy of reactors + + + + * when a feedback loop is present in decentralized coordination. The STAA is specified only on + + + + * top-level reactions to the input and is implied for the contained reactor. This shows how to use + + + + * library reactors with decentralized coordination when you need to specify an STAA. + + + + * + + + + * This test is designed to not be flaky. The timing properties are set so that warnings are printed + + + + * if the execution timing is wildly off, specifically if communication between federates takes more + + + + * than 100 ms. But the test will not fail in these cases. + + + + * + + + + * @author Edward A. Lee + + + + * @author Soroush Bateni + + + + + + +*/ + + + +target + + + + + +C + + + { + + + + coordination + + +: + + +decentralized + + +, + + + + timeout + + +: + + +4900 + + + + + +msec + + + +} + + + + + + + +reactor + + + + + +Contained + + +(incr: + + +int + + + + + += + + + + + +1 + + +, stp: + + +time + + + + + += + + + + + +0 + + +) { + + + + + + +timer + + + t( + + +0 + + +, + + +1 + + + + + +sec + + +) + + + + + + +input + + + + + +in + + +: + + + + + +int + + + + + + +state + + + + + +count + + +: + + + + + +int + + + + + += + + + + + +0 + + + + + + +state + + + + + +received_count + + +: + + + + + +int + + + + + += + + + + + +0 + + + + + + + + + + +reaction + + +( + + +t) { + + += + + + + self + + +-> + + +count + + ++ + + += + + + self + + +-> + + +incr; + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +in) { + + += + + + + instant_t time_lag + + += + + + lf_time_physical() + + +- + + + lf_time_logical(); + + + + char time_buffer[LF_TIME_BUFFER_LENGTH]; + + + + lf_readable_time(time_buffer, time_lag); + + + + lf_print( + + +" + + +Received %d. Logical time is behind physical time by %s. + + +" + + +, + + + + in + + +-> + + +value, time_buffer + + + + ); + + + + self + + +-> + + +received_count + + += + + + self + + +-> + + +count; + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +t) { + + += + + + + if (self + + +-> + + +received_count ! + + += + + + self + + +-> + + +count) { + + + + interval_t lag + + += + + + lf_time_physical() + + +- + + + lf_time_logical(); + + + + if (lag < self + + +-> + + +stp) { + + + + lf_print_error_and_exit( + + +" + + +reaction(t) was invoked before reaction(in). Precedence order was not kept. + + +" + + +); + + + + } else { + + + + lf_print_warning( + + +" + + +Assumed input was absent because STAA expired. + + +" + + +); + + + + } + + + + } + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +Looper + + +(incr: + + +int + + + + + += + + + + + +1 + + +, delay: + + +time + + + + + += + + + + + +0 + + + + + +msec + + +, stp: + + +time + + + + + += + + + + + +0 + + +) { + + + + + + +input + + + + + +in + + +: + + + + + +int + + + + + + +output + + + + + +out + + +: + + + + + +int + + + + + + +state + + + + + +count + + +: + + + + + +int + + + + + += + + + + + +0 + + + + + + +timer + + + t( + + +0 + + +, + + +1 + + + + + +sec + + +) + + + + + + + + + + +c + + + + + += + + + + + +new + + + + + +Contained + + +(incr + + += + + +incr, stp + + += + + +stp) + + + + in + + +-> + + + + + +c + + +. + + +in + + + + + + + + + + +reaction + + +( + + +t) + + +-> + + + out { + + += + + + + lf_set(out, self + + +-> + + +count); + + + + self + + +-> + + +count + + ++ + + += + + + self + + +-> + + +incr; + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +in) { + + += + + + + instant_t time_lag + + += + + + lf_time_physical() + + +- + + + lf_time_logical(); + + + + char time_buffer[LF_TIME_BUFFER_LENGTH]; + + + + lf_readable_time(time_buffer, time_lag); + + + + lf_print( + + +" + + +Received %d. Logical time is behind physical time by %s nsec. + + +" + + +, in + + +-> + + +value, time_buffer); + + + + + + += + + +} + + +STP + + +(stp) { + + += + + + + instant_t time_lag + + += + + + lf_time_physical() + + +- + + + lf_time_logical(); + + + + char time_buffer[LF_TIME_BUFFER_LENGTH]; + + + + lf_readable_time(time_buffer, time_lag); + + + + lf_print_warning( + + +" + + +STP offset was violated. Received %d. Logical time is behind physical time by %s nsec. + + +" + + +, + + + + in + + +-> + + +value, time_buffer + + + + ); + + + + + + += + + +} + + +deadline + + +( + + +100 + + + ms) { + + += + + + + instant_t time_lag + + += + + + lf_time_physical() + + +- + + + lf_time_logical(); + + + + char time_buffer[LF_TIME_BUFFER_LENGTH]; + + + + lf_readable_time(time_buffer, time_lag); + + + + lf_print_warning( + + +" + + +Deadline miss. Received %d. Logical time is behind physical time by %s nsec. + + +" + + +, + + + + in + + +-> + + +value, time_buffer + + + + ); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +shutdown + + +) { + + += + + + + lf_print( + + +" + + +******* Shutdown invoked. + + +" + + +); + + + + if (self + + +-> + + +count ! + + += + + + + + +5 + + + + + +* + + + self + + +-> + + +incr) { + + + + lf_print_error_and_exit( + + +" + + +Failed to react five times. + + +" + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +federated + + + + + +reactor + + +(delay: + + +time + + + + + += + + + + + +0 + + +) { + + + + + + +left + + + + + += + + + + + +new + + + + + +Looper + + +(stp + + += + + + + + +100 + + + ms) + + + + + + +right + + + + + += + + + + + +new + + + + + +Looper + + +(incr + + += + + +- + + +1 + + +, stp + + += + + + + + +100 + + + ms) + + + + + + +left + + +. + + +out + + + + + +-> + + + + + +right + + +. + + +in + + + + + + +right + + +. + + +out + + + + + +-> + + + + + +left + + +. + + +in + + + +} + + + + + + diff --git a/test/known-good/C/src/federated/SmallDelayDecentralized.html b/test/known-good/C/src/federated/SmallDelayDecentralized.html index 4e7a40c81..a6434775b 100644 --- a/test/known-good/C/src/federated/SmallDelayDecentralized.html +++ b/test/known-good/C/src/federated/SmallDelayDecentralized.html @@ -660,7 +660,7 @@ - lf_print_error_and_exit( + lf_print_warning( " @@ -682,7 +682,7 @@ " -. This should not happen because the STP offset is large. +. This should not happen because the STP offset is large. Checking value anyway. " @@ -716,6 +716,95 @@ microstep); + + lf_print( + + +" + + +-------- Received %d + + +" + + +, in + + +-> + + +value); + + + + if (in + + +-> + + +value ! + + += + + + self + + +-> + + +c) { + + + + lf_print_error_and_exit( + + +" + + +Expected to receive %d. + + +" + + +, self + + +-> + + +c); + + + + } + + + + self + + +-> + + +c + + ++ + + ++ + + +; + + @@ -740,7 +829,13 @@ ( -loop) { +loop) + + +-> + + + loop { = @@ -753,7 +848,7 @@ " -checking self.checks, which is now %d... +checking self->checks, which is now %d... " diff --git a/test/known-good/C/src/lib/GenDelay.html b/test/known-good/C/src/lib/GenDelay.html index 71097136d..942dca879 100644 --- a/test/known-good/C/src/lib/GenDelay.html +++ b/test/known-good/C/src/lib/GenDelay.html @@ -191,7 +191,16 @@ " -Received %d at time %lld +Received %d at time + + +" + + + PRINTF_TIME + + +" " diff --git a/test/known-good/C/src/lib/LoopedActionSender.html b/test/known-good/C/src/lib/LoopedActionSender.html index 6f7cc50e9..66e8ab9d4 100644 --- a/test/known-good/C/src/lib/LoopedActionSender.html +++ b/test/known-good/C/src/lib/LoopedActionSender.html @@ -231,7 +231,7 @@ /* - printf("At tag (%lld, %u) sending value %d.\n", + printf("At tag (" PRINTF_TIME ", %u) sending value %d.\n", diff --git a/test/known-good/C/src/modal_models/ModalStartupShutdown.html b/test/known-good/C/src/modal_models/ModalStartupShutdown.html index cd03a6a33..21360dab9 100644 --- a/test/known-good/C/src/modal_models/ModalStartupShutdown.html +++ b/test/known-good/C/src/modal_models/ModalStartupShutdown.html @@ -423,7 +423,19 @@ " -Startup 1 at (%lld, %u). +Startup 1 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -586,7 +598,19 @@ " -Startup 2 at (%lld, %u). +Startup 2 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -735,7 +759,19 @@ " -Shutdown 2 at (%lld, %u). +Shutdown 2 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -898,7 +934,19 @@ " -Shutdown 3 at (%lld, %u). +Shutdown 3 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -986,7 +1034,19 @@ " -Startup 4 at (%lld, %u). +Startup 4 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -1060,7 +1120,19 @@ " -Reset 4 at (%lld, %u). +Reset 4 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -1209,7 +1281,19 @@ " -Shutdown 4 at (%lld, %u). +Shutdown 4 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -1304,7 +1388,19 @@ " -Startup 5 at (%lld, %u). +Startup 5 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -1378,7 +1474,19 @@ " -Reset 5 at (%lld, %u). +Reset 5 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n @@ -1452,7 +1560,19 @@ " -Shutdown 5 at (%lld, %u). +Shutdown 5 at ( + + +" + + + PRINTF_TIME + + +" + + +, %u). \n diff --git a/test/known-good/C/src/multiport/MultiportMutableInputArray.html b/test/known-good/C/src/multiport/MultiportMutableInputArray.html index b917cfb27..c0ca93d8e 100644 --- a/test/known-good/C/src/multiport/MultiportMutableInputArray.html +++ b/test/known-good/C/src/multiport/MultiportMutableInputArray.html @@ -105,19 +105,37 @@ - SET_NEW_ARRAY(out[ + int - -0 + +* + + + array0 + + += -], + (int + + +* + + +)malloc( 3 -); + + + +* + + + sizeof(int)); @@ -132,19 +150,7 @@ - out[ - - -0 - - -] - - --> - - -value[ + array0[ 0 @@ -166,19 +172,7 @@ - out[ - - -0 - - -] - - --> - - -value[ + array0[ 1 @@ -200,19 +194,7 @@ - out[ - - -0 - - -] - - --> - - -value[ + array0[ 2 @@ -237,21 +219,14 @@ - - - - -// Dynamically allocate an output array of length 3. - - - SET_NEW_ARRAY(out[ + lf_set_array(out[ -1 +0 -], +], array0, 3 @@ -268,60 +243,59 @@ -// Above allocates the array, which then must be populated. +// Dynamically allocate an output array of length 3. - out[ + int - -1 + +* -] + array1 --> += -value[ + (int - -0 + +* -] +)malloc( - -= + +3 - -3 + +* -; + sizeof(int)); - out[ - - -1 + - -] + + + - --> + +// Above allocates the array, which then must be populated. + -value[ + array1[ -1 +0 ] @@ -333,26 +307,36 @@ -4 +3 ; - out[ + array1[ 1 -] +] --> += -value[ + + + +4 + + +; + + + + array1[ 2 @@ -373,6 +357,26 @@ ; + + + + + + lf_set_array(out[ + + +1 + + +], array1, + + +3 + + +); + + diff --git a/test/known-good/C/src/multiport/MultiportToMultiportArray.html b/test/known-good/C/src/multiport/MultiportToMultiportArray.html index 41a0ef019..857aeaaf0 100644 --- a/test/known-good/C/src/multiport/MultiportToMultiportArray.html +++ b/test/known-good/C/src/multiport/MultiportToMultiportArray.html @@ -197,13 +197,7 @@ 0 -; i < - - -2 - - -; i +; i < out_width; i + @@ -223,13 +217,37 @@ - SET_NEW_ARRAY(out[i], + int + + +* + + + array + + += + + + (int + + +* + + +)malloc( 3 -); + + + +* + + + sizeof(int)); @@ -244,13 +262,7 @@ - out[i] - - --> - - -value[ + array[ 0 @@ -281,13 +293,7 @@ - out[i] - - --> - - -value[ + array[ 1 @@ -318,13 +324,7 @@ - out[i] - - --> - - -value[ + array[ 2 @@ -354,6 +354,27 @@ ; + + + + + + + + +// Set the output + + + + lf_set_array(out[i], array, + + +3 + + +); + + } @@ -513,6 +534,31 @@ is_present) { + + printf( + + +" + + +Array length is %zu. + + +\n + + +" + + +, in[i] + + +-> + + +length); + + for (int j @@ -544,6 +590,31 @@ ) { + + printf( + + +" + + +Adding value %d. + + +\n + + +" + + +, in[i] + + +-> + + +value[j]); + + sum @@ -567,6 +638,39 @@ } + + } else { + + + + printf( + + +" + + +ERROR: Expected input to be present. + + +\n + + +" + + +); + + + + exit( + + +1 + + +); + + } diff --git a/test/known-good/C/src/serialization/ProtoNoPacking.html b/test/known-good/C/src/serialization/ProtoNoPacking.html index 9c99560a1..c42a04095 100644 --- a/test/known-good/C/src/serialization/ProtoNoPacking.html +++ b/test/known-good/C/src/serialization/ProtoNoPacking.html @@ -246,7 +246,7 @@ - SET_PRESENT(out); + lf_set_present(out); diff --git a/test/known-good/C/src/target/TypeSanitization.html b/test/known-good/C/src/target/TypeSanitization.html new file mode 100644 index 000000000..1458b14f3 --- /dev/null +++ b/test/known-good/C/src/target/TypeSanitization.html @@ -0,0 +1,365 @@ + +target + + + + + +CCpp + + + + + + + +preamble + + + { + + += + + + + + + +#include + + + + + + +#include + + + += + + +} + + + + + + + +reactor + + + + + +TestGeneric + + + { + + + + + + +input + + + + + +test_input + + +: + + + + + +T + + + + + + + + + + +reaction + + +( + + +test_input + + +) + + +{ + + += + + + + if (test_input + + +->is_present) + + + + { + + + + lf_print( + + +" + + +Got the test input + + +" + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +test + + + + + += + + + + + +new + + + + + +TestGeneric + + +< + + +std + + +:: + + +shared_ptr + + +< + + +std + + +:: + + +string + + +> + + +>() + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + + + +test + + +. + + +test_input + + + + + +{ + + += + + + + lf_set( + + +test + + +. + + +test_input + + +, std: + + +: + + +make_shared + + +< + + +std + + +:: + + +string + + +> + + +( + + +* + + +( + + +new + + + + + +std + + +:: + + +string + + +( + + +" + + +test + + +" + + +)))); + + + + + + += + + +} + + + +} + + + + + + diff --git a/test/known-good/C/src/DelayPointer.html b/test/known-good/C/src/token/DelayPointer.html similarity index 90% rename from test/known-good/C/src/DelayPointer.html rename to test/known-good/C/src/token/DelayPointer.html index afc282ede..333cc550f 100644 --- a/test/known-good/C/src/DelayPointer.html +++ b/test/known-good/C/src/token/DelayPointer.html @@ -335,24 +335,84 @@ = + + + + +// Default copy constructor is sufficient for this type. + + + + + + +// As is the default destructor. + + + + int + + +* + + + value + + += + + + (int + + +* + - SET_NEW(out); +)malloc(sizeof(int)); - + lf_token_t * -(out + to_send --> += -value) + lf_new_token((lf_port_base_t + + +* + + +)out, (void + + +* + + +)value, + + +1 + + +); + + + + + + +* + + +value = @@ -367,6 +427,10 @@ ; + + lf_set_token(out, to_send); + + @@ -666,7 +730,19 @@ " -After %lld nsec of logical time. +After + + +" + + + PRINTF_TIME + + +" + + + nsec of logical time. \n @@ -695,7 +771,19 @@ " -ERROR: Expected elapsed time to be 100000000. It was %lld. +ERROR: Expected elapsed time to be 100000000. It was + + +" + + + PRINTF_TIME + + +" + + +. \n diff --git a/test/known-good/C/src/token/TokenSetToken.html b/test/known-good/C/src/token/TokenSetToken.html new file mode 100644 index 000000000..4b93a160a --- /dev/null +++ b/test/known-good/C/src/token/TokenSetToken.html @@ -0,0 +1,604 @@ + +/** + + + + * Test using a token for setting an output and scheduling an action. + + + + * @author Edward A. Lee (eal@berkeley.edu) + + + + + + +*/ + + + +target + + + + + +C + + + { + + + + build-type + + +: + + +Debug + + +, + + + + timeout + + +: + + +2 + + + ms + + + +} + + + + + + + +import + + + + + +TokenPrint + + + + + +from + + + + + +" + + +lib/Token.lf + + +" + + + + + + + +preamble + + + { + + += + + + + + + +// NOTE: array.h will get included in the generated directories because + + + + + + +// it is in the file properties of lib/Token.lf. However, we still need + + + + + + +// this #include for the source file for TokenSource2. + + + + + + +#include "array.h" + + + += + + +} + + + + + + + +reactor + + + + + +TokenSource2 + + + { + + + + + + +output + + + + + +out + + +: + + + + + +int_array_t + + +* + + + + + + +state + + + + + +count + + +: + + + + + +int + + + + + += + + + + + +0 + + + + + + +timer + + + t( + + +0 + + +, + + +2 + + + ms) + + + + + + +logical + + + + + +action + + + + + +a + + +( + + +1 + + + ms): + + +int_array_t + + +* + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + out { + + += + + + + lf_set_destructor(out, int_array_destructor); + + + + lf_set_copy_constructor(out, int_array_copy_constructor); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +t, a) + + +-> + + + out, a { + + += + + + + int_array_t + + +* + + + array + + += + + + int_array_constructor( + + +3 + + +); + + + + for (size_t i + + += + + + + + +0 + + +; i < array + + +-> + + +length; i + + ++ + + ++ + + +) { + + + + array + + +-> + + +data[i] + + += + + + self + + +-> + + +count + + ++ + + ++ + + +; + + + + } + + + + lf_token_t + + +* + + + token + + += + + + lf_new_token((lf_port_base_t + + +* + + +)out, array, + + +1 + + +); + + + + lf_set_token(out, token); + + + + lf_schedule_token(a, + + +0 + + +, token); + + + + + + += + + +} + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +s + + + + + += + + + + + +new + + + + + +TokenSource2 + + +() + + + + + + +p + + + + + += + + + + + +new + + + + + +TokenPrint + + +() + + + + + + +s + + +. + + +out + + + + + +-> + + + + + +p + + +. + + +in + + + +} + + + + + + diff --git a/test/known-good/C/src/zephyr/unthreaded/HelloZephyr.html b/test/known-good/C/src/zephyr/unthreaded/HelloZephyr.html index 4da49a9f9..94b4a8f4e 100644 --- a/test/known-good/C/src/zephyr/unthreaded/HelloZephyr.html +++ b/test/known-good/C/src/zephyr/unthreaded/HelloZephyr.html @@ -26,6 +26,19 @@ " + +, + + + + single-threaded + + +: + + +true + } diff --git a/test/known-good/C/src/zephyr/unthreaded/picolib/Picolib.html b/test/known-good/C/src/zephyr/unthreaded/picolib/Picolib.html new file mode 100644 index 000000000..f7ebb277c --- /dev/null +++ b/test/known-good/C/src/zephyr/unthreaded/picolib/Picolib.html @@ -0,0 +1,190 @@ + +// A smoke test verifying that we can compile and run using picolibc also. + + + +target + + + + + +C + + + { + + + + platform + + +: + + +" + + +Zephyr + + +" + + +, + + + + timeout + + +: + + +10 + + + + + +sec + + +, + + + + fast + + +: + + +true + + +, + + + + files + + +: + + +" + + +prj.conf + + +" + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +timer + + + t( + + +0 + + +, + + +1 + + + + + +sec + + +) + + + + + + + + + + +reaction + + +( + + +t) { + + += + + + + printf( + + +" + + +Hello + + +\n + + +" + + +); + + + + + + += + + +} + + + +} + + + + + + diff --git a/test/known-good/Cpp/src/ArrayAsType.html b/test/known-good/Cpp/src/ArrayAsType.html index e71b8cb23..7411c0a8f 100644 --- a/test/known-good/Cpp/src/ArrayAsType.html +++ b/test/known-good/Cpp/src/ArrayAsType.html @@ -51,17 +51,38 @@ - -int + +{ - -[ + += - + + + + +std + + +:: + + +array + + + + 3 - -] + +> + + += + + +} @@ -218,17 +239,38 @@ - -int + +{ - -[ + += - + + + + +std + + +:: + + +array + + + + 3 - -] + +> + + += + + +} diff --git a/test/known-good/Cpp/src/ArrayPrint.html b/test/known-good/Cpp/src/ArrayPrint.html index 9537c48ad..9d0dcd70c 100644 --- a/test/known-good/Cpp/src/ArrayPrint.html +++ b/test/known-good/Cpp/src/ArrayPrint.html @@ -51,17 +51,38 @@ - -int + +{ - -[ + += + + + + + +std + + +:: + + +array + + + - + 3 - -] + +> + + += + + +} @@ -333,17 +354,38 @@ - -int + +{ - -[ + += + + + + + +std + + +:: + + +array + + + - + 3 - -] + +> + + += + + +} diff --git a/test/known-good/Cpp/src/ArrayScale.html b/test/known-good/Cpp/src/ArrayScale.html index b8281040f..ef0cb7e9e 100644 --- a/test/known-good/Cpp/src/ArrayScale.html +++ b/test/known-good/Cpp/src/ArrayScale.html @@ -107,17 +107,38 @@ - -int + +{ - -[ + += + + + + + +std + + +:: - + +array + + + + 3 - -] + +> + + += + + +} @@ -142,17 +163,38 @@ - -int + +{ - -[ + += + + + + + +std + + +:: - + +array + + + + 3 - -] + +> + + += + + +} diff --git a/test/known-good/Cpp/src/MovingAverage.html b/test/known-good/Cpp/src/MovingAverage.html index 007a198ec..c63fe3c79 100644 --- a/test/known-good/Cpp/src/MovingAverage.html +++ b/test/known-good/Cpp/src/MovingAverage.html @@ -261,20 +261,38 @@ - -double + +{ - -[ + += - + + + + +std + + +:: + + +array + + + + 3 - -] + +> + + += -{ +}{ 0.0 diff --git a/test/known-good/Cpp/src/NativeListsAndTimes.html b/test/known-good/Cpp/src/NativeListsAndTimes.html index 59c38a259..890cec940 100644 --- a/test/known-good/Cpp/src/NativeListsAndTimes.html +++ b/test/known-good/Cpp/src/NativeListsAndTimes.html @@ -70,7 +70,7 @@ 0 -, +, // Units are missing but not required @@ -95,7 +95,7 @@ msec -, +, // Type is missing but not required @@ -105,10 +105,16 @@ p: -int +std + + +:: + + +vector -[]{ +{ 1 @@ -132,7 +138,7 @@ 4 -}, +}, // List of integers @@ -215,13 +221,43 @@ - g: + g: { - -time + += + + + + + +std + + +:: + + +vector + + +< + + +reactor + + +:: + + +Duration -[]{ +> + + += + + +}{ 1 @@ -245,20 +281,35 @@ msec -}, +, - -// List of time values + +3 + + + + + +msec + + +}, g2: -int +std + + +:: + + +vector -[] + = @@ -624,12 +675,24 @@ + + +std + + +:: + + +vector + + +< int -[] +> = diff --git a/test/known-good/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.html b/test/known-good/Cpp/src/enclave/EnclaveCommunicationMultiportBankToMultiportBank.html similarity index 73% rename from test/known-good/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.html rename to test/known-good/Cpp/src/enclave/EnclaveCommunicationMultiportBankToMultiportBank.html index 663d5ce71..f65484792 100644 --- a/test/known-good/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.html +++ b/test/known-good/Cpp/src/enclave/EnclaveCommunicationMultiportBankToMultiportBank.html @@ -1,34 +1,3 @@ - -/** - - - - * This tests that the precedence order of reaction invocation is kept in the hierarchy of reactors - - - - * when a feedback loop is present in decentralized coordination. - - - - * - - - - * @author Edward A. Lee - - - - * @author Soroush Bateni - - - - - - -*/ - - target @@ -36,58 +5,33 @@ -C +Cpp { - flags - - -: - - -" - - --Wall - - -" - - -, - - - - coordination + timeout : - -decentralized + +1 -, + s, - timeout + workers : -4900 - - - - - -msec +1 @@ -98,75 +42,118 @@ - -import + +reactor -Contained +Src - +(bank_index: + + +std - -from + +:: + + +size_t - -" + += - -../LoopDistributedCentralizedPrecedenceHierarchy.lf + + - -" + +0 - +) { + + + + + +timer + + + t( + + +0 + + +, + + +100 + + + ms) + + + -reactor +output - +[ - -Looper + +4 -(incr: +] - -int + +out +: + + - -= + +int + - + - -1 + +state -, delay: + - -time + +counter +: + + - + +int + + + + + = @@ -175,103 +162,134 @@ 0 + - + + + + + - -msec + +reaction -, stp_offset: +( - -time + +t) + + +-> - + out { = + - + for (auto& port : - -0 + +out ) { - + - -input + +port - - + +. -in +set -: +(bank_index - - + ++ - -int + + counter); - - - -output + } + - + counter - -out + += -: + counter - + ++ + + - -int + +4 + + +; + += + + +} + + + +} + + + + + + -state +reactor - -count + +Sink -: +(bank_index: - - + +std - -int + +:: - - + +size_t + + + = @@ -280,6 +298,9 @@ 0 + +) { + @@ -297,73 +318,94 @@ , -1 +50 - - - -sec + ms) + -) + + + +input - - +[4] in: + + + + + +int - -c + +state - -= + +received +: + + - -new + +bool - + - - -Contained -(incr - - = - incr) + + + +false - in + - --> + +state - -c + +iteration - -. + +: - -in + + + + +int + + + + + += + + + + + +0 @@ -380,296 +422,405 @@ ( -t) +in) { --> += + - out { + received = - - lf_set(out, self + - --> + +true -count); +; - self + int value[ - --> + +4 -count - - -+ +] = - self + { - --> + +0 -incr; +, + + +0 - - +, - -= + +0 -} +, + + +0 - - +}; - + for(int i - -reaction + += + + +0 -( +; i< + + +4 -in) { +; i -= ++ + + ++ + + +){ - instant_t time_lag + value[i] = - lf_time_physical() + + + +* + + +in[i] -- +. - lf_time_logical(); +get(); - char time_buffer[ + - -28 + +reactor + + +:: + + +log + + +:: + + +Info + + +() << + + +" + + +Sink + + +" + + +<< bank_index << + + +" + + +: Received + + +" -]; + << value[i] << - -// 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + +" - - - lf_readable_time(time_buffer, time_lag); + + in port: + + +" - - lf_print( + << i << " -Received %d. Logical time is behind physical time by %s nsec. + at " -, in + << get_elapsed_logical_time(); - --> + + + } + -value, time_buffer); + - + for(int i = + +0 + -} +; i< - -STP + +4 -(stp_offset) { +; i -= ++ + + ++ + + +){ - instant_t time_lag + if (value[i] ! = - lf_time_physical() + iteration -- +* - - lf_time_logical(); + +4 - - char time_buffer[ + - -28 + ++ -]; - - -// 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + bank_index) { - lf_readable_time(time_buffer, time_lag); + + + +reactor + + +:: + + +log + + +:: + + +Error - - lf_print( +() << " -STP offset was violated. Received %d. Logical time is behind physical time by %s nsec. +Expected to recive " -, in + << iteration --> +* - -value, time_buffer); + +4 - - + -= ++ -} - - -deadline + bank_index; + -( + exit( -10 +1 - +); - -msec + + + } + -) { + } - -= + + + - instant_t time_lag + auto expected = - lf_time_physical() + 100ms -- +* - lf_time_logical(); + iteration; - char time_buffer[ + iteration - -28 + ++ - -]; + ++ - -// 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + +; - lf_readable_time(time_buffer, time_lag); + if (get_elapsed_logical_time() ! + + += + + + expected) { - lf_print( + + + +reactor + + +:: + + +log + + +:: + + +Error + + +() << " -Deadline miss. Received %d. Logical time is behind physical time by %s nsec. +Expected value at " -, in + << expected; - --> + + + exit( + + +1 -value, time_buffer); +); + + + + } @@ -706,73 +857,119 @@ - lf_print( + if(!received) { + + + + + + +reactor + + +:: + + +log + + +:: + + +Error + + +() << " -******* Shutdown invoked. +Nothing received. " -); +; - if (self + exit( - --> + +1 + + +); + + + } + + -count ! + = - +} - -5 + + + + - + - -* + +reaction + + +( - self +t) { --> += + -incr) { + + + +reactor + + +:: + + +log + + +:: + + +Info - - lf_print_error_and_exit( +() << " -Failed to receive all five expected inputs. +Tick " -); - - - - } +; @@ -794,7 +991,7 @@ -federated +main @@ -803,53 +1000,17 @@ reactor -(delay: - - -time - - - - - -= - - - - - -0 - - -) { + { - - -left - - - -= - - - - - -new - - - - - -Looper +@ -(stp_offset +enclave(each = @@ -857,14 +1018,8 @@ - -5 - - - - - -msec + +true ) @@ -874,7 +1029,7 @@ -right +src @@ -889,28 +1044,23 @@ new - +[ - -Looper + +4 -(incr - - -= +] Src() + - + -- - - -1 +@ -, stp_offset +enclave(each = @@ -918,14 +1068,8 @@ - -5 - - - - - -msec + +true ) @@ -935,38 +1079,39 @@ -left - - -. - - -out +sink --> += - -right + +new - -. + +[ - -in + +4 + + +] Sink() + + + + -right +src . @@ -984,7 +1129,7 @@ -left +sink . diff --git a/test/known-good/C/src/federated/failing/DistributedNetworkOrderDecentralized.html b/test/known-good/Cpp/src/enclave/EnclaveCommunicationMultiportBankToMultiportBankInterleave.html similarity index 72% rename from test/known-good/C/src/federated/failing/DistributedNetworkOrderDecentralized.html rename to test/known-good/Cpp/src/enclave/EnclaveCommunicationMultiportBankToMultiportBankInterleave.html index 5ec360825..d153b109f 100644 --- a/test/known-good/C/src/federated/failing/DistributedNetworkOrderDecentralized.html +++ b/test/known-good/Cpp/src/enclave/EnclaveCommunicationMultiportBankToMultiportBankInterleave.html @@ -1,38 +1,3 @@ - -/** - - - - * This is a test for send_timed_message, which is an internal API. This version of the test uses - - - - * the decentralized coordination. - - - - * - - - - * FIXME: Because this test sends messages with intended tag out of order, it will fail. - - - - * - - - - * @author Soroush Bateni - - - - - - -*/ - - target @@ -40,7 +5,7 @@ -C +Cpp { @@ -56,23 +21,17 @@ 1 - - - -sec - - -, + s, - coordination + workers : - -decentralized + +1 @@ -90,32 +49,34 @@ -Sender +Src - { +(bank_index: - - - + +std - -output + +:: + + +size_t - -out + += -: - - - -int + +0 + + +) { @@ -134,236 +95,262 @@ , -1 - - - - - -msec +100 -) + ms) - + + + +output - - +[ - -reaction + +4 -( +] + + +out -t) { +: - -= + + + + +int - int payload + - -= + +state - -1 + +counter -; +: - - - if (lf_time_logical_elapsed() + + - -= + +int - -= + + - 0LL) { += - - send_timed_message(MSEC( + -10 +0 + -), MSG_TYPE_P2P_TAGGED_MESSAGE, - - -0 + + -, + - -1 + +reaction -, - - -" +( - -federate 1 + +t) - -" + +-> -, sizeof(int), + out { + + += - (unsigned char + for (auto& port : - -* + +out -)&payload); +) { - } else if (lf_time_logical_elapsed() + - -= + +port -= +. + + +set - MSEC( +(bank_index - -5 + ++ -)) { + counter); - payload + } + + + + counter = + + counter + + ++ + -2 +4 ; - send_timed_message(MSEC( + - -5 + += -), MSG_TYPE_P2P_TAGGED_MESSAGE, +} - -0 + + +} + -, + - -1 + + +reactor -, + - -" + +Sink - -federate 1 + +(bank_index: - -" + +std - -, sizeof(int), + +:: + + +size_t - - (unsigned char + -* += -)&payload); + + + +0 - - } +) { - -= + +timer -} + t( + + +0 - -} +, + + +50 - - + ms) + + + -reactor +input - +[4] in: - -Receiver + + - - { + +int -input +state -in +received : @@ -372,7 +359,19 @@ -int +bool + + + + + += + + + + + +false @@ -385,7 +384,7 @@ -success +iteration : @@ -430,192 +429,303 @@ - tag_t current_tag + received = - lf_tag(); + + + +true + + +; - if ( + int value[ - -current_tag + +4 + + +] -. += - -time + + { + + +0 - +, + + +0 + + +, + + +0 + + +, + + +0 + + +}; + + + + for(int i = + +0 + + +; i< + + +4 + + +; i + + ++ + + ++ + + +){ + + + + value[i] + = - (lf_time_start() + -+ +* - MSEC( +in[i] - -10 + +. + + +get(); + + + + + + +reactor + + +:: + + +log + + +:: + + +Info + + +() << + + +" + + +Sink + + +" + + +<< bank_index << + + +" + + +: Received + + +" + + + << value[i] << + + +" + + + in port: + + +" + + + << i << + + +" + + + at + + +" -))) { + << get_elapsed_logical_time(); - if ( - - -current_tag - - -. - - -microstep + } + - + - -= + + + for(int i = - - - 0 - && in +; i< - --> + +4 -value +; i -= ++ -= - - - - - -1 ++ -) { +){ - self + if (value[i] ! --> += -success + iteration -+ +* + + +4 + + + + -; + i) { - } else if ( + - -current_tag + +reactor -. - - -microstep +:: - - + +log -= +:: - -= + +Error - +() << - -1 + +" - - && in + +Expected to recive - --> + +" -value + << iteration -= +* - -= + +4 - -2 + ++ -) { + i; - self + exit( - --> + +1 -success - - -+ - - -+ +); + -; + } @@ -623,96 +733,96 @@ - } + - printf( - - -" + auto expected - -Received %d at tag (%lld, %u) with intended tag (%lld, %u). + += - -\n + + 100ms - -" + +* -, + iteration; - in + iteration --> ++ - -value, + ++ - - lf_time_logical_elapsed(), +; - lf_tag() + if (get_elapsed_logical_time() ! -. += -microstep, + expected) { - in + + + +reactor --> +:: -intended_tag +log -. +:: - -time + +Error - +() << - -- + +" + + +Expected value at + + +" - lf_time_start(), + << expected; - in - - --> - - -intended_tag - - -. + exit( - -microstep + +1 ); + + } + + @@ -747,48 +857,45 @@ - if (self - - --> + if(!received) { + -success ! + + + +reactor -= +:: - - + +log - -2 + +:: - -) { + +Error - - fprintf(stderr, +() << " -ERROR: Failed to receive messages. - - -\n +Nothing received. " -); +; - exit( + exit( 1 @@ -798,26 +905,71 @@ - } + } + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +t) { + + += - printf( + + + +reactor + + +:: + + +log + + +:: + + +Info + + +() << " -SUCCESS. - - -\n +Tick " -); +; @@ -839,7 +991,7 @@ -federated +main @@ -853,9 +1005,31 @@ + + +@ + + +enclave(each + + += + + + + + +true + + +) + + + + -sender +src @@ -870,20 +1044,42 @@ new +[ + + +4 + + +] Src() + + + + + + +@ + + +enclave(each + + += + + - -Sender + +true -() +) -receiver +sink @@ -898,13 +1094,13 @@ new - +[ - -Receiver + +4 -() +] Sink() @@ -915,7 +1111,7 @@ -sender +src . @@ -931,9 +1127,15 @@ + + +interleaved + + +( -receiver +sink . @@ -941,6 +1143,9 @@ in + +) + } diff --git a/test/known-good/Cpp/src/multiport/MultiportToMultiportAfterParameterized.html b/test/known-good/Cpp/src/multiport/MultiportToMultiportAfterParameterized.html new file mode 100644 index 000000000..2a5a17f0b --- /dev/null +++ b/test/known-good/Cpp/src/multiport/MultiportToMultiportAfterParameterized.html @@ -0,0 +1,754 @@ + +// Test multiport to multiport connections. See also MultiportToMultiport. + + + +target + + + + + +Cpp + + + + + + + +reactor + + + + + +Source + + +(width: + + +size_t + + + + + += + + + + + +2 + + +) { + + + + + + +output + + +[ + + +width + + +] + + +out + + +: + + + + + +size_t + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + out { + + += + + + + for (size_t i + + += + + + + + +0 + + +; i < + + +out + + +. + + +size + + +(); i + + ++ + + ++ + + +) { + + + + out[i] + + +. + + +set(i); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +Destination + + +(width: + + +size_t + + + + + += + + + + + +2 + + +) { + + + + + + +input + + +[width] in: + + + + + +size_t + + + + + + + + + + +reaction + + +( + + +in) { + + += + + + + for (size_t i + + += + + + + + +0 + + +; i < + + +in + + +. + + +size + + +(); i + + ++ + + ++ + + +) { + + + + if (in[i] + + +. + + +is_present()) { + + + + size_t value + + += + + + + + +* + + +in[i] + + +. + + +get(); + + + + + + +std + + +:: + + +cout + + + << + + +" + + +Received on channel + + +" + + + << i << + + +" + + +: + + +" + + + << value << + + +' + + +\n + + +' + + +; + + + + + + +// NOTE: For testing purposes, this assumes the specific + + + + + + +// widths instantiated below. + + + + if (value ! + + += + + + i + + +% + + + + + +3 + + +) { + + + + + + +std + + +:: + + +cerr + + + << + + +" + + +ERROR: expected + + +" + + + << i + + +% + + + + + +3 + + + << + + +' + + +\n + + +' + + +; + + + + exit( + + +1 + + +); + + + + } + + + + } + + + + } + + + + if (get_elapsed_logical_time() ! + + += + + + 1s) { + + + + + + +std + + +:: + + +cerr + + + << + + +" + + +ERROR: Expected to receive input after one second. + + +\n + + +" + + +; + + + + exit( + + +2 + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +main + + + + + +reactor + + +(delay: + + +time + + + + + += + + + + + +1 + + + + + +sec + + +) { + + + + + + +a1 + + + + + += + + + + + +new + + + + + +Source + + +(width + + += + + +3 + + +) + + + + + + +a2 + + + + + += + + + + + +new + + + + + +Source + + +(width + + += + + +2 + + +) + + + + + + +b + + + + + += + + + + + +new + + + + + +Destination + + +(width + + += + + +5 + + +) + + + + + + +a1 + + +. + + +out + + +, + + +a2 + + +. + + +out + + + + + +-> + + + + + +b + + +. + + +in + + + + + +after + + + delay + + + +} + + + + + + diff --git a/test/known-good/Cpp/src/multiport/MultiportToMultiportArray.html b/test/known-good/Cpp/src/multiport/MultiportToMultiportArray.html index 0d73bc819..b4c808248 100644 --- a/test/known-good/Cpp/src/multiport/MultiportToMultiportArray.html +++ b/test/known-good/Cpp/src/multiport/MultiportToMultiportArray.html @@ -117,17 +117,38 @@ - -int + +{ - -[ + += - + + + + +std + + +:: + + +array + + + + 3 - -] + +> + + += + + +} @@ -478,17 +499,38 @@ - -int + +{ - -[ + += - + + + + +std + + +:: + + +array + + + + 3 - -] + +> + + += + + +} diff --git a/test/known-good/Python/src/MovingAverage.html b/test/known-good/Python/src/MovingAverage.html index c87cd023d..f53cacf6c 100644 --- a/test/known-good/Python/src/MovingAverage.html +++ b/test/known-good/Python/src/MovingAverage.html @@ -239,7 +239,13 @@ delay_line -( + + + += + + + [ 0.0 @@ -257,7 +263,7 @@ 0.0 -) +] @@ -501,7 +507,13 @@ TestDouble -(expected( +(expected + + += + + + [ 0.0 @@ -537,7 +549,7 @@ 3.5 -)) +]) diff --git a/test/known-good/Python/src/NativeListsAndTimes.html b/test/known-good/Python/src/NativeListsAndTimes.html index 8dbb53e29..366e3bdc7 100644 --- a/test/known-good/Python/src/NativeListsAndTimes.html +++ b/test/known-good/Python/src/NativeListsAndTimes.html @@ -52,7 +52,7 @@ 0 -, +, # Units are missing but not required @@ -77,14 +77,20 @@ msec -, +, # Type is missing but not required - p( + p + + += + + + [ 1 @@ -108,14 +114,20 @@ 4 -), +], # List of integers - q( + q + + += + + + [ 1 @@ -151,7 +163,7 @@ msec -), +], # list of time values @@ -165,7 +177,13 @@ - g( + g + + += + + + [ 1 @@ -189,7 +207,7 @@ msec -)) { +]) { @@ -436,7 +454,13 @@ bar -( + + + += + + + [ 1 @@ -472,7 +496,7 @@ msec -) +] # list of time values @@ -491,7 +515,13 @@ notype -( + + + += + + + [ 1 @@ -515,7 +545,7 @@ 4 -) +] diff --git a/test/known-good/Python/src/federated/failing/ClockSync.html b/test/known-good/Python/src/federated/failing/ClockSync.html index 4950fa8ff..543c35bd0 100644 --- a/test/known-good/Python/src/federated/failing/ClockSync.html +++ b/test/known-good/Python/src/federated/failing/ClockSync.html @@ -432,11 +432,15 @@ - interval_t offset = _lf_time_physical_clock_offset + _lf_time_test_physical_clock_offset; + // FIXME: _lf_clock_sync_constant_bias has been removed. - lf_print("Clock sync error at startup is %lld ns.", offset); + interval_t offset = _lf_clock_sync_offset + _lf_clock_sync_constant_bias; + + + + lf_print("Clock sync error at startup is " PRINTF_TIME " ns.", offset); @@ -493,11 +497,11 @@ - interval_t offset = _lf_time_physical_clock_offset + _lf_time_test_physical_clock_offset; + interval_t offset = _lf_clock_sync_offset + _lf_clock_sync_constant_bias; - lf_print("Clock sync error at shutdown is %lld ns.", offset); + lf_print("Clock sync error at shutdown is " PRINTF_TIME " ns.", offset); diff --git a/test/known-good/Python/src/federated/failing/DistributedNetworkOrder.html b/test/known-good/Python/src/federated/failing/DistributedNetworkOrder.html index fbd685430..c3da5c13c 100644 --- a/test/known-good/Python/src/federated/failing/DistributedNetworkOrder.html +++ b/test/known-good/Python/src/federated/failing/DistributedNetworkOrder.html @@ -302,7 +302,7 @@ - printf("Received %d at tag (%lld, %u).\n", + printf("Received %d at tag (" PRINTF_TIME ", %u).\n", diff --git a/test/known-good/Python/src/federated/failing/LoopDistributedDouble.html b/test/known-good/Python/src/federated/failing/LoopDistributedDouble.html index 157f30e63..23336d516 100644 --- a/test/known-good/Python/src/federated/failing/LoopDistributedDouble.html +++ b/test/known-good/Python/src/federated/failing/LoopDistributedDouble.html @@ -435,7 +435,7 @@ - lf_print("Received %d at logical time (%lld, %d).", + lf_print("Received %d at logical time (" PRINTF_TIME ", %d).", @@ -475,7 +475,7 @@ - lf_print("Received %d on in2 at logical time (%lld, %d).", + lf_print("Received %d on in2 at logical time (" PRINTF_TIME ", %d).", @@ -515,7 +515,7 @@ - lf_print("Timer triggered at logical time (%lld, %d).", + lf_print("Timer triggered at logical time (" PRINTF_TIME ", %d).", diff --git a/test/known-good/Python/src/lib/Test.html b/test/known-good/Python/src/lib/Test.html index a03a50e19..12de3853b 100644 --- a/test/known-good/Python/src/lib/Test.html +++ b/test/known-good/Python/src/lib/Test.html @@ -22,7 +22,13 @@ TestDouble -(expected( +(expected + + += + + + [ 1.0 @@ -46,7 +52,7 @@ 1.0 -)) { +]) { diff --git a/test/known-good/Python/src/modal_models/BanksCount3ModesComplex.html b/test/known-good/Python/src/modal_models/BanksCount3ModesComplex.html index 301141929..b9a307e1d 100644 --- a/test/known-good/Python/src/modal_models/BanksCount3ModesComplex.html +++ b/test/known-good/Python/src/modal_models/BanksCount3ModesComplex.html @@ -858,7 +858,7 @@ = - ( + [ // keep-format @@ -3488,7 +3488,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/BanksCount3ModesSimple.html b/test/known-good/Python/src/modal_models/BanksCount3ModesSimple.html index 38168ed42..3b753b45d 100644 --- a/test/known-good/Python/src/modal_models/BanksCount3ModesSimple.html +++ b/test/known-good/Python/src/modal_models/BanksCount3ModesSimple.html @@ -230,7 +230,7 @@ = - ( + [ // keep-format @@ -648,7 +648,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/BanksModalStateReset.html b/test/known-good/Python/src/modal_models/BanksModalStateReset.html index 07f908201..a3147bd8c 100644 --- a/test/known-good/Python/src/modal_models/BanksModalStateReset.html +++ b/test/known-good/Python/src/modal_models/BanksModalStateReset.html @@ -320,7 +320,7 @@ = - ( + [ // keep-format @@ -4210,7 +4210,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/ConvertCaseTest.html b/test/known-good/Python/src/modal_models/ConvertCaseTest.html index a77e447c0..8dbc55840 100644 --- a/test/known-good/Python/src/modal_models/ConvertCaseTest.html +++ b/test/known-good/Python/src/modal_models/ConvertCaseTest.html @@ -1234,7 +1234,7 @@ = - ( + [ // keep-format @@ -1790,7 +1790,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/ModalActions.html b/test/known-good/Python/src/modal_models/ModalActions.html index 6cd2f1fc3..a624eed3a 100644 --- a/test/known-good/Python/src/modal_models/ModalActions.html +++ b/test/known-good/Python/src/modal_models/ModalActions.html @@ -732,7 +732,7 @@ = - ( + [ // keep-format @@ -1786,7 +1786,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/ModalAfter.html b/test/known-good/Python/src/modal_models/ModalAfter.html index 6467f0c16..258ed35e1 100644 --- a/test/known-good/Python/src/modal_models/ModalAfter.html +++ b/test/known-good/Python/src/modal_models/ModalAfter.html @@ -989,7 +989,7 @@ = - ( + [ // keep-format @@ -2043,7 +2043,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/ModalCycleBreaker.html b/test/known-good/Python/src/modal_models/ModalCycleBreaker.html index fb7dd9587..868cdb5b9 100644 --- a/test/known-good/Python/src/modal_models/ModalCycleBreaker.html +++ b/test/known-good/Python/src/modal_models/ModalCycleBreaker.html @@ -656,7 +656,7 @@ = - ( + [ // keep-format @@ -858,7 +858,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/ModalStartupShutdown.html b/test/known-good/Python/src/modal_models/ModalStartupShutdown.html index d47e15845..ccda822ad 100644 --- a/test/known-good/Python/src/modal_models/ModalStartupShutdown.html +++ b/test/known-good/Python/src/modal_models/ModalStartupShutdown.html @@ -1108,7 +1108,7 @@ = - ( + [ // keep-format @@ -2674,7 +2674,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/ModalStateReset.html b/test/known-good/Python/src/modal_models/ModalStateReset.html index a7b3db367..d10abf5e2 100644 --- a/test/known-good/Python/src/modal_models/ModalStateReset.html +++ b/test/known-good/Python/src/modal_models/ModalStateReset.html @@ -770,7 +770,7 @@ = - ( + [ // keep-format @@ -1888,7 +1888,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/ModalStateResetAuto.html b/test/known-good/Python/src/modal_models/ModalStateResetAuto.html index 426d62612..616f3f3d0 100644 --- a/test/known-good/Python/src/modal_models/ModalStateResetAuto.html +++ b/test/known-good/Python/src/modal_models/ModalStateResetAuto.html @@ -708,7 +708,7 @@ = - ( + [ // keep-format @@ -1826,7 +1826,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/ModalTimers.html b/test/known-good/Python/src/modal_models/ModalTimers.html index 88ab6b1b0..60a281a58 100644 --- a/test/known-good/Python/src/modal_models/ModalTimers.html +++ b/test/known-good/Python/src/modal_models/ModalTimers.html @@ -545,7 +545,7 @@ = - ( + [ // keep-format @@ -1055,7 +1055,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/MultipleOutputFeeder_2Connections.html b/test/known-good/Python/src/modal_models/MultipleOutputFeeder_2Connections.html index 5ccc37c40..40a880d63 100644 --- a/test/known-good/Python/src/modal_models/MultipleOutputFeeder_2Connections.html +++ b/test/known-good/Python/src/modal_models/MultipleOutputFeeder_2Connections.html @@ -661,7 +661,7 @@ = - ( + [ // keep-format @@ -1039,7 +1039,7 @@ - ), training + ], training = diff --git a/test/known-good/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.html b/test/known-good/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.html index ad2678ea3..16155b315 100644 --- a/test/known-good/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.html +++ b/test/known-good/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.html @@ -685,7 +685,7 @@ = - ( + [ // keep-format @@ -1063,7 +1063,7 @@ - ), training + ], training = diff --git a/test/known-good/Rust/src/NativeListsAndTimes.html b/test/known-good/Rust/src/NativeListsAndTimes.html index 0009babd6..21acb1de3 100644 --- a/test/known-good/Rust/src/NativeListsAndTimes.html +++ b/test/known-good/Rust/src/NativeListsAndTimes.html @@ -70,7 +70,7 @@ 0 -, +, // Units are missing but not required @@ -95,20 +95,38 @@ msec -, +, // Type is missing but not required - p: + p: { - -i32 + += + + + [i32; + + +4 + + +] + + += + + +} + + += -[]( + [ 1 @@ -132,20 +150,20 @@ 4 -), +], -// List of integers +// array of integers p2: -i32 +Vec -[] + = @@ -175,28 +193,26 @@ // List of integers with single element - - + + q: - -// todo // p2: i32[](1), // List of integers with single element p3: i32[](), // Empty list of + +Vec - - - + + - -// integers List of time values + += - - q: + { - -Vec + += -( + vec![delay!( 1 @@ -208,7 +224,7 @@ msec -, +), delay!( 2 @@ -220,7 +236,7 @@ msec -, +), delay!( 3 @@ -232,24 +248,48 @@ msec -), +)] + + += + + +}, -// List of time values +// Array of time values - g: + g: { - -time + += + + + [Duration; + + +2 + + +] + + += + + +} + + += -[]( + [ 1 @@ -273,7 +313,7 @@ msec -)) { +]) { @@ -493,44 +533,6 @@ // Implicit type time - - - - -/** - - - - * fixme following should be equivalent: - - - - * - state baz(p); - - - - * - state baz: i32[4](p); - - - - * - state baz: i32[4]({=p=}); - - - - * - - - - * because the initializer is the same modulo fat braces - - - - - - -*/ - - @@ -610,7 +612,37 @@ = -}>>(q, g) +}>> + + += + + + { + + += + + + vec![q, + + +g + + +. + + +to_vec + + +() ] + + += + + +} // a list of lists diff --git a/test/known-good/Rust/src/TypeVarLengthList.html b/test/known-good/Rust/src/TypeVarLengthList.html index 509927c08..e17922c19 100644 --- a/test/known-good/Rust/src/TypeVarLengthList.html +++ b/test/known-good/Rust/src/TypeVarLengthList.html @@ -16,10 +16,6 @@ // this thing must compile needs to be modified when - -// https://github.com/lf-lang/lingua-franca/discussions/492 is implemented - - main @@ -56,12 +52,18 @@ + + +Vec + + +< i32 -[] +> = @@ -97,41 +99,65 @@ // generates l0: Vec::new() - + - -// generates l1: vec![1, 2] + +state - - + - -/** + +l1 - - - * - state l2: i32[](1); // generates l2: 1 // doesn't compile... + +: - - - * - state l3: i32[](); // doesn't parse... + + - - - * + +Vec - - - * - state l1: Vec(1, 2); // does not compile... + +< - - - + +i32 + + +> + + += - -*/ + + { + + += + + + vec![ + + +1 + + +, + + +2 + + +] + + += + + +} @@ -144,7 +170,7 @@ -l1 +l2 : @@ -152,14 +178,32 @@ - -i32 + +{ + + += + + + [i32; + + +2 + + +] + + += -[] +} + + += -( + [ 1 @@ -171,7 +215,7 @@ 2 -) +] diff --git a/test/known-good/TypeScript/src/NativeListsAndTimes.html b/test/known-good/TypeScript/src/NativeListsAndTimes.html index cb5557076..8e880e2ef 100644 --- a/test/known-good/TypeScript/src/NativeListsAndTimes.html +++ b/test/known-good/TypeScript/src/NativeListsAndTimes.html @@ -70,7 +70,7 @@ 0 -, +, // Units are missing but not required @@ -95,7 +95,7 @@ msec -, +, // Type is missing but not required @@ -108,7 +108,13 @@ number -[]( +[] + + += + + + [ 1 @@ -132,12 +138,19 @@ 4 -), +], // List of integers + + + + +// list of time values + + q: @@ -145,22 +158,16 @@ TimeValue -[]( - - -1 +[] - - - - -msec + += -, + [ -2 +1 @@ -172,39 +179,7 @@ , -3 - - - - - -msec - - -), - - -// list of time values - - - - - - -// List of time values - - - - g: - - -time - - -[]( - - -1 +2 @@ -216,7 +191,7 @@ , -2 +3 @@ -225,7 +200,7 @@ msec -)) { +]) {