Francois Gouget : testbot/TestLauncher: Detect missing manifest critical dialogs.
Alexandre Julliard
julliard at winehq.org
Wed Mar 31 15:25:38 CDT 2021
Module: tools
Branch: master
Commit: a08aff7236da1aeaa5b358ca970c1b30a7e29367
URL: https://source.winehq.org/git/tools.git/?a=commit;h=a08aff7236da1aeaa5b358ca970c1b30a7e29367
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Wed Mar 31 13:14:53 2021 +0200
testbot/TestLauncher: Detect missing manifest critical dialogs.
These happen for side-by-side dlls when the test executable has no
manifest and should be reported as a failure.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/src/TestLauncher/TestLauncher.c | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/testbot/src/TestLauncher/TestLauncher.c b/testbot/src/TestLauncher/TestLauncher.c
index 022f25c..9f4cdf9 100644
--- a/testbot/src/TestLauncher/TestLauncher.c
+++ b/testbot/src/TestLauncher/TestLauncher.c
@@ -139,6 +139,7 @@ static BOOL running_on_visible_desktop (void)
*/
const char *Subtest;
+static unsigned Failures = 0;
static unsigned Skips = 0;
BOOL CALLBACK DumpCriticalErrorDescription(HWND hWnd, LPARAM lParam)
@@ -164,6 +165,7 @@ BOOL CALLBACK DetectCriticalErrorDialog(HWND TopWnd, LPARAM lParam)
const char* TestFileName = (char*)lParam;
int Count, TestFileLen;
char Buffer[512];
+ BOOL IsSkip = TRUE;
const char* Reason;
/* The window pid does not match the CreateProcess() one so it cannot be
@@ -183,22 +185,31 @@ BOOL CALLBACK DetectCriticalErrorDialog(HWND TopWnd, LPARAM lParam)
Reason = NULL;
if (strcmp(Buffer + TestFileLen, " - System Error") == 0)
Reason = "missing dll";
+ else if (strcmp(Buffer + TestFileLen, " - Unable To Locate Component") == 0)
+ {
+ /* Sadly Windows >= 7 reports this as "System Error" */
+ Reason = "missing manifest for side-by-side dll";
+ IsSkip = FALSE;
+ }
else if (strcmp(Buffer + TestFileLen, " - Entry Point Not Found") == 0)
Reason = "missing entry point";
else if (strcmp(Buffer + TestFileLen, " - Ordinal Not Found") == 0)
Reason = "missing ordinal";
else if (strncmp(Buffer + TestFileLen, " - ", 3) == 0)
- /* Old Windows version used to translate the dialog */
+ /* Old Windows versions used to translate the dialog so treat any
+ * unrecognized critical error as a skip.
+ */
Reason = "unrecognized critical error";
if (Reason)
{
- Skips++;
+ IsSkip ? Skips++ : Failures++;
/* An empty test unit name is allowed on the start, summary and done
* lines, but not on individual failure / skip lines.
*/
- printf("%s.c:0: Tests skipped: %s (details below)\n",
- (*Subtest ? Subtest : "testlauncher"), Reason);
+ printf("%s.c:0: %s: %s (details below)\n",
+ (*Subtest ? Subtest : "testlauncher"),
+ (IsSkip ? "Tests skipped" : "Test failed"), Reason);
printf("| %s\n", Buffer);
EnumChildWindows(TopWnd, DumpCriticalErrorDescription, (LPARAM)TopWnd);
/* Leave the dialog open so it appears on screenshots */
@@ -249,9 +260,9 @@ DWORD RunTest(char *TestExeFileName, char* CommandLine, DWORD TimeOut, DWORD *Pi
/* ...instead detect the critical error dialog that pops up */
EnumWindows(DetectCriticalErrorDialog, (LPARAM)TestExeFileName);
- if (Skips)
+ if (Skips || Failures)
{
- ExitCode = WAIT_OBJECT_0;
+ ExitCode = Failures ? Failures : WAIT_OBJECT_0;
break;
}
@@ -280,7 +291,8 @@ DWORD RunTest(char *TestExeFileName, char* CommandLine, DWORD TimeOut, DWORD *Pi
if (!TerminateProcess(ProcessInformation.hProcess, 257))
Error("TerminateProcess failed (error %lu)\n", GetLastError());
}
- else if (!Skips && !GetExitCodeProcess(ProcessInformation.hProcess, &ExitCode))
+ else if (!Skips && !Failures &&
+ !GetExitCodeProcess(ProcessInformation.hProcess, &ExitCode))
{
Error("Could not get the child exit code (error %lu)\n", GetLastError());
ExitCode = 259;
@@ -419,8 +431,8 @@ int main(int argc, char *argv[])
fflush(stdout);
ExitCode = RunTest(TestExeFileName, CommandLine, TimeOut, &Pid);
- if (Skips)
- printf("%04lx:%s: 0 tests executed (0 marked as todo, 0 failures), %u skipped.\n", Pid, Subtest, Skips);
+ if (Failures || Skips)
+ printf("%04lx:%s: %u tests executed (0 marked as todo, %u failures), %u skipped.\n", Pid, Subtest, Failures, Failures, Skips);
printf("%s:%s:%04lx done (%ld) in %lds\n", TestName, Subtest,
Pid, ExitCode, (GetTickCount() - Start) / 1000);
More information about the wine-cvs
mailing list