Skip to content

Commit

Permalink
Add a test case for checking large deadlines
Browse files Browse the repository at this point in the history
  • Loading branch information
lsk567 committed Nov 11, 2024
1 parent 3380a43 commit 8aabe44
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/C/src/static/LargeDeadline.lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* This test checks if a deadline larger than the hyperperiod could lead
* to incorrect execution. Here, even though the deadline of 2 sec is
* larger than the hyperperiod, the state variable s should still
* increment up to 10.
*
* @author Shaokai Lin
*/
target C {
scheduler: STATIC,
workers: 1,
fast: true,
timeout: 9 sec,
}

preamble {=
#define EXPECTED 10
=}

reactor Deadline {
timer t(0, 1 sec)
state s:int = 0
@wcet("1 msec")
reaction(t) {=
self->s++;
=} deadline(2 sec) {==}
reaction(shutdown) {=
if (self->s != EXPECTED) {
fprintf(stderr, "Final value of %d does not match the expected value of %d\n", self->s, EXPECTED);
exit(1);
} else {
printf("Successfully received %d\n", EXPECTED);
}
=}
}

main reactor {
d = new Deadline()
}

0 comments on commit 8aabe44

Please sign in to comment.