(PLATFORM_LIB): New. Possibly refer to ../os/libmonoos.la.
[mono.git] / mono / tests / test-driver
1 #!/usr/bin/env perl 
2
3 my $interpreter = shift;
4 my $test = shift;
5 my $disabled_tests = shift;
6 my $output = $test;
7 my $stdout = $test.'.stdout';
8 my $stderr = $test.'.stderr';
9
10 $output =~ s/\.exe$/.output/;
11
12 $| = 0;
13 print "Testing $test... ";
14
15 if (index ($disabled_tests, $test) >= 0) {
16         print "disabled.\n";
17         exit (0);
18 }
19
20 my $res = system("$interpreter @ARGV $test 2>/dev/null 1>$stdout");
21
22 if ($res) {
23         printf ("failed $? (%d) signal (%d).\n", $? >> 8, $? & 127);
24         if (($? & 127) == 2) {
25                 exit (2);
26         } else {
27                 exit (1);
28         }
29 } elsif (-f $output) {
30         print "failed output.\n" if (read_file ($output) ne read_file ($stdout));
31         exit (1);
32 } else {
33         print "pass.\n";
34         #unlink ($result);
35 }
36 exit (0);
37
38 sub read_file {
39         local ($/);
40         my $out = shift;
41         open (F, "<$out") || die $!;
42         $out = <F>;
43         close(F);
44         return $out;
45 }