unit_tests/run_tests.pl
changeset 885 29b6d4c4a7a2
parent 876 e005b1f38952
child 888 3f13aefabfce
--- a/unit_tests/run_tests.pl	Wed Mar 03 09:13:26 2010 -0800
+++ b/unit_tests/run_tests.pl	Thu Mar 04 22:59:48 2010 -0800
@@ -81,7 +81,31 @@
 };
 
 $tests{'errors'} = sub {
-    return (-1, 'Unimplemented');  # !!! FIXME
+    my ($module, $fname) = @_;
+    my $error_output = 'unittest_temperroutput';
+    my $output = 'unittest_tempoutput';
+    my $desired = $fname . '.correct';
+    my $cmd = undef;
+    my $endlines = 1;
+
+    # !!! FIXME: this should go elsewhere.
+    if ($module eq 'preprocessor') {
+        $cmd = "$binpath/mojoshader-compiler -P '$fname' -o '$output'";
+    } else {
+        return (0, "Don't know how to do this module type");
+    }
+    $cmd .= " 2>$error_output 1>/dev/null";
+
+    print("$cmd\n") if ($GPrintCmds);
+
+    system($cmd);
+    unlink($output) if (-f $output);
+
+    if (not -f $error_output) { return (0, "Didn't get any error output"); }
+
+    my @retval = compare_files($desired, $error_output, $endlines);
+    unlink($error_output);
+    return @retval;
 };
 
 my $totaltests = 0;