Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
efc67253
Commit
efc67253
authored
Feb 19, 2004
by
Ferenc Wagner
Committed by
Alexandre Julliard
Feb 19, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- command line handling (GUI will follow)
- strip .exe[.so] from test names - version 2 output
parent
87bef514
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
191 additions
and
47 deletions
+191
-47
gui.c
programs/winetest/gui.c
+80
-25
main.c
programs/winetest/main.c
+91
-19
maketest
programs/winetest/maketest
+1
-1
util.c
programs/winetest/util.c
+13
-0
winetest.h
programs/winetest/winetest.h
+6
-2
No files found.
programs/winetest/gui.c
View file @
efc67253
...
...
@@ -51,6 +51,21 @@ renderString (va_list ap)
return
buffer
;
}
int
MBdefault
(
int
uType
)
{
static
const
int
matrix
[][
4
]
=
{{
IDOK
,
0
,
0
,
0
},
{
IDOK
,
IDCANCEL
,
0
,
0
},
{
IDABORT
,
IDRETRY
,
IDIGNORE
,
0
},
{
IDYES
,
IDNO
,
IDCANCEL
,
0
},
{
IDYES
,
IDNO
,
0
,
0
},
{
IDRETRY
,
IDCANCEL
,
0
,
0
}};
int
type
=
uType
&
MB_TYPEMASK
;
int
def
=
(
uType
&
MB_DEFMASK
)
/
MB_DEFBUTTON2
;
return
matrix
[
type
][
def
];
}
/* report (R_STATUS, fmt, ...) */
int
textStatus
(
va_list
ap
)
...
...
@@ -204,63 +219,71 @@ guiOut (va_list ap)
return
0
;
}
/* report (R_
FATAL
, fmt, ...) */
/* report (R_
WARNING
, fmt, ...) */
int
text
Fatal
(
va_list
ap
)
text
Warning
(
va_list
ap
)
{
char
*
str
=
vstrmake
(
NULL
,
ap
);
fputs
(
"Fatal error: "
,
stderr
);
fputs
(
str
,
stderr
);
fputc
(
'\n'
,
stderr
);
free
(
str
);
exit
(
1
);
fputs
(
"Warning: "
,
stderr
);
textStatus
(
ap
);
return
0
;
}
int
gui
Fatal
(
va_list
ap
)
gui
Warning
(
va_list
ap
)
{
char
*
str
=
vstrmake
(
NULL
,
ap
);
MessageBox
(
dialog
,
str
,
"
Fatal Error"
,
MB_ICONERROR
|
MB_OK
);
MessageBox
(
dialog
,
str
,
"
Warning"
,
MB_ICONWARNING
|
MB_OK
);
free
(
str
);
exit
(
1
)
;
return
0
;
}
/* report (R_
WARNING
, fmt, ...) */
/* report (R_
ERROR
, fmt, ...) */
int
text
Warning
(
va_list
ap
)
text
Error
(
va_list
ap
)
{
char
*
str
=
vstrmake
(
NULL
,
ap
);
fputs
(
"Warning: "
,
stderr
);
fputs
(
str
,
stderr
);
fputc
(
'\n'
,
stderr
);
free
(
str
);
fputs
(
"Error: "
,
stderr
);
textStatus
(
ap
);
return
0
;
}
int
gui
Warning
(
va_list
ap
)
gui
Error
(
va_list
ap
)
{
char
*
str
=
vstrmake
(
NULL
,
ap
);
MessageBox
(
dialog
,
str
,
"
Warning"
,
MB_ICONWARNING
|
MB_OK
);
MessageBox
(
dialog
,
str
,
"
Error"
,
MB_ICONERROR
|
MB_OK
);
free
(
str
);
return
0
;
}
/* report (R_FATAL, fmt, ...) */
int
textFatal
(
va_list
ap
)
{
textError
(
ap
);
exit
(
1
);
}
int
guiFatal
(
va_list
ap
)
{
guiError
(
ap
);
exit
(
1
);
}
/* report (R_ASK, type, fmt, ...) */
int
textAsk
(
va_list
ap
)
{
int
uType
=
va_arg
(
ap
,
int
);
int
ret
=
MBdefault
(
uType
);
char
*
str
=
vstrmake
(
NULL
,
ap
);
fprintf
(
stderr
,
"Question of type %d: %s
\n
!FIXME, stub
\n
"
,
uType
,
str
);
fprintf
(
stderr
,
"Question of type %d: %s
\n
"
"Returning default: %d
\n
"
,
uType
,
str
,
ret
);
free
(
str
);
return
0
;
return
ret
;
}
int
...
...
@@ -275,6 +298,25 @@ guiAsk (va_list ap)
return
ret
;
}
/* Quiet functions */
int
qNoOp
(
va_list
ap
)
{
return
0
;
}
int
qFatal
(
va_list
ap
)
{
exit
(
1
);
}
int
qAsk
(
va_list
ap
)
{
return
MBdefault
(
va_arg
(
ap
,
int
));
}
BOOL
CALLBACK
AboutProc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
...
...
@@ -362,8 +404,21 @@ report (enum report_type t, ...)
static
r_fun_t
*
const
GUI_funcs
[]
=
{
guiStatus
,
guiProgress
,
guiStep
,
guiDelta
,
guiDir
,
guiOut
,
guiFatal
,
guiWarning
,
guiAsk
};
static
r_fun_t
*
const
quiet_funcs
[]
=
{
qNoOp
,
qNoOp
,
qNoOp
,
qNoOp
,
qNoOp
,
qNoOp
,
qFatal
,
qNoOp
,
qAsk
};
static
r_fun_t
*
const
*
funcs
=
NULL
;
switch
(
t
)
{
case
R_TEXTMODE
:
funcs
=
text_funcs
;
return
0
;
case
R_QUIET
:
funcs
=
quiet_funcs
;
return
0
;
default:
}
if
(
!
funcs
)
{
HANDLE
DlgThread
;
DWORD
DlgThreadID
;
...
...
programs/winetest/main.c
View file @
efc67253
...
...
@@ -138,6 +138,7 @@ extract_test (struct wine_test *test, const char *dir, int id)
DWORD
size
;
FILE
*
fout
;
int
strlen
,
bufflen
=
128
;
char
*
exepos
;
code
=
extract_rcdata
(
id
,
&
size
);
test
->
name
=
xmalloc
(
bufflen
);
...
...
@@ -147,15 +148,18 @@ extract_test (struct wine_test *test, const char *dir, int id)
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
);
test
->
exename
=
strmake
(
NULL
,
"%s/%s"
,
dir
,
test
->
name
);
exepos
=
strstr
(
test
->
name
,
".exe"
);
if
(
!
exepos
)
report
(
R_FATAL
,
"Not an .exe file: %s"
,
test
->
name
);
*
exepos
=
0
;
test
->
name
=
xrealloc
(
test
->
name
,
exepos
-
test
->
name
+
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
);
if
(
!
(
fout
=
fopen
(
test
->
exename
,
"wb"
))
||
(
fwrite
(
code
,
size
,
1
,
fout
)
!=
1
)
||
fclose
(
fout
))
report
(
R_FATAL
,
"Failed to write file %s."
,
test
->
name
);
test
->
exe
name
);
}
void
...
...
@@ -254,11 +258,11 @@ EnumTestFileProc (HMODULE hModule, LPCTSTR lpszType,
return
TRUE
;
}
void
run_tests
()
static
const
char
*
run_tests
(
const
char
*
logname
,
const
char
*
tag
)
{
int
nr_of_files
=
0
,
nr_of_tests
=
0
,
i
;
char
*
tempdir
,
*
logname
;
char
*
tempdir
;
FILE
*
logfile
;
char
build_tag
[
128
];
...
...
@@ -275,8 +279,10 @@ run_tests ()
if
(
!
CreateDirectory
(
tempdir
,
NULL
))
report
(
R_FATAL
,
"Could not create directory: %s"
,
tempdir
);
logname
=
tempnam
(
0
,
"res"
);
if
(
!
logname
)
report
(
R_FATAL
,
"Can't name logfile."
);
if
(
!
logname
)
{
logname
=
tempnam
(
0
,
"res"
);
if
(
!
logname
)
report
(
R_FATAL
,
"Can't name logfile."
);
}
report
(
R_OUT
,
logname
);
logfile
=
fopen
(
logname
,
"a"
);
...
...
@@ -285,13 +291,14 @@ run_tests ()
report
(
R_FATAL
,
"Can't redirect stdout."
);
fclose
(
logfile
);
xprintf
(
"Version
1
\n
"
);
xprintf
(
"Version
2
\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
(
"Tag: %s"
,
tag
?
tag
:
""
);
xprintf
(
"Operating system version:
\n
"
);
print_version
();
xprintf
(
"Test output:
\n
"
);
...
...
@@ -331,21 +338,86 @@ run_tests ()
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
);
return
logname
;
}
if
(
remove
(
logname
))
report
(
R_WARNING
,
"Can't remove logfile: %d."
,
errno
);
free
(
logname
);
void
usage
()
{
fprintf
(
stderr
,
"\
Usage: winetest [OPTION]...
\n\n
\
-c console mode, no GUI
\n
\
-h print this message and exit
\n
\
-q quiet mode, no output at all
\n
\
-o FILE put report into FILE, do not submit
\n
\
-s FILE submit FILE, do not run tests
\n
\
-t TAG include TAG of characters [-.0-9a-zA-Z] in the report
\n
"
);
}
int
WINAPI
WinMain
(
HINSTANCE
hInst
,
HINSTANCE
hPrevInst
,
LPSTR
cmdLine
,
int
cmdShow
)
{
report
(
R_STATUS
,
"Starting up"
);
run_tests
();
report
(
R_STATUS
,
"Finished"
);
const
char
*
logname
=
NULL
;
char
*
tag
=
NULL
,
*
cp
;
char
*
submit
=
NULL
;
cmdLine
=
strtok
(
cmdLine
,
" "
);
while
(
cmdLine
)
{
if
(
*
cmdLine
==
'-'
)
if
(
cmdLine
[
2
])
{
report
(
R_ERROR
,
"Not a single letter option: %s"
,
cmdLine
);
usage
();
exit
(
2
);
}
cmdLine
++
;
switch
(
*
cmdLine
)
{
case
'c'
:
report
(
R_TEXTMODE
);
break
;
case
'h'
:
usage
();
exit
(
0
);
case
'q'
:
report
(
R_QUIET
);
break
;
case
's'
:
submit
=
strtok
(
NULL
,
" "
);
if
(
tag
)
report
(
R_WARNING
,
"ignoring tag for submit"
);
if
(
send_file
(
submit
))
report
(
R_ERROR
,
"can't submit file %s"
,
submit
);
break
;
case
'o'
:
logname
=
strtok
(
NULL
,
" "
);
run_tests
(
logname
,
tag
);
break
;
case
't'
:
tag
=
strtok
(
NULL
,
" "
);
cp
=
badtagchar
(
tag
);
if
(
cp
)
{
report
(
R_ERROR
,
"invalid char in tag: %c"
,
*
cp
);
usage
();
exit
(
2
);
}
break
;
default:
report
(
R_ERROR
,
"invalid option: -%c"
,
*
cmdLine
);
usage
();
exit
(
2
);
}
cmdLine
=
strtok
(
NULL
,
" "
);
}
if
(
!
logname
&&
!
submit
)
{
report
(
R_STATUS
,
"Starting up"
);
logname
=
run_tests
(
NULL
,
tag
);
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
))
report
(
R_WARNING
,
"Can't remove logfile: %d."
,
errno
);
report
(
R_STATUS
,
"Finished"
);
}
exit
(
0
);
}
programs/winetest/maketest
View file @
efc67253
#!/bin/sh
if
[
-z
"
$WINE_BUILD
"
]
;
then
WINE_BUILD
=
"
`
date
`
"
WINE_BUILD
=
"
`
date
+%Y%m%d.%H%M-auto
`
"
echo
"warning: using automatically generated BUILD tag:
$WINE_BUILD
"
1>&2
fi
...
...
programs/winetest/util.c
View file @
efc67253
...
...
@@ -84,3 +84,16 @@ char *strmake (size_t *lenp, ...)
va_end
(
ap
);
return
p
;
}
char
*
badtagchar
(
char
*
tag
)
{
while
(
*
tag
)
if
((
'a'
<=*
tag
&&
*
tag
<=
'z'
)
||
(
'A'
<=*
tag
&&
*
tag
<=
'Z'
)
||
(
'0'
<=*
tag
&&
*
tag
<=
'9'
)
||
*
tag
==
'-'
||
*
tag
==
'.'
)
tag
++
;
else
return
tag
;
return
NULL
;
}
programs/winetest/winetest.h
View file @
efc67253
...
...
@@ -33,6 +33,7 @@ void *xrealloc (void *op, size_t len);
void
xprintf
(
const
char
*
fmt
,
...);
char
*
vstrmake
(
size_t
*
lenp
,
va_list
ap
);
char
*
strmake
(
size_t
*
lenp
,
...);
char
*
badtagchar
(
char
*
tag
);
int
send_file
(
const
char
*
name
);
...
...
@@ -47,9 +48,12 @@ enum report_type {
R_DELTA
,
R_DIR
,
R_OUT
,
R_FATAL
,
R_WARNING
,
R_ASK
R_ERROR
,
R_FATAL
,
R_ASK
,
R_TEXTMODE
,
R_QUIET
};
int
report
(
enum
report_type
t
,
...);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment