7ed5cc86defbe41c3c2d5658269cd226097a9f7f
[pintos-anon] / src / tests / userprog / no-vm / multi-oom.ck
1 # -*- perl -*-
2 use strict;
3 use warnings;
4 use tests::tests;
5
6 our ($test);
7 my (@output) = read_text_file ("$test.output");
8 common_checks ("run", @output);
9
10 @output = get_core_output ("run", @output);
11 my ($n) = 0;
12 while (my ($m) = $output[0] =~ /^\(multi-oom\) begin (\d+)$/) {
13     fail "Child process $m started out of order.\n" if $m != $n;
14     $n = $m + 1;
15     shift @output;
16 }
17 fail "Only $n child process(es) started.\n" if $n < 15;
18
19 # There could be a death notice for a process that didn't get
20 # fully loaded, and/or notices from the loader.
21 while (@output > 0
22        && ($output[0] =~ /^multi-oom: exit\(-1\)$/
23            || $output[0] =~ /^load: /)) {
24     shift @output;
25 }
26
27 while (--$n >= 0) {
28     fail "Output ended unexpectedly before process $n finished.\n"
29       if @output < 2;
30
31     local ($_);
32     chomp ($_ = shift @output);
33     fail "Found '$_' expecting 'end' message.\n" if !/^\(multi-oom\) end/;
34     fail "Child process $n ended out of order.\n"
35       if !/^\(multi-oom\) end $n$/;
36
37     chomp ($_ = shift @output);
38     fail "Kernel didn't print proper exit message for process $n.\n"
39       if !/^multi-oom: exit\($n\)$/;
40 }
41 fail "Spurious output at end: '$output[0]'.\n" if @output;
42
43 pass;