update to regression testing framework
Paul Millar
paulm at astro.gla.ac.uk
Fri Apr 12 13:45:10 CDT 2002
On 11 Apr 2002, Alexandre Julliard wrote:
> I think it's much more useful to have line numbers, it makes it much
> easier to find the offending test.
If they don't have a meaningful name, sure, but if the name is suitably
unique then grep -n, /, or Ctrl+S should work.
> Most tests scripts will contain
> thousands of individual tests and you won't be able to come up with
> meaningful names for them anyway.
A lot of those are the same test repeated for different parameters. If the
name incorporated the parameters (w/ a printf-style expansion) it wouldn't
be too hard. Also, any unmodified test would work as before.
> For the same reason, I don't think
> displaying every successful test is really useful. Traces are a much
> better way to see what's going on IMO.
It would be nice (for me anyway :) if tests were line-number independent.
As naming tests seems to be a stumbling block, I've attached a patch that
just allows announcement of successful test results. I'm hoping it's
acceptable. Named tests can wait for another day ...
----
Paul Millar
-------------- next part --------------
Index: programs/winetest/runtest
===================================================================
RCS file: /home/wine/wine/programs/winetest/runtest,v
retrieving revision 1.7
diff -u -r1.7 runtest
--- programs/winetest/runtest 28 Mar 2002 18:21:06 -0000 1.7
+++ programs/winetest/runtest 12 Apr 2002 18:15:58 -0000
@@ -32,6 +32,7 @@
Options:
-q quiet mode
-v verbose mode (can be specified multiple times)
+ -s announce successful tests
-p prog name of the program to run for C tests
-I dir prepend dir to Perl include path
-P name set the current platform name
@@ -60,6 +61,7 @@
if ($arg eq "-p") { $program = shift @ARGV; next; }
if ($arg eq "-q") { $ENV{WINETEST_DEBUG} = 0; next; }
if ($arg eq "-v") { $ENV{WINETEST_DEBUG}++; next; }
+ if ($arg eq "-s") { $ENV{WINETEST_REPORT_SUCCESS} = 1; next;}
if ($arg eq "-P") { $platform = shift @ARGV; next; }
if ($arg eq "-M") { push @modules, split /,/, shift @ARGV; next; }
if ($arg eq "-I") { push @include_dirs, shift @ARGV; next; }
Index: programs/winetest/wtmain.c
===================================================================
RCS file: /home/wine/wine/programs/winetest/wtmain.c,v
retrieving revision 1.5
diff -u -r1.5 wtmain.c
--- programs/winetest/wtmain.c 2 Apr 2002 00:44:17 -0000 1.5
+++ programs/winetest/wtmain.c 12 Apr 2002 18:15:58 -0000
@@ -32,6 +32,9 @@
/* current platform */
const char *winetest_platform = "windows";
+/* report successful tests (BOOL) */
+int winetest_report_success = 0;
+
struct test
{
const char *name;
@@ -123,7 +126,13 @@
InterlockedIncrement(&failures);
return 0;
}
- else InterlockedIncrement(&successes);
+ else
+ {
+ if( winetest_report_success)
+ fprintf( stderr, "%s:%d: Test succeeded\n",
+ data->current_file, data->current_line);
+ InterlockedIncrement(&successes);
+ }
}
return 1;
}
@@ -238,6 +247,8 @@
if ((p = getenv( "WINETEST_PLATFORM" ))) winetest_platform = p;
if ((p = getenv( "WINETEST_DEBUG" ))) winetest_debug = atoi(p);
+ if ((p = getenv( "WINETEST_REPORT_SUCCESS"))) winetest_report_success = \
+ atoi(p);
if (!argv[1])
{
fprintf( stderr, "Usage: %s test_name\n", argv[0] );
Index: programs/winetest/include/wine.pm
===================================================================
RCS file: /home/wine/wine/programs/winetest/include/wine.pm,v
retrieving revision 1.4
diff -u -r1.4 wine.pm
--- programs/winetest/include/wine.pm 10 Mar 2002 00:21:20 -0000 1.4
+++ programs/winetest/include/wine.pm 12 Apr 2002 18:15:58 -0000
@@ -26,6 +26,7 @@
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD $todo_level
$successes $failures $todo_successes $todo_failures
+ $winetest_report_success
%return_types %prototypes %loaded_modules);
require Exporter;
@@ -63,6 +64,8 @@
$todo_successes = 0;
$todo_failures = 0;
%loaded_modules = ();
+$winetest_report_success = defined($ENV{WINETEST_REPORT_SUCCESS}) ? $ENV{WINETEST_REPORT_SUCCESS} : 0;
+
# --------------------------------------------------------------
# | Return-type constants |
@@ -466,7 +469,11 @@
($description ? ": $description" : "") . "\n");
$failures++;
}
- else { $successes++; }
+ else
+ {
+ print STDERR ("$filename:$line: Test succeeded\n") if ($winetest_report_success);
+ $successes++;
+ }
}
}
More information about the wine-devel
mailing list