2 # A simple unit testing script
3 # (c) 2004 Martin Mares <mj@ucw.cz>
14 } elsif (defined($append_to) && /^\s+(.*)$/) {
15 $$append_to .= "\n$1";
16 } elsif (my ($n,$v) = /^(\w+):\s+(.*)$/) {
21 ($tt->{$n}) && die "$n already defined";
23 $append_to = \($tt->{$n});
25 die "Test script syntax error";
32 foreach $tt (@tests) {
35 $run = ($tt->{'Run'} || $prev_run) or die "Don't know what to run";
38 if (defined $tt->{'In'}) {
39 $ifi = "run/tmp/test$i.in";
40 open X, ">$ifi" or die "Unable to create $ifi";
41 print X $tt->{'In'}, "\n";
45 $run .= " </dev/null";
47 if (defined $tt->{'Out'}) {
48 $ofi = "run/tmp/test$i.out";
52 $run .= " >/dev/null";
56 print "FAILED with exit code $?\n";
60 if (defined $tt->{'Out'}) {
61 open X, "<$ofi" or die "Unable to read $ofi";
68 if ($out ne $tt->{'Out'} . "\n") {
69 print "FAILED (see $ofi)\n";