summaryrefslogtreecommitdiffstats
path: root/pintos-progos/tests/threads/alarm.pm
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2012-03-26 12:54:45 +0200
committermanuel <manuel@mausz.at>2012-03-26 12:54:45 +0200
commitb5f0874cd96ee2a62aabc645b9626c2749cb6a01 (patch)
tree1262e4bbe0634de6650be130c36e0538240f4cbf /pintos-progos/tests/threads/alarm.pm
downloadprogos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.tar.gz
progos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.tar.bz2
progos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.zip
initial pintos checkin
Diffstat (limited to 'pintos-progos/tests/threads/alarm.pm')
-rw-r--r--pintos-progos/tests/threads/alarm.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/pintos-progos/tests/threads/alarm.pm b/pintos-progos/tests/threads/alarm.pm
new file mode 100644
index 0000000..84b3b7f
--- /dev/null
+++ b/pintos-progos/tests/threads/alarm.pm
@@ -0,0 +1,32 @@
1sub check_alarm {
2 my ($iterations) = @_;
3 our ($test);
4
5 @output = read_text_file ("$test.output");
6 common_checks ("run", @output);
7
8 my (@products);
9 for (my ($i) = 0; $i < $iterations; $i++) {
10 for (my ($t) = 0; $t < 5; $t++) {
11 push (@products, ($i + 1) * ($t + 1) * 10);
12 }
13 }
14 @products = sort {$a <=> $b} @products;
15
16 local ($_);
17 foreach (@output) {
18 fail $_ if /out of order/i;
19
20 my ($p) = /product=(\d+)$/;
21 next if !defined $p;
22
23 my ($q) = shift (@products);
24 fail "Too many wakeups.\n" if !defined $q;
25 fail "Out of order wakeups ($p vs. $q).\n" if $p != $q; # FIXME
26 }
27 fail scalar (@products) . " fewer wakeups than expected.\n"
28 if @products != 0;
29 pass;
30}
31
321;