[add ability to test differnt rts options to the regression tester
John Meacham <john@repetae.net>**20110202075527
 Ignore-this: a182aa702796d783fbe9e45a1ba6a712
] move ./regress/tests/4_fixed_bugs ./regress/tests/6_fixed_bugs
adddir ./regress/tests/4_rts
hunk ./regress/regress.prl 181
+sub run_test {
+    my ($cwd, $y, $name, $ln, $fn) = @_;
+    $fn = $y->{progname} unless defined $fn;
+    return if defined $y->{skip};
+    my $must_fail = (0 + $y->{jhc_exit_code}) != 0;
+    my $no_run = $y->{run} eq 'no';
+    my @flags = @{$y->{jhc_flags}};
+    return if $ln =~ /_code$/;
+    $fn =~ /^([^_].*)\.l?hs$/ or return;
+    my $fbase = "$cwd/$1";
+    $name = "$name.$ln";
+    if(@cond) {
+        my $keep = 0;
+        foreach (@cond) {
+            $keep = 1 if $name  =~ /$_/;
+        }
+        unless($keep) {
+            return;
+        }
+    }
+    foreach (@ncond) {
+        if($name =~ /$_/) {
+            return;
+        }
+    }
+    rlog "---- $name";
+    my @jhc  = $opt_p ? ("$jhc_dir/jhcp",'+RTS', "-S$rd/$name.jhcp_prof",@opt_rts,'-RTS')  :  ("$jhc_dir/jhc");
+    my @cmd = (@jhc, ($verbose ? ('-v') : ()), ($opt_win ? ('-mwin32') : ()), @libs , @fast, '-o', "$rd/$name", @flags, @opts, "$cwd/$fn");
+    my $res = join(" ",@cmd) . " > '$rd/$name.jhc_out' 2>&1";
+    my ($r,$time) = my_system $res;
+    my $result = { name => $name, compile_command => $res, compile_status => $r, compile_results => "$rd/$name.jhc_out", compile_time => $time };
+    push @res, $result;
+    if($must_fail) {
+        if($r == 0) {
+            rlog "Compilation Succeeded When It shouldn't!";
+            $error++;
+            $result->{compile_status} = 'BAD';
+            return;
+        } else {
+            $result->{compile_status} = 'pass';
+            return;
+        }
+    } else {
+        if($r == 0) {
+            $result->{compile_status} = 'pass';
+        } else {
+            $error++;
+        }
+    }
+    unless($r == 0) {
+        rlog "Compilation Failed: $r";
+        my $msg = `tail $result->{compile_results}`;
+        rlog $msg;
+        $error++;
+        if(statf($r) eq 'INT') {done()};
+        return;
+    }
+    return if $no_run || $opt_tc;
+    my @args = @{$y->{args}};
+    $result->{run_stdout} = "$rd/$name.stdout";
+    my $discard_stderr = $y->{discard_stderr} ? " 2> /dev/null" : "";
+    my $stdin = " < $fbase.stdin" if -f "$fbase.stdin";
+    my $run_cmd = (($opt_win || $y->{opt_win}) ? "$rd/$name.exe " : "$rd/$name ") . join(" ",@args) . " > '$result->{run_stdout}'$discard_stderr" . ($stdin || "");
+    $result->{run_cmd} = $run_cmd;
+    ($r,$time) = my_system $run_cmd;
+    $result->{run_status} = $r;
+    $result->{run_time} = $time;
+    unless($r == 0) {
+        rlog "-- Run Failed: $r";
+        $error++;
+        if(statf($r) eq 'INT') {done()};
+        return;
+    }
+
+    if(-f "$fbase.expected.stdout" ) {
+        $result->{expected_stdout} = "$fbase.expected.stdout";
+        my $r = system "diff --strip-trailing-cr $result->{run_stdout} $result->{expected_stdout}";
+        $result->{stdout_diff} = $r;
+        $error++ if $r ne 0;
+    }
+}
+
hunk ./regress/regress.prl 272
-    test: foreach my $fn (sort readdir $dh) {
+    my %done;
+    foreach my $fn (sort readdir $dh) {
hunk ./regress/regress.prl 281
-            my $ln = $1;
-            my $y = combine_yaml($y, $yc->{tests}{$ln});
-            next if defined $y->{skip};
-            my $must_fail = (0 + $y->{jhc_exit_code}) != 0;
-            my $no_run = $y->{run} eq 'no';
-            my @flags = @{$y->{jhc_flags}};
-            next if $ln =~ /_code$/;
-            my $fbase = "$cwd/$ln";
-            my $name = "$name.$ln";
-            if(@cond) {
-                my $keep = 0;
-                foreach (@cond) {
-                $keep = 1 if $name  =~ /$_/;
-                }
-                unless($keep) {
-                    next;
-                }
-            }
-            foreach (@ncond) {
-                if($name =~ /$_/) {
-                    next test;
-                }
-            }
-            rlog "---- $name";
-            my @jhc  = $opt_p ? ("$jhc_dir/jhcp",'+RTS', "-S$rd/$name.jhcp_prof",@opt_rts,'-RTS')  :  ("$jhc_dir/jhc");
-            my @cmd = (@jhc, ($verbose ? ('-v') : ()), ($opt_win ? ('-mwin32') : ()), @libs , @fast, '-o', "$rd/$name", @flags, @opts, "$cwd/$fn");
-            my $res = join(" ",@cmd) . " > '$rd/$name.jhc_out' 2>&1";
-            my ($r,$time) = my_system $res;
-            my $result = { name => $name, compile_command => $res, compile_status => $r, compile_results => "$rd/$name.jhc_out", compile_time => $time };
-            push @res, $result;
-            if($must_fail) {
-                if($r == 0) {
-                    rlog "Compilation Succeeded When It shouldn't!";
-                    $error++;
-                    $result->{compile_status} = 'BAD';
-                    next;
-                } else {
-                    $result->{compile_status} = 'pass';
-                    next;
-                }
-            } else {
-                if($r == 0) {
-                    $result->{compile_status} = 'pass';
-                } else {
-                    $error++;
-                }
-            }
-            unless($r == 0) {
-                rlog "Compilation Failed: $r";
-                my $msg = `tail $result->{compile_results}`;
-                rlog $msg;
-                $error++;
-                if(statf($r) eq 'INT') {done()};
-                next;
-            }
-            next if $no_run || $opt_tc;
-            my @args = @{$y->{args}};
-            $result->{run_stdout} = "$rd/$name.stdout";
-            my $stdin = " < $fbase.stdin" if -f "$fbase.stdin";
-            my $run_cmd = ($opt_win ? "$rd/$name.exe " : "$rd/$name ") . join(" ",@args) . " > $result->{run_stdout}" . ($stdin || "");
-            $result->{run_cmd} = $run_cmd;
-            ($r,$time) = my_system $run_cmd;
-            $result->{run_status} = $r;
-            $result->{run_time} = $time;
-            unless($r == 0) {
-                rlog "-- Run Failed: $r";
-                $error++;
-                if(statf($r) eq 'INT') {done()};
-                next;
-            }
-
-            if(-f "$fbase.expected.stdout" ) {
-                $result->{expected_stdout} = "$fbase.expected.stdout";
-                my $r = system "diff --strip-trailing-cr $result->{run_stdout} $result->{expected_stdout}";
-                $result->{stdout_diff} = $r;
-                $error++ if $r ne 0;
-            }
+            $done{$1} = 1;
+            my $y = combine_yaml($y, $yc->{tests}{$1});
+            run_test($cwd,$y,$name,$1,$fn);
hunk ./regress/regress.prl 286
+    foreach my $t (sort keys %{$y->{tests}}) {
+        next if $done{$t}++;
+        my $y = combine_yaml($y, $yc->{tests}{$t});
+        run_test($cwd,$y,$name,$t,undef);
+    }
hunk ./regress/regress.prl 301
+        progname => undef,
hunk ./regress/regress.prl 303
+        opt_win => undef,
+        discard_stderr => undef,
addfile ./regress/tests/4_rts/HelloWorld.expected.stdout
hunk ./regress/tests/4_rts/HelloWorld.expected.stdout 1
+Hello, World!
addfile ./regress/tests/4_rts/HelloWorld.hs
hunk ./regress/tests/4_rts/HelloWorld.hs 1
+
+
+main :: IO ()
+main = putStrLn "Hello, World!"
addfile ./regress/tests/4_rts/config.yaml
hunk ./regress/tests/4_rts/config.yaml 1
+progname: HelloWorld.hs
+tests:
+  HelloWorld:
+  HelloWorld_jgc:
+    jhc_flags: -fjgc
+  HelloWorld_no_jgc:
+    jhc_flags: -fno-jgc
+  HelloWorld_64:
+    jhc_flags: -m64
+  HelloWorld_32:
+    jhc_flags: -m32
+  HelloWorld_profile:
+    jhc_flags: -fprofile
+    discard_stderr: 1
+  HelloWorld_debug:
+    jhc_flags: -fdebug
+  HelloWorld_boehm:
+    jhc_flags: -mgc=boehm
+  HelloWorld_fullint:
+    jhc_flags: -m32 -ffull-int
+  HelloWorld_nofullint:
+    jhc_flags: -m32 -fno-full-int
+  HelloWorld_win:
+    jhc_flags: -mwin32
+    opt_win: 1
+
hunk ./src/Grin/Main.hs 92
-        boehmOpts | fopts FO.Boehm || lup "gc" == "boehm"  = ["-D_JHC_GC=_JHC_GC_BOEHM", "-lgc"]
-                  | fopts FO.Jgc || lup "gc" == "jgc"  = ["-D_JHC_GC=_JHC_GC_JGC"]
+        boehmOpts | fopts FO.Boehm = ["-D_JHC_GC=_JHC_GC_BOEHM", "-lgc"]
+                  | fopts FO.Jgc   = ["-D_JHC_GC=_JHC_GC_JGC"]
hunk ./src/rts/jhc_rts_alloc.c 29
-
hunk ./src/rts/jhc_rts_alloc.c 42
-
hunk ./src/rts/jhc_rts_alloc.c 58
-static void jhc_malloc_init(void) { GC_INIT(); }
-static void jhc_malloc_fini(void) {  }
-static void jhc_alloc_print_stats(void) { GC_dump(); }
-
+static void jhc_alloc_init(void) { GC_INIT(); }
+static void jhc_alloc_fini(void) { }
+static void jhc_alloc_print_stats(void) { }