2009-02-10 Jeffrey Stedfast <fejj@novell.com>
[mono-project/dkf.git] / mcs / tests / gen-test.pl
blob63791536cb72df7965e38efc7c0adb74bf1628e3
1 #!/usr/bin/perl -w
3 my $gmcs = "gmcs";
4 my $monodis = "monodis";
5 my $mono = "mono";
7 my @normal = qw[gen-1 gen-2 gen-3 gen-4 gen-5 gen-6 gen-7 gen-8 gen-9 gen-10 gen-11 gen-12
8 gen-14 gen-15 gen-16 gen-18 gen-19 gen-20 gen-21 gen-22 gen-23 gen-24 gen-25
9 gen-26 gen-27 gen-28 gen-29 gen-30 gen-32 gen-33 gen-34 gen-35 gen-36 gen-37
10 gen-38 gen-39 gen-40 gen-41 gen-42 gen-43 gen-44 gen-45 gen-46 gen-48 gen-49
11 gen-50 gen-51 gen-52 gen-53 gen-54 gen-55 gen-56 gen-58 gen-59 gen-60 gen-62
12 gen-63 gen-64];
13 my @compileonly = qw[];
14 my @library = qw[gen-13 gen-17 gen-31 gen-47];
16 sub RunTest
18 my ($quiet,@args) = @_;
19 my $cmdline = join ' ', @args;
21 $cmdline .= " > /dev/null" if $quiet;
23 print "Running $cmdline\n";
25 my $exitcode = system $cmdline;
26 if ($exitcode != 0) {
27 print "Command failed!\n";
28 return 0;
31 return 1;
34 sub NormalTest
36 my ($file) = @_;
38 my $cs = qq[$file.cs];
39 my $exe = qq[$file.exe];
41 RunTest (0, $gmcs, $cs) or return 0;
42 RunTest (1, $monodis, $exe) or return 0;
43 RunTest (1, $mono, $exe) or return 0;
45 return 1;
48 sub CompileOnlyTest
50 my ($file) = @_;
52 my $cs = qq[$file.cs];
53 my $exe = qq[$file.exe];
55 RunTest (0, $gmcs, $cs) or return 0;
57 return 1;
60 sub LibraryTest
62 my ($file) = @_;
64 my $cs_dll = qq[$file-dll.cs];
65 my $dll = qq[$file-dll.dll];
66 my $cs_exe = qq[$file-exe.cs];
67 my $exe = qq[$file-exe.exe];
69 RunTest (0, $gmcs, "/target:library", $cs_dll) or return 0;
70 RunTest (1, $monodis, $dll) or return 0;
71 RunTest (0, $gmcs, "/r:$dll", $cs_exe) or return 0;
72 RunTest (1, $monodis, $exe) or return 0;
73 RunTest (0, $mono, $exe) or return 0;
76 my @verify;
77 push @verify, "cologne";
78 push @verify, 'bin/peverify.sh';
80 foreach my $file (@normal) {
81 print "RUNNING TEST: $file\n";
82 if (NormalTest ($file)) {
83 print STDERR "TEST SUCCEEDED: $file\n";
84 push @verify, qq[$file.exe];
85 } else {
86 print STDERR "TEST FAILED: $file\n";
90 foreach my $file (@compileonly) {
91 print "RUNNING COMPILATION ONLY TEST: $file\n";
92 if (CompileOnlyTest ($file)) {
93 print STDERR "TEST SUCCEEDED: $file\n";
94 push @verify, qq[$file.exe];
95 } else {
96 print STDERR "TEST FAILED: $file\n";
100 foreach my $file (@library) {
101 print "RUNNING LIBRARY TEST: $file\n";
102 if (LibraryTest ($file)) {
103 print STDERR "TEST SUCCEEDED: $file\n";
104 push @verify, qq[$file-dll.dll];
105 push @verify, qq[$file-exe.exe];
106 } else {
107 print STDERR "TEST FAILED: $file\n";
111 my $hostname = `hostname --fqdn`;
112 chop $hostname;
114 if ($hostname eq 'gondor.boston.ximian.com') {
115 print STDERR "VERIFYING TESTS\n";
116 RunTest (0, "ssh", @verify);