-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test case for checking large deadlines
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |