forked from Mirrors/wine-wine
Added graphical feedback.
parent
6c08994c36
commit
354f662962
|
@ -1,4 +1,6 @@
|
||||||
Makefile
|
Makefile
|
||||||
|
gui.res
|
||||||
|
wine.ico
|
||||||
winetest.exe.dbg.c
|
winetest.exe.dbg.c
|
||||||
winetest.exe.spec.c
|
winetest.exe.spec.c
|
||||||
winetest.rc
|
winetest.rc
|
||||||
|
|
|
@ -4,14 +4,20 @@ SRCDIR = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
MODULE = winetest.exe
|
MODULE = winetest.exe
|
||||||
APPMODE = gui
|
APPMODE = gui
|
||||||
IMPORTS = user32 wsock32
|
IMPORTS = comctl32 user32 wsock32
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
|
gui.c \
|
||||||
main.c \
|
main.c \
|
||||||
send.c \
|
send.c \
|
||||||
util.c
|
util.c
|
||||||
|
|
||||||
RC_SRCS = winetest.rc
|
RC_SRCS = \
|
||||||
|
gui.rc \
|
||||||
|
winetest.rc
|
||||||
|
|
||||||
|
RC_BINSRC = gui.rc
|
||||||
|
RC_BINARIES = wine.ico
|
||||||
|
|
||||||
TESTS = \
|
TESTS = \
|
||||||
advapi32 \
|
advapi32 \
|
||||||
|
|
|
@ -0,0 +1,411 @@
|
||||||
|
/*
|
||||||
|
* GUI support
|
||||||
|
*
|
||||||
|
* Copyright 2004 Ferenc Wagner
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
|
||||||
|
#include "guires.h"
|
||||||
|
#include "winetest.h"
|
||||||
|
|
||||||
|
/* Event object to signal successful window creation to main thread.
|
||||||
|
*/
|
||||||
|
HANDLE initEvent;
|
||||||
|
|
||||||
|
/* Dialog handle
|
||||||
|
*/
|
||||||
|
HWND dialog;
|
||||||
|
|
||||||
|
/* Progress data for the text* functions and for scaling.
|
||||||
|
*/
|
||||||
|
unsigned int progressMax, progressCurr;
|
||||||
|
double progressScale;
|
||||||
|
|
||||||
|
/* Progress group counter for the gui* functions.
|
||||||
|
*/
|
||||||
|
int progressGroup = -1;
|
||||||
|
|
||||||
|
char *
|
||||||
|
renderString (va_list ap)
|
||||||
|
{
|
||||||
|
const char *fmt = va_arg (ap, char*);
|
||||||
|
static char buffer[128];
|
||||||
|
|
||||||
|
vsnprintf (buffer, sizeof buffer, fmt, ap);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* report (R_STATUS, fmt, ...) */
|
||||||
|
int
|
||||||
|
textStatus (va_list ap)
|
||||||
|
{
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
fputs (str, stderr);
|
||||||
|
fputc ('\n', stderr);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
guiStatus (va_list ap)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
char *str = vstrmake (&len, ap);
|
||||||
|
|
||||||
|
if (len > 128) str[129] = 0;
|
||||||
|
SetDlgItemText (dialog, IDC_SB, str);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* report (R_PROGRESS, steps) */
|
||||||
|
int
|
||||||
|
textProgress (va_list ap)
|
||||||
|
{
|
||||||
|
progressMax = va_arg (ap, int);
|
||||||
|
progressCurr = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
guiProgress (va_list ap)
|
||||||
|
{
|
||||||
|
unsigned int max = va_arg (ap, int);
|
||||||
|
HWND pb = GetDlgItem (dialog, IDC_PB0 + ++progressGroup * 2);
|
||||||
|
|
||||||
|
progressMax = max;
|
||||||
|
progressCurr = 0;
|
||||||
|
if (max > 0xffff) {
|
||||||
|
progressScale = (double)0xffff / max;
|
||||||
|
max = 0xffff;
|
||||||
|
}
|
||||||
|
else progressScale = 1;
|
||||||
|
SendMessage (pb, PBM_SETRANGE, 0, MAKELPARAM (0, max));
|
||||||
|
SendMessage (pb, PBM_SETSTEP, (WPARAM)1, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* report (R_STEP, fmt, ...) */
|
||||||
|
int
|
||||||
|
textStep (va_list ap)
|
||||||
|
{
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
progressCurr++;
|
||||||
|
fputs (str, stderr);
|
||||||
|
fprintf (stderr, " (%d of %d)\n", progressCurr, progressMax);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
guiStep (va_list ap)
|
||||||
|
{
|
||||||
|
const int pgID = IDC_ST0 + progressGroup * 2;
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
progressCurr++;
|
||||||
|
SetDlgItemText (dialog, pgID, str);
|
||||||
|
SendDlgItemMessage (dialog, pgID+1, PBM_SETPOS,
|
||||||
|
(WPARAM)(progressScale * progressCurr), 0);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* report (R_DELTA, inc, fmt, ...) */
|
||||||
|
int
|
||||||
|
textDelta (va_list ap)
|
||||||
|
{
|
||||||
|
const int inc = va_arg (ap, int);
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
progressCurr += inc;
|
||||||
|
fputs (str, stderr);
|
||||||
|
fprintf (stderr, " (%d of %d)\n", progressCurr, progressMax);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
guiDelta (va_list ap)
|
||||||
|
{
|
||||||
|
const int inc = va_arg (ap, int);
|
||||||
|
const int pgID = IDC_ST0 + progressGroup * 2;
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
progressCurr += inc;
|
||||||
|
SetDlgItemText (dialog, pgID, str);
|
||||||
|
SendDlgItemMessage (dialog, pgID+1, PBM_SETPOS,
|
||||||
|
(WPARAM)(progressScale * progressCurr), 0);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* report (R_DIR, fmt, ...) */
|
||||||
|
int
|
||||||
|
textDir (va_list ap)
|
||||||
|
{
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
fputs ("Temporary directory: ", stderr);
|
||||||
|
fputs (str, stderr);
|
||||||
|
fputc ('\n', stderr);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
guiDir (va_list ap)
|
||||||
|
{
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
SetDlgItemText (dialog, IDC_DIR, str);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* report (R_OUT, fmt, ...) */
|
||||||
|
int
|
||||||
|
textOut (va_list ap)
|
||||||
|
{
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
fputs ("Log file: ", stderr);
|
||||||
|
fputs (str, stderr);
|
||||||
|
fputc ('\n', stderr);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
guiOut (va_list ap)
|
||||||
|
{
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
SetDlgItemText (dialog, IDC_OUT, str);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* report (R_FATAL, fmt, ...) */
|
||||||
|
int
|
||||||
|
textFatal (va_list ap)
|
||||||
|
{
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
fputs ("Fatal error: ", stderr);
|
||||||
|
fputs (str, stderr);
|
||||||
|
fputc ('\n', stderr);
|
||||||
|
free (str);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
guiFatal (va_list ap)
|
||||||
|
{
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
MessageBox (dialog, str, "Fatal Error", MB_ICONERROR | MB_OK);
|
||||||
|
free (str);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* report (R_WARNING, fmt, ...) */
|
||||||
|
int
|
||||||
|
textWarning (va_list ap)
|
||||||
|
{
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
fputs ("Warning: ", stderr);
|
||||||
|
fputs (str, stderr);
|
||||||
|
fputc ('\n', stderr);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
guiWarning (va_list ap)
|
||||||
|
{
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
MessageBox (dialog, str, "Warning", MB_ICONWARNING | MB_OK);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* report (R_ASK, type, fmt, ...) */
|
||||||
|
int
|
||||||
|
textAsk (va_list ap)
|
||||||
|
{
|
||||||
|
int uType = va_arg (ap, int);
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
|
||||||
|
fprintf (stderr, "Question of type %d: %s\n!FIXME, stub\n",
|
||||||
|
uType, str);
|
||||||
|
free (str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
guiAsk (va_list ap)
|
||||||
|
{
|
||||||
|
int uType = va_arg (ap, int);
|
||||||
|
char *str = vstrmake (NULL, ap);
|
||||||
|
int ret = MessageBox (dialog, str, "Question",
|
||||||
|
MB_ICONQUESTION | uType);
|
||||||
|
|
||||||
|
free (str);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CALLBACK
|
||||||
|
AboutProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (msg) {
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch (LOWORD (wParam)) {
|
||||||
|
case IDCANCEL:
|
||||||
|
EndDialog (hwnd, IDCANCEL);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CALLBACK
|
||||||
|
DlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (msg) {
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
SendMessage (hwnd, WM_SETICON, ICON_SMALL,
|
||||||
|
(LPARAM)LoadIcon (GetModuleHandle (NULL),
|
||||||
|
MAKEINTRESOURCE (IDI_WINE)));
|
||||||
|
SendMessage (hwnd, WM_SETICON, ICON_BIG,
|
||||||
|
(LPARAM)LoadIcon (GetModuleHandle (NULL),
|
||||||
|
MAKEINTRESOURCE (IDI_WINE)));
|
||||||
|
dialog = hwnd;
|
||||||
|
if (!SetEvent (initEvent)) {
|
||||||
|
report (R_STATUS, "Can't signal main thread: %d",
|
||||||
|
GetLastError ());
|
||||||
|
EndDialog (hwnd, 2);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
case WM_CLOSE:
|
||||||
|
EndDialog (hwnd, 3);
|
||||||
|
return TRUE;
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch (LOWORD (wParam)) {
|
||||||
|
case IDHELP:
|
||||||
|
DialogBox (GetModuleHandle (NULL),
|
||||||
|
MAKEINTRESOURCE (IDD_ABOUT), hwnd, AboutProc);
|
||||||
|
return TRUE;
|
||||||
|
case IDABORT:
|
||||||
|
report (R_WARNING, "Not implemented");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD WINAPI
|
||||||
|
DlgThreadProc ()
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
InitCommonControls ();
|
||||||
|
ret = DialogBox (GetModuleHandle (NULL),
|
||||||
|
MAKEINTRESOURCE (IDD_STATUS),
|
||||||
|
NULL, DlgProc);
|
||||||
|
switch (ret) {
|
||||||
|
case 0:
|
||||||
|
report (R_WARNING, "Invalid parent handle");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
report (R_WARNING, "DialogBox failed: %d",
|
||||||
|
GetLastError ());
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
exit (0);
|
||||||
|
default:
|
||||||
|
report (R_STATUS, "Dialog exited: %d", ret);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
report (enum report_type t, ...)
|
||||||
|
{
|
||||||
|
typedef int r_fun_t (va_list);
|
||||||
|
|
||||||
|
va_list ap;
|
||||||
|
int ret = 0;
|
||||||
|
static r_fun_t * const text_funcs[] =
|
||||||
|
{textStatus, textProgress, textStep, textDelta,
|
||||||
|
textDir, textOut, textFatal, textWarning, textAsk};
|
||||||
|
static r_fun_t * const GUI_funcs[] =
|
||||||
|
{guiStatus, guiProgress, guiStep, guiDelta,
|
||||||
|
guiDir, guiOut, guiFatal, guiWarning, guiAsk};
|
||||||
|
static r_fun_t * const * funcs = NULL;
|
||||||
|
|
||||||
|
if (!funcs) {
|
||||||
|
HANDLE DlgThread;
|
||||||
|
DWORD DlgThreadID;
|
||||||
|
|
||||||
|
funcs = text_funcs;
|
||||||
|
initEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
|
||||||
|
if (!initEvent)
|
||||||
|
report (R_STATUS, "Can't create event object: %d",
|
||||||
|
GetLastError ());
|
||||||
|
else {
|
||||||
|
DlgThread = CreateThread (NULL, 0, DlgThreadProc,
|
||||||
|
NULL, 0, &DlgThreadID);
|
||||||
|
if (!DlgThread)
|
||||||
|
report (R_STATUS, "Can't create GUI thread: %d",
|
||||||
|
GetLastError ());
|
||||||
|
else {
|
||||||
|
DWORD ret = WaitForSingleObject (initEvent, INFINITE);
|
||||||
|
switch (ret) {
|
||||||
|
case WAIT_OBJECT_0:
|
||||||
|
funcs = GUI_funcs;
|
||||||
|
break;
|
||||||
|
case WAIT_TIMEOUT:
|
||||||
|
report (R_STATUS, "GUI creation timed out");
|
||||||
|
break;
|
||||||
|
case WAIT_FAILED:
|
||||||
|
report (R_STATUS, "Wait for GUI failed: %d",
|
||||||
|
GetLastError ());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
report (R_STATUS, "Wait returned %d",
|
||||||
|
ret);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start (ap, t);
|
||||||
|
if (t < sizeof text_funcs / sizeof text_funcs[0] &&
|
||||||
|
t < sizeof GUI_funcs / sizeof GUI_funcs[0] &&
|
||||||
|
t >= 0) ret = funcs[t](ap);
|
||||||
|
else report (R_WARNING, "unimplemented report type: %d", t);
|
||||||
|
va_end (ap);
|
||||||
|
return ret;
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
/*
|
||||||
|
* GUI resources
|
||||||
|
*
|
||||||
|
* Copyright 2004 Ferenc Wagner
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <winres.h>
|
||||||
|
#include "guires.h"
|
||||||
|
|
||||||
|
IDD_STATUS DIALOG 0, 0, 160, 140
|
||||||
|
STYLE WS_OVERLAPPEDWINDOW
|
||||||
|
CAPTION "Wine Test Shell"
|
||||||
|
BEGIN
|
||||||
|
LTEXT "Extracting:", IDC_ST0, 10, 5, 140, 10
|
||||||
|
CONTROL "PB0", IDC_PB0, PROGRESS_CLASS, 0, 5, 15, 150, 10
|
||||||
|
LTEXT "Running:", IDC_ST1, 10, 30, 140, 10
|
||||||
|
CONTROL "PB1", IDC_PB1, PROGRESS_CLASS, 0, 5, 40, 150, 15
|
||||||
|
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,
|
||||||
|
ES_READONLY | ES_AUTOHSCROLL
|
||||||
|
LTEXT "Output file:", IDC_STATIC, 10, 100, 100, 10
|
||||||
|
EDITTEXT IDC_OUT, 46, 99, 104, 10,
|
||||||
|
ES_READONLY | ES_AUTOHSCROLL
|
||||||
|
|
||||||
|
DEFPUSHBUTTON "About", IDHELP, 20, 113, 30, 14
|
||||||
|
PUSHBUTTON "Edit", IDCANCEL, 65, 113, 30, 14,
|
||||||
|
WS_DISABLED
|
||||||
|
PUSHBUTTON "Stop", IDABORT, 110, 113, 30, 14
|
||||||
|
|
||||||
|
CONTROL "Created", IDC_SB, STATUSCLASSNAME, 0, 0,0,0,0
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_ABOUT DIALOG 0, 0, 150, 55
|
||||||
|
STYLE WS_POPUP
|
||||||
|
CAPTION "About Wine Test Shell"
|
||||||
|
BEGIN
|
||||||
|
CTEXT "This program extracts and runs a\r\nseries of tests which check Wine's\r\nconformance to Microsoft Windows.",
|
||||||
|
IDC_STATIC, 10, 5, 130, 30
|
||||||
|
DEFPUSHBUTTON "Close", IDCANCEL, 55, 35, 40, 14
|
||||||
|
END
|
||||||
|
|
||||||
|
/* BINRES wine.ico */
|
||||||
|
IDI_WINE ICON "wine.ico"
|
||||||
|
/* {
|
||||||
|
'00 00 01 00 02 00 20 20 10 00 00 00 00 00 E8 02'
|
||||||
|
'00 00 26 00 00 00 10 10 10 00 00 00 00 00 28 01'
|
||||||
|
'00 00 0E 03 00 00 28 00 00 00 20 00 00 00 40 00'
|
||||||
|
'00 00 01 00 04 00 00 00 00 00 00 02 00 00 00 00'
|
||||||
|
'00 00 00 00 00 00 10 00 00 00 00 00 00 00 39 02'
|
||||||
|
'B1 00 23 02 6C 00 0F 03 29 00 1B 02 51 00 FF FF'
|
||||||
|
'FF 00 1B 1A 1B 00 1E 02 63 00 33 02 A1 00 08 08'
|
||||||
|
'08 00 14 03 3C 00 0C 04 1E 00 2E 02 8E 00 10 0F'
|
||||||
|
'10 00 2A 02 82 00 29 02 7D 00 03 02 04 00 44 44'
|
||||||
|
'44 44 44 44 44 44 55 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 8F FF 84 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 8F F8 F8 44 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 8F FF F5 44 44 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 5C F8 C8 F5 44 44 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 85 44 44 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 4C 44 44 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 4C 44 44 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 45 54 44 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 45 F4 44 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 45 FF 44 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 48 FF F4 44 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 48 23 9A 84 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 42 B7 7E AF 44 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 49 00 00 EA C4 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 46 00 00 01 F4 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 46 00 00 00 9F 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 46 00 70 00 EF 44 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 43 00 00 00 79 F4 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 49 00 00 00 0E F4 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 42 00 00 00 07 24 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 43 B0 00 00 00 34 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 4C 30 00 00 00 1F 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 48 27 E1 1D B1 2C 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 44 A9 CC CF F8 48 C4 44 44 44 44 44'
|
||||||
|
'44 44 44 44 44 58 44 44 44 45 C4 44 44 44 44 44'
|
||||||
|
'44 44 44 44 44 4C 44 44 44 44 84 44 44 44 44 44'
|
||||||
|
'44 44 44 44 44 48 44 44 44 44 C4 44 44 44 44 44'
|
||||||
|
'44 44 44 44 44 48 C4 44 44 44 C4 44 44 44 44 44'
|
||||||
|
'44 44 44 44 44 44 F4 44 44 4C C4 44 44 44 44 44'
|
||||||
|
'44 44 44 44 44 44 84 44 F8 84 44 44 44 44 44 44'
|
||||||
|
'44 44 44 44 44 44 48 F8 44 44 44 44 44 44 FF FF'
|
||||||
|
'3F FF FF F0 7F FF FF C0 FF FF FF 03 FF FF FC 03'
|
||||||
|
'FF FF FF F3 FF FF FF FB FF FF FF FB FF FF FF F9'
|
||||||
|
'FF FF FF F9 FF FF FF F8 FF FF FF F8 7F FF FF F8'
|
||||||
|
'1F FF FF F8 0F FF FF F8 07 FF FF F8 07 FF FF F8'
|
||||||
|
'03 FF FF F8 03 FF FF F8 01 FF FF F8 01 FF FF F8'
|
||||||
|
'01 FF FF F8 01 FF FF F8 00 FF FF F8 00 FF FF FC'
|
||||||
|
'02 7F FF FC FE 7F FF FE FF 7F FF FE FF 7F FF FE'
|
||||||
|
'7F 7F FF FF 7E 7F FF FF 71 FF FF FF 8F FF 28 00'
|
||||||
|
'00 00 10 00 00 00 20 00 00 00 01 00 04 00 00 00'
|
||||||
|
'00 00 80 00 00 00 00 00 00 00 00 00 00 00 10 00'
|
||||||
|
'00 00 00 00 00 00 3A 02 B1 00 0A 06 14 00 12 03'
|
||||||
|
'33 00 FF FF FF 00 12 12 12 00 0B 0B 0B 00 1B 1B'
|
||||||
|
'1B 00 25 02 6F 00 2E 02 92 00 1A 02 52 00 36 02'
|
||||||
|
'A6 00 15 03 3E 00 04 04 05 00 13 11 19 00 1E 02'
|
||||||
|
'62 00 2A 02 82 00 33 33 33 CC 43 33 33 33 33 33'
|
||||||
|
'CC 5C 33 33 33 33 33 36 C5 53 33 33 33 33 33 33'
|
||||||
|
'33 43 33 33 33 33 33 33 33 65 33 33 33 33 33 33'
|
||||||
|
'33 DC 33 33 33 33 33 33 33 17 EC 33 33 33 33 33'
|
||||||
|
'33 B0 07 53 33 33 33 33 33 90 00 B3 33 33 33 33'
|
||||||
|
'33 B0 00 FC 33 33 33 33 33 BA 00 A2 33 33 33 33'
|
||||||
|
'33 C7 88 82 33 33 33 33 33 3D D5 14 43 33 33 33'
|
||||||
|
'33 35 33 33 53 33 33 33 33 33 53 33 53 33 33 33'
|
||||||
|
'33 33 C5 5C 33 33 FC 7F 00 00 F0 FF 00 00 E1 FF'
|
||||||
|
'00 00 FD FF 00 00 FC FF 00 00 FC FF 00 00 FC 3F'
|
||||||
|
'00 00 FC 1F 00 00 FC 1F 00 00 FC 0F 00 00 FC 0F'
|
||||||
|
'00 00 FC 0F 00 00 FE 07 00 00 FE F7 00 00 FF 77'
|
||||||
|
'00 00 FF 0F 00 00'
|
||||||
|
} */
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* GUI resource definitions
|
||||||
|
*
|
||||||
|
* Copyright 2004 Ferenc Wagner
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define IDI_WINE 1
|
||||||
|
|
||||||
|
#define IDD_STATUS 100
|
||||||
|
#define IDD_ABOUT 101
|
||||||
|
|
||||||
|
#define IDC_ST0 1000
|
||||||
|
#define IDC_PB0 1001
|
||||||
|
#define IDC_ST1 1002
|
||||||
|
#define IDC_PB1 1003
|
||||||
|
#define IDC_ST2 1004
|
||||||
|
#define IDC_PB2 1005
|
||||||
|
|
||||||
|
#define IDC_DIR 2000
|
||||||
|
#define IDC_OUT 2001
|
||||||
|
|
||||||
|
#define IDC_SB 3000
|
||||||
|
|
||||||
|
#define IDC_EDIT 4000
|
||||||
|
#define IDC_ABOUT 4001
|
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
#include "winetest.h"
|
#include "winetest.h"
|
||||||
|
|
||||||
|
#define TESTRESOURCE "USERDATA"
|
||||||
|
|
||||||
struct wine_test
|
struct wine_test
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -47,7 +49,7 @@ struct wine_test
|
||||||
char *exename;
|
char *exename;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct wine_test wine_tests[32];
|
static struct wine_test *wine_tests;
|
||||||
|
|
||||||
static const char *wineloader;
|
static const char *wineloader;
|
||||||
|
|
||||||
|
@ -61,7 +63,7 @@ void print_version ()
|
||||||
{
|
{
|
||||||
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
if (!GetVersionEx ((OSVERSIONINFO *) &ver))
|
if (!GetVersionEx ((OSVERSIONINFO *) &ver))
|
||||||
fatal("Can't get OS version.");
|
report (R_FATAL, "Can't get OS version.");
|
||||||
}
|
}
|
||||||
|
|
||||||
xprintf (" dwMajorVersion=%ld\n dwMinorVersion=%ld\n"
|
xprintf (" dwMajorVersion=%ld\n dwMinorVersion=%ld\n"
|
||||||
|
@ -104,155 +106,158 @@ void remove_dir (const char *dir)
|
||||||
if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)
|
if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)
|
||||||
remove_dir(path);
|
remove_dir(path);
|
||||||
else if (!DeleteFile (path))
|
else if (!DeleteFile (path))
|
||||||
warning (strmake (NULL, "Can't delete file %s: error %d", path, GetLastError ()));
|
report (R_WARNING, "Can't delete file %s: error %d",
|
||||||
|
path, GetLastError ());
|
||||||
} while (FindNextFile (hFind, &wfd));
|
} while (FindNextFile (hFind, &wfd));
|
||||||
FindClose (hFind);
|
FindClose (hFind);
|
||||||
if (!RemoveDirectory (dir))
|
if (!RemoveDirectory (dir))
|
||||||
warning (strmake (NULL, "Can't remove directory %s: error %d", dir, GetLastError ()));
|
report (R_WARNING, "Can't remove directory %s: error %d",
|
||||||
|
dir, GetLastError ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void* extract_rcdata (int id, DWORD* size)
|
void* extract_rcdata (int id, DWORD* size)
|
||||||
{
|
{
|
||||||
HRSRC rsrc;
|
HRSRC rsrc;
|
||||||
HGLOBAL hdl;
|
HGLOBAL hdl;
|
||||||
|
LPVOID addr = NULL;
|
||||||
rsrc = FindResource (0, (LPTSTR)(id + 1), "USERDATA");
|
|
||||||
if (!rsrc) return 0;
|
if (!(rsrc = FindResource (0, (LPTSTR)id, TESTRESOURCE)) ||
|
||||||
*size = SizeofResource (0, rsrc);
|
!(*size = SizeofResource (0, rsrc)) ||
|
||||||
if (!*size) return 0;
|
!(hdl = LoadResource (0, rsrc)) ||
|
||||||
hdl = LoadResource (0, rsrc);
|
!(addr = LockResource (hdl)))
|
||||||
if (!hdl) return 0;
|
report (R_FATAL, "Can't extract test file of id %d: %d",
|
||||||
return LockResource (hdl);
|
id, GetLastError ());
|
||||||
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int extract_test (const char *dir, int id)
|
/* Fills out the name, is_elf and exename fields */
|
||||||
|
void
|
||||||
|
extract_test (struct wine_test *test, const char *dir, int id)
|
||||||
{
|
{
|
||||||
BYTE* code;
|
BYTE* code;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
FILE* fout;
|
FILE* fout;
|
||||||
char buffer[128];
|
int strlen, bufflen = 128;
|
||||||
int len;
|
|
||||||
struct wine_test *test;
|
|
||||||
|
|
||||||
if (id >= sizeof(wine_tests)/sizeof(wine_tests[0])-1) fatal("Too many tests\n");
|
|
||||||
|
|
||||||
code = extract_rcdata (id, &size);
|
code = extract_rcdata (id, &size);
|
||||||
if (!code) return 0;
|
test->name = xmalloc (bufflen);
|
||||||
|
while ((strlen = LoadStringA (NULL, id, test->name, bufflen))
|
||||||
|
== bufflen - 1) {
|
||||||
|
bufflen *= 2;
|
||||||
|
test->name = xrealloc (test->name, bufflen);
|
||||||
|
}
|
||||||
|
if (!strlen) report (R_FATAL, "Can't read name of test %d.", id);
|
||||||
|
test->name = xrealloc (test->name, strlen+1);
|
||||||
|
report (R_STEP, "Extracting: %s", test->name);
|
||||||
|
test->is_elf = !memcmp (code+1, "ELF", 3);
|
||||||
|
test->exename = strmake (NULL, "%s/%s", dir, test->name);
|
||||||
|
|
||||||
test = &wine_tests[id];
|
if (!(fout = fopen (test->exename, "wb")) ||
|
||||||
len = LoadStringA(0, id + 1, buffer, sizeof(buffer) );
|
|
||||||
test->name = xmalloc( len + 1 );
|
|
||||||
memcpy( test->name, buffer, len + 1 );
|
|
||||||
test->is_elf = (code[1] == 'E' && code[2] == 'L' && code[3] == 'F');
|
|
||||||
test->exename = strmake(NULL, "%s/%s", dir, test->name);
|
|
||||||
|
|
||||||
if (!(fout = fopen(test->exename, "wb")) ||
|
|
||||||
(fwrite (code, size, 1, fout) != 1) ||
|
(fwrite (code, size, 1, fout) != 1) ||
|
||||||
fclose (fout)) fatal (strmake (NULL, "Failed to write file %s.", test->name));
|
fclose (fout)) report (R_FATAL, "Failed to write file %s.",
|
||||||
return 1;
|
test->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_subtests (struct wine_test tests[])
|
void
|
||||||
|
get_subtests (const char *tempdir, struct wine_test *test, int id)
|
||||||
{
|
{
|
||||||
char *subname;
|
char *subname;
|
||||||
FILE *subfile;
|
FILE *subfile;
|
||||||
size_t subsize, bytes_read, total;
|
size_t subsize, bytes_read, total;
|
||||||
char buffer[8000], *index;
|
char *buffer, *index;
|
||||||
const char header[] = "Valid test names:", seps[] = " \r\n";
|
const char header[] = "Valid test names:", seps[] = " \r\n";
|
||||||
int oldstdout;
|
int oldstdout;
|
||||||
const char *argv[] = {"wine", NULL, NULL};
|
const char *argv[] = {"wine", NULL, NULL};
|
||||||
struct wine_test* test;
|
int allocated;
|
||||||
int allocated, all_subtests = 0;
|
|
||||||
|
|
||||||
subname = tempnam (0, "sub");
|
subname = tempnam (0, "sub");
|
||||||
if (!subname) fatal ("Can't name subtests file.");
|
if (!subname) report (R_FATAL, "Can't name subtests file.");
|
||||||
oldstdout = dup (1);
|
oldstdout = dup (1);
|
||||||
if (-1 == oldstdout) fatal ("Can't preserve stdout.");
|
if (-1 == oldstdout) report (R_FATAL, "Can't preserve stdout.");
|
||||||
subfile = fopen (subname, "w+b");
|
subfile = fopen (subname, "w+b");
|
||||||
if (!subfile) fatal ("Can't open subtests file.");
|
if (!subfile) report (R_FATAL, "Can't open subtests file.");
|
||||||
if (-1 == dup2 (fileno (subfile), 1))
|
if (-1 == dup2 (fileno (subfile), 1))
|
||||||
fatal ("Can't redirect output to subtests.");
|
report (R_FATAL, "Can't redirect output to subtests.");
|
||||||
fclose (subfile);
|
fclose (subfile);
|
||||||
|
|
||||||
for (test = tests; test->name; test++) {
|
extract_test (test, tempdir, id);
|
||||||
lseek (1, 0, SEEK_SET);
|
argv[1] = test->exename;
|
||||||
argv[1] = test->exename;
|
if (test->is_elf)
|
||||||
if (test->is_elf)
|
spawnvp (_P_WAIT, wineloader, argv);
|
||||||
spawnvp (_P_WAIT, wineloader, argv);
|
else
|
||||||
else
|
spawnvp (_P_WAIT, test->exename, argv+1);
|
||||||
spawnvp (_P_WAIT, test->exename, argv+1);
|
subsize = lseek (1, 0, SEEK_CUR);
|
||||||
subsize = lseek (1, 0, SEEK_CUR);
|
buffer = xmalloc (subsize+1);
|
||||||
if (subsize >= sizeof buffer) {
|
|
||||||
fprintf (stderr, "Subtests output too big: %s.\n",
|
|
||||||
test->name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
lseek (1, 0, SEEK_SET);
|
lseek (1, 0, SEEK_SET);
|
||||||
total = 0;
|
total = 0;
|
||||||
while ((bytes_read = read (1, buffer + total, subsize - total))
|
while ((bytes_read = read (1, buffer + total, subsize - total))
|
||||||
&& (signed)bytes_read != -1)
|
&& (signed)bytes_read != -1)
|
||||||
total += bytes_read;
|
total += bytes_read;
|
||||||
if (bytes_read) {
|
if (bytes_read)
|
||||||
fprintf (stderr, "Error reading %s.\n", test->name);
|
report (R_FATAL, "Can't get subtests of %s", test->name);
|
||||||
continue;
|
buffer[total] = 0;
|
||||||
|
index = strstr (buffer, header);
|
||||||
|
if (!index)
|
||||||
|
report (R_FATAL, "Can't parse subtests output of %s",
|
||||||
|
test->name);
|
||||||
|
index += sizeof header;
|
||||||
|
|
||||||
|
allocated = 10;
|
||||||
|
test->subtests = xmalloc (allocated * sizeof(char*));
|
||||||
|
test->subtest_count = 0;
|
||||||
|
index = strtok (index, seps);
|
||||||
|
while (index) {
|
||||||
|
if (test->subtest_count == allocated) {
|
||||||
|
allocated *= 2;
|
||||||
|
test->subtests = xrealloc (test->subtests,
|
||||||
|
allocated * sizeof(char*));
|
||||||
}
|
}
|
||||||
buffer[total] = 0;
|
test->subtests[test->subtest_count++] = strdup (index);
|
||||||
index = strstr (buffer, header);
|
index = strtok (NULL, seps);
|
||||||
if (!index) {
|
|
||||||
fprintf (stderr, "Can't parse subtests output of %s.\n",
|
|
||||||
test->name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
index += sizeof(header);
|
|
||||||
allocated = 10;
|
|
||||||
test->subtests = xmalloc (allocated * sizeof (char*));
|
|
||||||
test->subtest_count = 0;
|
|
||||||
index = strtok (index, seps);
|
|
||||||
while (index) {
|
|
||||||
if (test->subtest_count == allocated) {
|
|
||||||
allocated *= 2;
|
|
||||||
test->subtests = xrealloc (test->subtests,
|
|
||||||
allocated * sizeof (char*));
|
|
||||||
}
|
|
||||||
test->subtests[test->subtest_count++] = strdup (index);
|
|
||||||
index = strtok (NULL, seps);
|
|
||||||
}
|
|
||||||
test->subtests = xrealloc (test->subtests,
|
|
||||||
test->subtest_count * sizeof (char*));
|
|
||||||
all_subtests += test->subtest_count;
|
|
||||||
}
|
}
|
||||||
|
test->subtests = xrealloc (test->subtests,
|
||||||
|
test->subtest_count * sizeof(char*));
|
||||||
|
free (buffer);
|
||||||
close (1);
|
close (1);
|
||||||
|
if (-1 == dup2 (oldstdout, 1))
|
||||||
if (-1 == dup2 (oldstdout, 1)) fatal ("Can't recover old stdout.");
|
report (R_FATAL, "Can't recover old stdout.");
|
||||||
close (oldstdout);
|
close (oldstdout);
|
||||||
|
if (remove (subname))
|
||||||
if (remove (subname)) fatal ("Can't remove subtests file.");
|
report (R_FATAL, "Can't remove subtests file.");
|
||||||
free (subname);
|
free (subname);
|
||||||
|
|
||||||
return all_subtests;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void run_test (struct wine_test* test, const char* subtest)
|
/* Return number of failures, -1 if couldn't spawn process. */
|
||||||
|
int run_test (struct wine_test* test, const char* subtest)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
const char *argv[] = {"wine", test->exename, subtest, NULL};
|
const char *argv[] = {"wine", test->exename, subtest, NULL};
|
||||||
|
|
||||||
fprintf (stderr, "Running %s:%s\n", test->name, subtest);
|
|
||||||
xprintf ("%s:%s start\n", test->name, subtest);
|
xprintf ("%s:%s start\n", test->name, subtest);
|
||||||
if (test->is_elf)
|
if (test->is_elf)
|
||||||
status = spawnvp (_P_WAIT, wineloader, argv);
|
status = spawnvp (_P_WAIT, wineloader, argv);
|
||||||
else
|
else
|
||||||
status = spawnvp (_P_WAIT, test->exename, argv+1);
|
status = spawnvp (_P_WAIT, test->exename, argv+1);
|
||||||
if (status == -1)
|
if (status == -1)
|
||||||
xprintf ("Can't run: %d, errno=%d: %s\n", status, errno, strerror (errno));
|
xprintf ("Can't run: %d, errno=%d: %s\n",
|
||||||
xprintf ("%s:%s done (%x)\n", test->name, subtest, status);
|
status, errno, strerror (errno));
|
||||||
|
xprintf ("%s:%s done (%d)\n", test->name, subtest, status);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)
|
BOOL CALLBACK
|
||||||
|
EnumTestFileProc (HMODULE hModule, LPCTSTR lpszType,
|
||||||
|
LPTSTR lpszName, LONG_PTR lParam)
|
||||||
{
|
{
|
||||||
struct wine_test* test;
|
(*(int*)lParam)++;
|
||||||
int nr_of_tests, subtest, i;
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
run_tests ()
|
||||||
|
{
|
||||||
|
int nr_of_files = 0, nr_of_tests = 0, i;
|
||||||
char *tempdir, *logname;
|
char *tempdir, *logname;
|
||||||
FILE *logfile;
|
FILE *logfile;
|
||||||
char build_tag[128];
|
char build_tag[128];
|
||||||
|
@ -260,51 +265,87 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmd
|
||||||
SetErrorMode (SEM_FAILCRITICALERRORS);
|
SetErrorMode (SEM_FAILCRITICALERRORS);
|
||||||
|
|
||||||
if (!(wineloader = getenv("WINELOADER"))) wineloader = "wine";
|
if (!(wineloader = getenv("WINELOADER"))) wineloader = "wine";
|
||||||
if (setvbuf (stdout, NULL, _IONBF, 0)) fatal ("Can't unbuffer output.");
|
if (setvbuf (stdout, NULL, _IONBF, 0))
|
||||||
|
report (R_FATAL, "Can't unbuffer output.");
|
||||||
|
|
||||||
tempdir = tempnam (0, "wct");
|
tempdir = tempnam (0, "wct");
|
||||||
if (!tempdir) fatal ("Can't name temporary dir (check TMP).");
|
if (!tempdir)
|
||||||
fprintf (stderr, "tempdir=%s\n", tempdir);
|
report (R_FATAL, "Can't name temporary dir (check %%TEMP%%).");
|
||||||
if (!CreateDirectory (tempdir, NULL)) fatal (strmake (NULL, "Could not create directory: %s", tempdir));
|
report (R_DIR, tempdir);
|
||||||
|
if (!CreateDirectory (tempdir, NULL))
|
||||||
|
report (R_FATAL, "Could not create directory: %s", tempdir);
|
||||||
|
|
||||||
logname = tempnam (0, "res");
|
logname = tempnam (0, "res");
|
||||||
if (!logname) fatal ("Can't name logfile.");
|
if (!logname) report (R_FATAL, "Can't name logfile.");
|
||||||
fprintf (stderr, "logname=%s\n", logname);
|
report (R_OUT, logname);
|
||||||
|
|
||||||
logfile = fopen (logname, "ab");
|
logfile = fopen (logname, "a");
|
||||||
if (!logfile) fatal ("Could not open logfile.");
|
if (!logfile) report (R_FATAL, "Could not open logfile.");
|
||||||
if (-1 == dup2 (fileno (logfile), 1)) fatal ("Can't redirect stdout.");
|
if (-1 == dup2 (fileno (logfile), 1))
|
||||||
|
report (R_FATAL, "Can't redirect stdout.");
|
||||||
fclose (logfile);
|
fclose (logfile);
|
||||||
|
|
||||||
LoadStringA( 0, 0, build_tag, sizeof(build_tag) );
|
xprintf ("Version 1\n");
|
||||||
|
i = LoadStringA (GetModuleHandle (NULL), 0,
|
||||||
|
build_tag, sizeof build_tag);
|
||||||
|
if (i == 0) report (R_FATAL, "Build descriptor not found.");
|
||||||
|
if (i >= sizeof build_tag)
|
||||||
|
report (R_FATAL, "Build descriptor too long.");
|
||||||
xprintf ("Tests from build %s\n", build_tag);
|
xprintf ("Tests from build %s\n", build_tag);
|
||||||
xprintf ("Operating system version:\n");
|
xprintf ("Operating system version:\n");
|
||||||
print_version ();
|
print_version ();
|
||||||
xprintf ("Test output:\n" );
|
xprintf ("Test output:\n" );
|
||||||
|
|
||||||
i = 0;
|
report (R_STATUS, "Counting tests");
|
||||||
while (extract_test (tempdir, i)) i++;
|
if (!EnumResourceNames (NULL, TESTRESOURCE,
|
||||||
|
EnumTestFileProc, (LPARAM)&nr_of_files))
|
||||||
|
report (R_FATAL, "Can't enumerate test files: %d",
|
||||||
|
GetLastError ());
|
||||||
|
wine_tests = xmalloc (nr_of_files * sizeof wine_tests[0]);
|
||||||
|
|
||||||
nr_of_tests = get_subtests (wine_tests);
|
report (R_STATUS, "Extracting tests");
|
||||||
|
report (R_PROGRESS, nr_of_files);
|
||||||
for (test = wine_tests; test->name; test++)
|
for (i = 0; i < nr_of_files; i++) {
|
||||||
for (subtest = 0; subtest < test->subtest_count; subtest++)
|
get_subtests (tempdir, wine_tests+i, i+1);
|
||||||
run_test (test, test->subtests[subtest]);
|
nr_of_tests += wine_tests[i].subtest_count;
|
||||||
|
|
||||||
close (1);
|
|
||||||
|
|
||||||
remove_dir (tempdir);
|
|
||||||
|
|
||||||
/* FIXME: add an explanation of what is going on */
|
|
||||||
if (MessageBoxA( 0, "Do you want to submit the test results?", "Confirmation",
|
|
||||||
MB_YESNO | MB_ICONQUESTION ) == IDYES)
|
|
||||||
{
|
|
||||||
if (send_file (logname))
|
|
||||||
fatal ("Can't submit logfile (network of file error).");
|
|
||||||
}
|
}
|
||||||
|
report (R_DELTA, 0, "Extracting: Done");
|
||||||
|
|
||||||
|
report (R_STATUS, "Running tests");
|
||||||
|
report (R_PROGRESS, nr_of_tests);
|
||||||
|
for (i = 0; i < nr_of_files; i++) {
|
||||||
|
struct wine_test *test = wine_tests + i;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
for (j = 0; j < test->subtest_count; j++) {
|
||||||
|
report (R_STEP, "Running: %s: %s", test->name,
|
||||||
|
test->subtests[j]);
|
||||||
|
run_test (test, test->subtests[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
report (R_DELTA, 0, "Running: Done");
|
||||||
|
|
||||||
|
report (R_STATUS, "Cleaning up");
|
||||||
|
close (1);
|
||||||
|
remove_dir (tempdir);
|
||||||
|
free (tempdir);
|
||||||
|
free (wine_tests);
|
||||||
|
|
||||||
|
if (report (R_ASK, MB_YESNO,
|
||||||
|
"Do you want to submit the test results?") == IDYES)
|
||||||
|
if (send_file (logname))
|
||||||
|
report (R_FATAL, "Can't submit logfile '%s'", logname);
|
||||||
|
|
||||||
if (remove (logname))
|
if (remove (logname))
|
||||||
warning (strmake (NULL, "Can't remove logfile: %d.", errno));
|
report (R_WARNING, "Can't remove logfile: %d.", errno);
|
||||||
|
free (logname);
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
|
||||||
|
LPSTR cmdLine, int cmdShow)
|
||||||
|
{
|
||||||
|
report (R_STATUS, "Starting up");
|
||||||
|
run_tests ();
|
||||||
|
report (R_STATUS, "Finished");
|
||||||
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "winetest.h"
|
#include "winetest.h"
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ open_http (const char *ipnum)
|
||||||
struct sockaddr_in sa;
|
struct sockaddr_in sa;
|
||||||
SOCKET s;
|
SOCKET s;
|
||||||
|
|
||||||
|
report (R_STATUS, "Opening HTTP connection to %s", ipnum);
|
||||||
if (WSAStartup (MAKEWORD (2,2), &wsad)) return INVALID_SOCKET;
|
if (WSAStartup (MAKEWORD (2,2), &wsad)) return INVALID_SOCKET;
|
||||||
|
|
||||||
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
@ -68,15 +70,15 @@ send_buf (SOCKET s, const char *buf, size_t length)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
send_str (SOCKET s, const char *fmt, ...)
|
send_str (SOCKET s, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *p;
|
char *p;
|
||||||
int ret;
|
int ret;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
va_start (ap, fmt);
|
va_start (ap, s);
|
||||||
p = vstrmake (&len, fmt, ap);
|
p = vstrmake (&len, ap);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
if (!p) return 1;
|
if (!p) return 1;
|
||||||
ret = send_buf (s, p, len);
|
ret = send_buf (s, p, len);
|
||||||
|
@ -111,55 +113,73 @@ send_file (const char *name)
|
||||||
|
|
||||||
s = open_http ("157.181.170.47");
|
s = open_http ("157.181.170.47");
|
||||||
if (s == INVALID_SOCKET) {
|
if (s == INVALID_SOCKET) {
|
||||||
fprintf (stderr, "Can't open connection: %x.\n",
|
report (R_WARNING, "Can't open network connection: %d",
|
||||||
WSAGetLastError ());
|
WSAGetLastError ());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen (name, "rb");
|
f = fopen (name, "rb");
|
||||||
if (!f) goto abort1;
|
if (!f) {
|
||||||
|
report (R_WARNING, "Can't open file '%s': %d", name, errno);
|
||||||
|
goto abort1;
|
||||||
|
}
|
||||||
fseek (f, 0, SEEK_END);
|
fseek (f, 0, SEEK_END);
|
||||||
filesize = ftell (f);
|
filesize = ftell (f);
|
||||||
if (filesize > 1024*1024) goto abort2;
|
if (filesize > 1024*1024) {
|
||||||
|
report (R_WARNING,
|
||||||
|
"File too big (%d > 1 MB), copy and submit manually",
|
||||||
|
filesize);
|
||||||
|
goto abort2;
|
||||||
|
}
|
||||||
fseek (f, 0, SEEK_SET);
|
fseek (f, 0, SEEK_SET);
|
||||||
|
|
||||||
|
report (R_STATUS, "Sending header");
|
||||||
str = strmake (&total, body1, name);
|
str = strmake (&total, body1, name);
|
||||||
ret = send_str (s, head, filesize + total + sizeof body2 - 1) ||
|
ret = send_str (s, head, filesize + total + sizeof body2 - 1) ||
|
||||||
send_buf (s, str, total);
|
send_buf (s, str, total);
|
||||||
free (str);
|
free (str);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
fprintf (stderr, "Can't send header.\n");
|
report (R_WARNING, "Error sending header: %d, %d",
|
||||||
|
errno, WSAGetLastError ());
|
||||||
goto abort2;
|
goto abort2;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((bytes_read = fread (buffer, 1, sizeof buffer, f)))
|
report (R_STATUS, "Sending %u bytes of data", filesize);
|
||||||
|
report (R_PROGRESS, filesize);
|
||||||
|
while ((bytes_read = fread (buffer, 1, sizeof buffer / 8, f))) {
|
||||||
if (send_buf (s, buffer, bytes_read)) {
|
if (send_buf (s, buffer, bytes_read)) {
|
||||||
fprintf (stderr, "Can't send body.\n");
|
report (R_WARNING, "Error sending body: %d, %d",
|
||||||
|
errno, WSAGetLastError ());
|
||||||
goto abort2;
|
goto abort2;
|
||||||
}
|
}
|
||||||
|
report (R_DELTA, bytes_read, "Network transfer: In progress");
|
||||||
|
}
|
||||||
fclose (f);
|
fclose (f);
|
||||||
|
|
||||||
if (send_buf (s, body2, sizeof body2 - 1)) {
|
if (send_buf (s, body2, sizeof body2 - 1)) {
|
||||||
fprintf (stderr, "Can't send trailer.\n");
|
report (R_WARNING, "Error sending trailer: %d, %d",
|
||||||
|
errno, WSAGetLastError ());
|
||||||
goto abort2;
|
goto abort2;
|
||||||
}
|
}
|
||||||
|
report (R_DELTA, 0, "Network transfer: Done");
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
while ((bytes_read = recv (s, buffer + total,
|
while ((bytes_read = recv (s, buffer + total,
|
||||||
sizeof buffer - total, 0))) {
|
sizeof buffer - total, 0))) {
|
||||||
if ((signed)bytes_read == SOCKET_ERROR) {
|
if ((signed)bytes_read == SOCKET_ERROR) {
|
||||||
fprintf (stderr, "Error receiving response: %d.\n",
|
report (R_WARNING, "Error receiving reply: %d, %d",
|
||||||
WSAGetLastError ());
|
errno, WSAGetLastError ());
|
||||||
goto abort1;
|
goto abort1;
|
||||||
}
|
}
|
||||||
total += bytes_read;
|
total += bytes_read;
|
||||||
if (total == sizeof buffer) {
|
if (total == sizeof buffer) {
|
||||||
fprintf (stderr, "Buffer overflow.\n");
|
report (R_WARNING, "Buffer overflow");
|
||||||
goto abort1;
|
goto abort1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (close_http (s)) {
|
if (close_http (s)) {
|
||||||
fprintf (stderr, "Error closing connection.\n");
|
report (R_WARNING, "Error closing connection: %d, %d",
|
||||||
|
errno, WSAGetLastError ());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,22 +22,11 @@
|
||||||
|
|
||||||
#include "winetest.h"
|
#include "winetest.h"
|
||||||
|
|
||||||
void fatal (const char* msg)
|
|
||||||
{
|
|
||||||
MessageBox (NULL, msg, "Fatal Error", MB_ICONERROR | MB_OK);
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void warning (const char* msg)
|
|
||||||
{
|
|
||||||
MessageBox (NULL, msg, "Warning", MB_ICONWARNING | MB_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *xmalloc (size_t len)
|
void *xmalloc (size_t len)
|
||||||
{
|
{
|
||||||
void *p = malloc (len);
|
void *p = malloc (len);
|
||||||
|
|
||||||
if (!p) fatal ("Out of memory.");
|
if (!p) report (R_FATAL, "Out of memory.");
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +34,7 @@ void *xrealloc (void *op, size_t len)
|
||||||
{
|
{
|
||||||
void *p = realloc (op, len);
|
void *p = realloc (op, len);
|
||||||
|
|
||||||
if (!p) fatal ("Out of memory.");
|
if (!p) report (R_FATAL, "Out of memory.");
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,18 +43,20 @@ void xprintf (const char *fmt, ...)
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
if (vprintf (fmt, ap) < 0) fatal ("Can't write logs.");
|
if (vprintf (fmt, ap) < 0) report (R_FATAL, "Can't write logs.");
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *vstrmake (size_t *lenp, const char *fmt, va_list ap)
|
char *vstrmake (size_t *lenp, va_list ap)
|
||||||
{
|
{
|
||||||
|
char *fmt;
|
||||||
size_t size = 1000;
|
size_t size = 1000;
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
p = malloc (size);
|
p = malloc (size);
|
||||||
if (!p) return NULL;
|
if (!p) return NULL;
|
||||||
|
fmt = va_arg (ap, char*);
|
||||||
while (1) {
|
while (1) {
|
||||||
n = vsnprintf (p, size, fmt, ap);
|
n = vsnprintf (p, size, fmt, ap);
|
||||||
if (n < 0) size *= 2; /* Windows */
|
if (n < 0) size *= 2; /* Windows */
|
||||||
|
@ -82,14 +73,14 @@ char *vstrmake (size_t *lenp, const char *fmt, va_list ap)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *strmake (size_t *lenp, const char *fmt, ...)
|
char *strmake (size_t *lenp, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
va_start (ap, fmt);
|
va_start (ap, lenp);
|
||||||
p = vstrmake (lenp, fmt, ap);
|
p = vstrmake (lenp, ap);
|
||||||
if (!p) fatal ("Out of memory.");
|
if (!p) report (R_FATAL, "Out of memory.");
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,27 @@ void warning (const char* msg);
|
||||||
void *xmalloc (size_t len);
|
void *xmalloc (size_t len);
|
||||||
void *xrealloc (void *op, size_t len);
|
void *xrealloc (void *op, size_t len);
|
||||||
void xprintf (const char *fmt, ...);
|
void xprintf (const char *fmt, ...);
|
||||||
char *vstrmake (size_t *lenp, const char *fmt, va_list ap);
|
char *vstrmake (size_t *lenp, va_list ap);
|
||||||
char *strmake (size_t *lenp, const char *fmt, ...);
|
char *strmake (size_t *lenp, ...);
|
||||||
|
|
||||||
int send_file (const char *name);
|
int send_file (const char *name);
|
||||||
|
|
||||||
|
/* GUI definitions */
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
enum report_type {
|
||||||
|
R_STATUS = 0,
|
||||||
|
R_PROGRESS,
|
||||||
|
R_STEP,
|
||||||
|
R_DELTA,
|
||||||
|
R_DIR,
|
||||||
|
R_OUT,
|
||||||
|
R_FATAL,
|
||||||
|
R_WARNING,
|
||||||
|
R_ASK
|
||||||
|
};
|
||||||
|
|
||||||
|
int report (enum report_type t, ...);
|
||||||
|
|
||||||
#endif /* __WINETESTS_H */
|
#endif /* __WINETESTS_H */
|
||||||
|
|
Loading…
Reference in New Issue