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";
31 foreach $tt (@tests) {
34 my $run = $tt->{'Run'} or die "Don't know what to run";
36 if (defined $tt->{'In'}) {
37 $ifi = "run/tmp/test$i.in";
38 open X, ">$ifi" or die "Unable to create $ifi";
39 print X $tt->{'In'}, "\n";
43 $run .= " </dev/null";
45 if (defined $tt->{'Out'}) {
46 $ofi = "run/tmp/test$i.out";
50 $run .= " >/dev/null";
54 print "FAILED with exit code $?\n";
58 if (defined $tt->{'Out'}) {
59 open X, "<$ofi" or die "Unable to read $ofi";
66 if ($out ne $tt->{'Out'} . "\n") {
67 print "FAILED (see $ofi)\n";