Added --list option to the tests and use that in winetest.

This commit is contained in:
Alexandre Julliard 2005-05-27 20:10:59 +00:00
parent eeb0a90ec9
commit 95b87814e8
2 changed files with 21 additions and 7 deletions

View File

@ -285,6 +285,16 @@ static const struct test *find_test( const char *name )
} }
/* Display list of valid tests */
static void list_tests(void)
{
const struct test *test;
fprintf( stdout, "Valid test names:\n" );
for (test = winetest_testlist; test->name; test++) fprintf( stdout, " %s\n", test->name );
}
/* Run a named test, and return exit status */ /* Run a named test, and return exit status */
static int run_test( const char *name ) static int run_test( const char *name )
{ {
@ -316,11 +326,8 @@ static int run_test( const char *name )
/* Display usage and exit */ /* Display usage and exit */
static void usage( const char *argv0 ) static void usage( const char *argv0 )
{ {
const struct test *test; fprintf( stdout, "Usage: %s test_name\n\n", argv0 );
list_tests();
fprintf( stdout, "Usage: %s test_name\n", argv0 );
fprintf( stdout, "\nValid test names:\n" );
for (test = winetest_testlist; test->name; test++) fprintf( stdout, " %s\n", test->name );
exit_process(1); exit_process(1);
} }
@ -345,6 +352,11 @@ int main( int argc, char **argv )
return run_test( winetest_testlist[0].name ); return run_test( winetest_testlist[0].name );
usage( argv[0] ); usage( argv[0] );
} }
if (!strcmp( argv[1], "--list" ))
{
list_tests();
return 0;
}
return run_test(argv[1]); return run_test(argv[1]);
} }

View File

@ -348,7 +348,7 @@ run_ex (char *cmd, const char *out, DWORD ms)
void void
get_subtests (const char *tempdir, struct wine_test *test, int id) get_subtests (const char *tempdir, struct wine_test *test, int id)
{ {
char *subname; char *subname, *cmd;
FILE *subfile; FILE *subfile;
size_t total; size_t total;
char buffer[8192], *index; char buffer[8192], *index;
@ -361,7 +361,9 @@ get_subtests (const char *tempdir, struct wine_test *test, int id)
if (!subname) report (R_FATAL, "Can't name subtests file."); if (!subname) report (R_FATAL, "Can't name subtests file.");
extract_test (test, tempdir, id); extract_test (test, tempdir, id);
run_ex (test->exename, subname, 5000); cmd = strmake (NULL, "%s --list", test->exename);
run_ex (cmd, subname, 5000);
free (cmd);
subfile = fopen (subname, "r"); subfile = fopen (subname, "r");
if (!subfile) { if (!subfile) {