Skip to content
Snippets Groups Projects
Commit 977c44c9 authored by Alexandre Julliard's avatar Alexandre Julliard
Browse files

winetest: Filter out color escapes for junit output.

parent 0b4d2cd2
No related branches found
No related tags found
No related merge requests found
......@@ -902,6 +902,24 @@ static void report_test_start( struct wine_test *test, const char *subtest, cons
xprintf( "%s:%s start %s\n", test->name, subtest, file );
}
/* filter out color escapes and null characters from test output data */
static void *filter_data( const char *data, DWORD size )
{
DWORD i, j;
char *ret = malloc( size + 1 );
for (i = j = 0; i < size; i++)
{
if (data[i] == '\x1b' && data[i + 1] == '[')
{
while (data[i] && data[i] != 'm') i++;
}
else if (data[i]) ret[j++] = data[i];
}
ret[j] = 0;
return ret;
}
static void report_test_done( struct wine_test *test, const char *subtest, const char *file, DWORD pid, DWORD ticks,
HANDLE out_file, UINT status, const char *data, DWORD size )
{
......@@ -914,8 +932,9 @@ static void report_test_done( struct wine_test *test, const char *subtest, const
int total = 0, fail_total = 0, skip_total = 0, failures = 0;
const char *next, *line, *ptr, *dir = strrchr( file, '/' );
float time, last_time = 0;
char *filtered_data = filter_data( data, size );
for (line = next = data; *line; line = next)
for (line = next = filtered_data; *line; line = next)
{
int count, todo_count, flaky_count, fail_count, skip_count;
......@@ -935,7 +954,7 @@ static void report_test_done( struct wine_test *test, const char *subtest, const
output( junit, " <testsuite name=\"%s:%s\" file=\"%s\" time=\"%f\" tests=\"%d\" failures=\"%d\" skipped=\"%d\">\n",
test->name, subtest, file, ticks / 1000.0, total, fail_total, skip_total );
for (line = next = data; *line; line = next)
for (line = next = filtered_data; *line; line = next)
{
struct { const char *pattern; int length; int error; } patterns[] =
{
......@@ -1009,6 +1028,7 @@ static void report_test_done( struct wine_test *test, const char *subtest, const
}
output( junit, " </testsuite>\n" );
free( filtered_data );
}
}
......@@ -1673,7 +1693,6 @@ int __cdecl main( int argc, char *argv[] )
}
if (junit)
{
SetEnvironmentVariableA( "WINETEST_COLOR", "0" );
SetEnvironmentVariableA( "WINETEST_TIME", "1" );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment