[use YAML to specify properties of regression tests
John Meacham <john@repetae.net>**20100722073802
 Ignore-this: 8fa4dd28d9ef681aa74c74a47ef5c009
] hunk ./regress/regress.prl 6
+use YAML;
hunk ./regress/regress.prl 10
+use Storable qw(dclone);
hunk ./regress/regress.prl 74
-
-
hunk ./regress/regress.prl 153
+sub to_list {
+    return () unless defined $_[0];
+    if(ref $_[0] eq 'ARRAY') {
+        return @{$_[0]};
+    } else {
+        return split /\s+/, $_[0];
+    }
+}
+
+sub combine_yaml {
+    my ($oy, $y) = @_;
+    my $ny = dclone $oy;
+    foreach(keys %$ny) {
+        next unless exists $y->{$_};
+        if(ref $ny->{$_} eq 'ARRAY') {
+            $ny->{$_} = [ @{$ny->{$_}}, to_list($y->{$_}) ];
+        } else {
+            $ny->{$_} = $y->{$_};
+        }
+    }
+    return $ny;
+}
+
hunk ./regress/regress.prl 177
-    my ($cwd,$name) = @_;
+    my ($cwd,$name, $oy) = @_;
+    my ($y,$yc) = ($oy,{});
+    if(-f "$cwd/config.yaml") {
+        $yc = YAML::LoadFile("$cwd/config.yaml");
+        $y = combine_yaml($oy, $yc);
+    }
hunk ./regress/regress.prl 184
-    my $no_run = -f "$cwd/norun";
-    my @flags = maybe_read "$cwd/flags.txt";
hunk ./regress/regress.prl 191
-            do_it($n,"$name.$fnn");
+            do_it($n,$name ? "$name.$fnn" : $fnn, $y);
hunk ./regress/regress.prl 194
-            my $must_fail = -f "$cwd/$ln.mustfail" ? 1 : 0;
+            my $y = combine_yaml($y, $yc->{tests}{$ln});
+            my $must_fail = (0 + $y->{jhc_exit_code}) != 0;
+            my $no_run = $y->{run} eq 'no';
+            my @flags = @{$y->{jhc_flags}};
hunk ./regress/regress.prl 207
-                    rlog "Skipping $name";
hunk ./regress/regress.prl 212
-                    rlog "Skipping $name";
hunk ./regress/regress.prl 242
-            my @args = maybe_read("$fbase.args");
+            my @args = @{$y->{args}};
hunk ./regress/regress.prl 268
-do_it($test_dir,"tests");
+do_it($test_dir,"", {
+        jhc_flags => [],
+        cc_flags => [],
+        run_args => [],
+        jhc_exit_code => 0,
+        args => [],
+        libs => [],
+        run => 'yes'
+    });
addfile ./regress/tests/0_prim/config.yaml
hunk ./regress/tests/0_prim/config.yaml 1
+jhc_flags: -c
+run: no
hunk ./regress/tests/0_prim/flags.txt 1
--c
rmfile ./regress/tests/0_prim/flags.txt
rmfile ./regress/tests/0_prim/norun
hunk ./regress/tests/1_io/basic/Args.args 1
-Foo Bar Baz
rmfile ./regress/tests/1_io/basic/Args.args
addfile ./regress/tests/1_io/basic/config.yaml
hunk ./regress/tests/1_io/basic/config.yaml 1
+tests:
+  Args:
+   args: [Foo, Bar, Baz]
addfile ./regress/tests/4_fixed_bugs/config.yaml
hunk ./regress/tests/4_fixed_bugs/config.yaml 1
+tests:
+  rectypes:
+    jhc_exit_code: 1
+  Parsing1:
+    run: no
+    jhc_flags: -c --stale Main
rmfile ./regress/tests/4_fixed_bugs/rectypes.mustfail
addfile ./regress/tests/5_known_bugs/ExportUnknown.hs
hunk ./regress/tests/5_known_bugs/ExportUnknown.hs 1
+module Main(foo) where
+
+bar = "hello"
addfile ./regress/tests/5_known_bugs/MultiplyDefined.hs
hunk ./regress/tests/5_known_bugs/MultiplyDefined.hs 1
+
+
+main = do
+    putStrLn "Hello, World!"
+
+main = do
+    putStrLn "Goodbye, World!"
+
rmfile ./regress/tests/5_known_bugs/Shadowing.mustfail
addfile ./regress/tests/5_known_bugs/config.yaml
hunk ./regress/tests/5_known_bugs/config.yaml 1
+tests:
+  MultiplyDefined:
+    jhc_exit_code: 1
+  Shadowing:
+    jhc_exit_code: 1
+  ExportUnknown:
+    jhc_flags: [ "--stale", "Main",  "-c" ]
+    jhc_exit_code: 1
hunk ./regress/tests/7_large/RayT.args 1
-2 100
rmfile ./regress/tests/7_large/RayT.args
addfile ./regress/tests/7_large/config.yaml
hunk ./regress/tests/7_large/config.yaml 1
+tests:
+  RayT:
+   args: 2 100
hunk ./regress/tests/8_shootout/BinaryTrees.args 1
-12
rmfile ./regress/tests/8_shootout/BinaryTrees.args
hunk ./regress/tests/8_shootout/Mandelbrot.args 1
-1000
rmfile ./regress/tests/8_shootout/Mandelbrot.args
hunk ./regress/tests/8_shootout/PartialSums.args 1
-250
rmfile ./regress/tests/8_shootout/PartialSums.args
addfile ./regress/tests/8_shootout/config.yaml
hunk ./regress/tests/8_shootout/config.yaml 1
+tests:
+  BinaryTrees:
+    args: 12
+  Mandelbrot:
+    args: 1000
+  nbody:
+    args: 129333
+  PartialSums:
+    args: 250
hunk ./regress/tests/8_shootout/nbody.args 1
-129333
rmfile ./regress/tests/8_shootout/nbody.args
addfile ./regress/tests/9_nofib/config.yaml
hunk ./regress/tests/9_nofib/config.yaml 1
+tests:
+  digits-of-e1:
+    args: 1000
hunk ./regress/tests/9_nofib/digits-of-e1.args 1
-1000
rmfile ./regress/tests/9_nofib/digits-of-e1.args
hunk ./regress/tests/9_nofib/spectral/Calendar.args 1
-2034
rmfile ./regress/tests/9_nofib/spectral/Calendar.args
addfile ./regress/tests/9_nofib/spectral/config.yaml
hunk ./regress/tests/9_nofib/spectral/config.yaml 1
+tests:
+ Calendar:
+   args: 2034
+ constraints:
+   args: 7
hunk ./regress/tests/9_nofib/spectral/constraints.args 1
-7
rmfile ./regress/tests/9_nofib/spectral/constraints.args