Make tests public. Rewrite most tests. Add tests.
[pintos-anon] / src / tests / vm / process_death.pm
diff --git a/src/tests/vm/process_death.pm b/src/tests/vm/process_death.pm
new file mode 100644 (file)
index 0000000..b9a194b
--- /dev/null
@@ -0,0 +1,22 @@
+# -*- perl -*-
+use strict;
+use warnings;
+use tests::tests;
+
+sub check_process_death {
+    my ($proc_name) = @_;
+    our ($test);
+    my (@output) = read_text_file ("$test.output");
+
+    common_checks (@output);
+    @output = get_core_output (@output);
+    fail "First line of output is not `($proc_name) begin' message.\n"
+      if $output[0] ne "($proc_name) begin";
+    fail "Output missing '$proc_name: exit(-1)' message.\n"
+      if !grep ("$proc_name: exit(-1)" eq $_, @output);
+    fail "Output contains '($proc_name) end' message.\n"
+      if grep (/\($proc_name\) end/, @output);
+    pass;
+}
+
+1;