winetest: Report failure for tests that print too much output.

This commit is contained in:
Alexandre Julliard 2022-09-14 17:03:24 +02:00
parent 93250eb56e
commit 657cdc1861

View file

@ -42,6 +42,9 @@
/* Don't submit the results if more than FAILURES_LIMIT tests have failed */ /* Don't submit the results if more than FAILURES_LIMIT tests have failed */
#define FAILURES_LIMIT 50 #define FAILURES_LIMIT 50
/* Maximum output size for individual test */
#define MAX_OUTPUT_SIZE (32 * 1024)
struct wine_test struct wine_test
{ {
char *name; char *name;
@ -871,19 +874,25 @@ run_test (struct wine_test* test, const char* subtest, HANDLE out_file, const ch
char *data, tmpname[MAX_PATH]; char *data, tmpname[MAX_PATH];
HANDLE tmpfile = create_temp_file( tmpname ); HANDLE tmpfile = create_temp_file( tmpname );
status = run_ex (cmd, tmpfile, tempdir, 120000, FALSE, &pid); status = run_ex (cmd, tmpfile, tempdir, 120000, FALSE, &pid);
if (status)
{
data = flush_temp_file( tmpname, tmpfile, &size ); data = flush_temp_file( tmpname, tmpfile, &size );
WriteFile( out_file, data, size, &size, NULL ); if (status || size > MAX_OUTPUT_SIZE) WriteFile( out_file, data, size, &size, NULL );
free( data ); free( data );
} }
else close_temp_file( tmpname, tmpfile ); else
{
DWORD start_size = GetFileSize( out_file, NULL );
status = run_ex (cmd, out_file, tempdir, 120000, FALSE, &pid);
size = GetFileSize( out_file, NULL ) - start_size;
} }
else status = run_ex (cmd, out_file, tempdir, 120000, FALSE, &pid);
if (status == -2) status = -GetLastError(); if (status == -2) status = -GetLastError();
free(cmd); free(cmd);
xprintf ("%s:%s:%04x done (%d) in %ds\n", test->name, subtest, pid, status, (GetTickCount()-start)/1000); xprintf ("%s:%s:%04x done (%d) in %ds %uB\n", test->name, subtest, pid, status, (GetTickCount()-start)/1000, size);
if (status) failures++; if (size > MAX_OUTPUT_SIZE)
{
xprintf ("%s:%s:%04x The test prints too much data (%u bytes)\n", test->name, subtest, pid, size);
failures++;
}
else if (status) failures++;
} }
if (failures) report (R_STATUS, "Running tests - %u failures", failures); if (failures) report (R_STATUS, "Running tests - %u failures", failures);
} }