summaryrefslogtreecommitdiffstats
path: root/tests/threads/alarm.pm
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2012-03-27 11:51:08 +0200
committermanuel <manuel@mausz.at>2012-03-27 11:51:08 +0200
commit4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b (patch)
tree868c52e06f207b5ec8a3cc141f4b8b2bdfcc165c /tests/threads/alarm.pm
parenteae0bd57f0a26314a94785061888d193d186944a (diff)
downloadprogos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.gz
progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.bz2
progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.zip
reorganize file structure to match the upstream requirements
Diffstat (limited to 'tests/threads/alarm.pm')
-rw-r--r--tests/threads/alarm.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/threads/alarm.pm b/tests/threads/alarm.pm
new file mode 100644
index 0000000..84b3b7f
--- /dev/null
+++ b/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;