summaryrefslogtreecommitdiffstats
path: root/pintos-progos/tests/threads/priority-fifo.ck
diff options
context:
space:
mode:
Diffstat (limited to 'pintos-progos/tests/threads/priority-fifo.ck')
-rw-r--r--pintos-progos/tests/threads/priority-fifo.ck63
1 files changed, 63 insertions, 0 deletions
diff --git a/pintos-progos/tests/threads/priority-fifo.ck b/pintos-progos/tests/threads/priority-fifo.ck
new file mode 100644
index 0000000..11f1dd3
--- /dev/null
+++ b/pintos-progos/tests/threads/priority-fifo.ck
@@ -0,0 +1,63 @@
1# -*- perl -*-
2
3# The expected output looks like this:
4#
5# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
6# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
7# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
8# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
9# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
10# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
11# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
12# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
13# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
14# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
15# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
17# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
18# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
19# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
20# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
21#
22# A different permutation of 0...15 is acceptable, but every line must
23# be in the same order.
24
25use strict;
26use warnings;
27use tests::tests;
28
29our ($test);
30my (@output) = read_text_file ("$test.output");
31
32common_checks ("run", @output);
33
34my ($thread_cnt) = 16;
35my ($iter_cnt) = 16;
36my (@order);
37my (@t) = (-1) x $thread_cnt;
38
39my (@iterations) = grep (/iteration:/, @output);
40fail "No iterations found in output.\n" if !@iterations;
41
42my (@numbering) = $iterations[0] =~ /(\d+)/g;
43fail "First iteration does not list exactly $thread_cnt threads.\n"
44 if @numbering != $thread_cnt;
45
46my (@sorted_numbering) = sort { $a <=> $b } @numbering;
47for my $i (0...$#sorted_numbering) {
48 if ($sorted_numbering[$i] != $i) {
49 fail "First iteration does not list all threads "
50 . "0...$#sorted_numbering\n";
51 }
52}
53
54for my $i (1...$#iterations) {
55 if ($iterations[$i] ne $iterations[0]) {
56 fail "Iteration $i differs from iteration 0\n";
57 }
58}
59
60fail "$iter_cnt iterations expected but " . scalar (@iterations) . " found\n"
61 if $iter_cnt != @iterations;
62
63pass;