diff --git a/programs/winetest/gui.c b/programs/winetest/gui.c index 89a310825a3..67182aa3221 100644 --- a/programs/winetest/gui.c +++ b/programs/winetest/gui.c @@ -176,6 +176,23 @@ guiDelta (va_list ap) return 0; } +/* report (R_TAG) */ +int +textTag (va_list ap) +{ + fputs ("Tag: ", stderr); + fputs (tag, stderr); + fputc ('\n', stderr); + return 0; +} + +int +guiTag (va_list ap) +{ + SetDlgItemText (dialog, IDC_TAG, tag); + return 0; +} + /* report (R_DIR, fmt, ...) */ int textDir (va_list ap) @@ -301,6 +318,39 @@ guiAsk (va_list ap) return ret; } +BOOL CALLBACK +AskTagProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + int len; + + switch (msg) { + case WM_COMMAND: + switch (LOWORD (wParam)) { + case IDOK: + len = GetWindowTextLengthA (GetDlgItem (hwnd, IDC_TAG)); + if (len <= 20) { /* keep it consistent with IDD_TAG */ + tag = xmalloc (len+1); + GetDlgItemTextA (hwnd, IDC_TAG, tag, len+1); + if (!badtagchar (tag)) EndDialog (hwnd, IDOK); + else free (tag); + } + return TRUE; + case IDABORT: + EndDialog (hwnd, IDABORT); + return TRUE; + } + } + return FALSE; +} + +int +guiAskTag (void) +{ + return DialogBox (GetModuleHandle (NULL), + MAKEINTRESOURCE (IDD_TAG), + dialog, AskTagProc); +} + /* Quiet functions */ int qNoOp (va_list ap) @@ -403,15 +453,15 @@ report (enum report_type t, ...) int ret = 0; static r_fun_t * const text_funcs[] = {textStatus, textProgress, textStep, textDelta, - textDir, textOut, + textTag, textDir, textOut, textWarning, textError, textFatal, textAsk}; static r_fun_t * const GUI_funcs[] = {guiStatus, guiProgress, guiStep, guiDelta, - guiDir, guiOut, + guiTag, guiDir, guiOut, guiWarning, guiError, guiFatal, guiAsk}; static r_fun_t * const quiet_funcs[] = {qNoOp, qNoOp, qNoOp, qNoOp, - qNoOp, qNoOp, + qNoOp, qNoOp, qNoOp, qNoOp, qNoOp, qFatal, qAsk}; static r_fun_t * const * funcs = NULL; diff --git a/programs/winetest/main.c b/programs/winetest/main.c index 7ca75e0bede..996374612bd 100644 --- a/programs/winetest/main.c +++ b/programs/winetest/main.c @@ -55,6 +55,7 @@ struct rev_info const char* rev; }; +char *tag = NULL; static struct wine_test *wine_tests; static struct rev_info *rev_infos = NULL; static const char whitespace[] = " \t\r\n"; @@ -429,7 +430,7 @@ EnumTestFileProc (HMODULE hModule, LPCTSTR lpszType, } char * -run_tests (char *logname, const char *tag) +run_tests (char *logname) { int nr_of_files = 0, nr_of_tests = 0, i; char *tempdir, *shorttempdir; @@ -480,7 +481,7 @@ run_tests (char *logname, const char *tag) xprintf ("Archive: "); if (strres) xprintf ("%.*s", strsize, strres); else xprintf ("-\n"); - xprintf ("Tag: %s\n", tag?tag:""); + xprintf ("Tag: %s\n", tag); xprintf ("Build info:\n"); strres = extract_rcdata (BUILD_INFO, STRINGRES, &strsize); while (strres) { @@ -556,8 +557,9 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdLine, int cmdShow) { char *logname = NULL; - const char *cp, *submit = NULL, *tag = NULL; + const char *cp, *submit = NULL; int reset_env = 1; + int interactive = 1; /* initialize the revision information first */ extract_rev_infos(); @@ -572,6 +574,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, switch (cmdLine[1]) { case 'c': report (R_TEXTMODE); + interactive = 0; break; case 'e': reset_env = 0; @@ -581,6 +584,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, exit (0); case 'q': report (R_QUIET); + interactive = 0; break; case 's': submit = strtok (NULL, whitespace); @@ -608,10 +612,10 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, cmdLine = strtok (NULL, whitespace); } if (!submit) { - if (!running_on_visible_desktop ()) { - report (R_ERROR, "Tests must be run on a visible desktop"); - exit (2); - } + report (R_STATUS, "Starting up"); + + if (!running_on_visible_desktop ()) + report (R_FATAL, "Tests must be run on a visible desktop"); if (reset_env && (putenv ("WINETEST_PLATFORM=windows") || putenv ("WINETEST_DEBUG=1") || @@ -619,15 +623,22 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, putenv ("WINETEST_REPORT_SUCCESS=0"))) report (R_FATAL, "Could not reset environment: %d", errno); - report (R_STATUS, "Starting up"); + if (!tag) { + if (!interactive) + report (R_FATAL, "Please specify a tag (-t option) if " + "running noninteractive!"); + if (guiAskTag () == IDABORT) exit (1); + } + report (R_TAG); + if (!logname) { - logname = run_tests (NULL, tag); + logname = run_tests (NULL); if (report (R_ASK, MB_YESNO, "Do you want to submit the " "test results?") == IDYES) if (!send_file (logname) && remove (logname)) report (R_WARNING, "Can't remove logfile: %d.", errno); free (logname); - } else run_tests (logname, tag); + } else run_tests (logname); report (R_STATUS, "Finished"); } exit (0); diff --git a/programs/winetest/resource.h b/programs/winetest/resource.h index 1c81e6bbc86..32c58a924ca 100644 --- a/programs/winetest/resource.h +++ b/programs/winetest/resource.h @@ -22,6 +22,7 @@ #define IDD_STATUS 100 #define IDD_ABOUT 101 +#define IDD_TAG 102 #define IDC_ST0 1000 #define IDC_PB0 1001 @@ -32,6 +33,7 @@ #define IDC_DIR 2000 #define IDC_OUT 2001 +#define IDC_TAG 2002 #define IDC_SB 3000 diff --git a/programs/winetest/winetest.h b/programs/winetest/winetest.h index 97ea097df21..dbc1e1caa6d 100644 --- a/programs/winetest/winetest.h +++ b/programs/winetest/winetest.h @@ -46,6 +46,7 @@ enum report_type { R_PROGRESS, R_STEP, R_DELTA, + R_TAG, R_DIR, R_OUT, R_WARNING, @@ -56,6 +57,8 @@ enum report_type { R_QUIET }; +extern char *tag; +int guiAskTag (void); int report (enum report_type t, ...); #endif /* __WINETESTS_H */ diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index c9b7b0cad00..b2f16cd52c8 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -23,7 +23,18 @@ #include "resource.h" #include "tests.rc" -IDD_STATUS DIALOG 0, 0, 160, 140 +IDD_TAG DIALOG 0, 0, 150, 65 +STYLE WS_POPUP +CAPTION "No tag supplied" +BEGIN + CTEXT "Please supply a tag for your report. You can use letters, digits, dashes and periods." + IDC_STATIC, 10, 5, 130, 30 + EDITTEXT IDC_TAG, 35, 30, 80, 10 + DEFPUSHBUTTON "Start", IDOK, 25, 45, 40, 14 + PUSHBUTTON "Abort", IDABORT, 85, 45, 40, 14 +END + +IDD_STATUS DIALOG 0, 0, 160, 150 STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX CAPTION "Wine Test Shell" BEGIN @@ -34,17 +45,20 @@ BEGIN LTEXT "Network transfer:", IDC_ST2, 10, 60, 140, 10 CONTROL "PB2", IDC_PB2, PROGRESS_CLASS, 0, 5, 70, 150, 10 - LTEXT "Working directory:", IDC_STATIC, 10, 89, 100, 10 - EDITTEXT IDC_DIR, 71, 88, 79, 10, + LTEXT "Tag:", IDC_STATIC, 10, 89, 100, 10 + EDITTEXT IDC_TAG, 25, 88, 125, 10, + ES_READONLY + LTEXT "Working directory:", IDC_STATIC, 10, 100, 100, 10 + EDITTEXT IDC_DIR, 71, 99, 79, 10, ES_READONLY | ES_AUTOHSCROLL - LTEXT "Output file:", IDC_STATIC, 10, 100, 100, 10 - EDITTEXT IDC_OUT, 46, 99, 104, 10, + LTEXT "Output file:", IDC_STATIC, 10, 111, 100, 10 + EDITTEXT IDC_OUT, 46, 110, 104, 10, ES_READONLY | ES_AUTOHSCROLL - DEFPUSHBUTTON "About", IDHELP, 20, 113, 30, 14 - PUSHBUTTON "Edit", IDCANCEL, 65, 113, 30, 14, + DEFPUSHBUTTON "About", IDHELP, 20, 123, 30, 14 + PUSHBUTTON "Edit", IDCANCEL, 65, 123, 30, 14, WS_DISABLED - PUSHBUTTON "Stop", IDABORT, 110, 113, 30, 14 + PUSHBUTTON "Stop", IDABORT, 110, 123, 30, 14 CONTROL "Created", IDC_SB, STATUSCLASSNAME, 0, 0,0,0,0 END