[PATCH 4/4] msvcr90/tests: Call some programm termination functions in a slave process

Detlef Riekenberg wine.dev at web.de
Sun Jan 30 16:34:41 CST 2011


As an extension for the tests, capture stderr from the slave process
is possible, but does it worth the effort to match program termination?

--
By by ... Detlef
---
 dlls/msvcr90/tests/msvcr90.c |   50 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
index 27b0fda..9aedf74 100644
--- a/dlls/msvcr90/tests/msvcr90.c
+++ b/dlls/msvcr90/tests/msvcr90.c
@@ -27,6 +27,7 @@
 #include <windef.h>
 #include <winbase.h>
 #include <errno.h>
+#include <winuser.h>
 #include "wine/test.h"
 
 #define DEFINE_EXPECT(func) \
@@ -931,6 +932,54 @@ static void slave_process(void)
     exit(1);
 }
 
+static void run_slave(int line, const char *args)
+{
+    PROCESS_INFORMATION info;
+    STARTUPINFOA startup;
+    char buffer[MAX_PATH + MAX_PATH];
+    DWORD res;
+
+    memset(&startup, 0, sizeof(STARTUPINFOA));
+    startup.cb = sizeof(STARTUPINFOA);
+    startup.dwFlags = STARTF_USESHOWWINDOW;
+    startup.wShowWindow = SW_SHOWNORMAL;
+
+    sprintf(buffer, "%s msvcr90 %s", my_argv[0], args);
+    res = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info);
+    ok(res, "%d: CreateProcess returned %d\n", line, GetLastError());
+
+    if (res) {
+        res = WaitForSingleObject(info.hProcess, 2000);
+        ok(!res, "%d: got %d while waiting for process %p: %s\n", line, res, info.hProcess, args);
+    }
+}
+
+static void test_application_termination(void)
+{
+    /* app_type: console,  error_mode: default */
+    run_slave(__LINE__, "--set_app_type 1 --set_error_mode 0 --amsg_exit 10");
+    run_slave(__LINE__, "--set_app_type 1 --set_error_mode 0 --amsg_exit 8");
+    run_slave(__LINE__, "--set_app_type 1 --set_error_mode 0 --amsg_exit 2");
+    /* app_type: GUI,  error_mode: STDERR */
+    run_slave(__LINE__, "--set_app_type 2 --set_error_mode 1 --amsg_exit 2");
+
+    /* app_type: console,  error_mode: default */
+    run_slave(__LINE__, "--set_app_type 1 --set_error_mode 0 --set_abort_behavior 0 3 --abort");
+    run_slave(__LINE__, "--set_app_type 1 --set_error_mode 0 --set_abort_behavior 1 3 --abort");
+    /* app_type: GUI,  error_mode: STDERR */
+    run_slave(__LINE__, "--set_app_type 2 --set_error_mode 1 --set_abort_behavior 0 3 --abort");
+    run_slave(__LINE__, "--set_app_type 2 --set_error_mode 1 --set_abort_behavior 1 3 --abort");
+
+    /* app_type: console,  error_mode: default */
+    run_slave(__LINE__, "--set_app_type 1 --set_error_mode 0 --assert");
+    /* app_type: GUI,  error_mode: STDERR */
+    run_slave(__LINE__, "--set_app_type 2 --set_error_mode 1 --assert");
+
+    /* An assert message to stderr has a the same footer as displayed for abort()
+       The footer can be disabled with _set_abort_behavior() */
+    run_slave(__LINE__, "--set_app_type 1 --set_error_mode 0 --set_abort_behavior 0 3 --assert");
+}
+
 /* ########## */
 
 START_TEST(msvcr90)
@@ -995,6 +1044,7 @@ START_TEST(msvcr90)
     test_controlfp_s();
     test__atoflt();
     test__set_abort_behavior();
+    test_application_termination();
     test__sopen_s();
     test__wsopen_s();
     test__realloc_crt();
-- 
1.7.1




More information about the wine-patches mailing list