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
90baafee
Commit
90baafee
authored
Apr 20, 2004
by
Ferenc Wagner
Committed by
Alexandre Julliard
Apr 20, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Change to console mode so that winetest runs under WinRash.
- Move from spawnvp() to CreateProcess(). - Force a 2-minute timeout on individual tests.
parent
8fc374d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
51 deletions
+119
-51
Makefile.in
programs/winetest/Makefile.in
+1
-1
main.c
programs/winetest/main.c
+118
-50
No files found.
programs/winetest/Makefile.in
View file @
90baafee
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
winetest.exe
MODULE
=
winetest.exe
APPMODE
=
-m
windows
APPMODE
=
-m
console
IMPORTS
=
comctl32 user32 wsock32
IMPORTS
=
comctl32 user32 wsock32
C_SRCS
=
\
C_SRCS
=
\
...
...
programs/winetest/main.c
View file @
90baafee
...
@@ -45,7 +45,6 @@ struct wine_test
...
@@ -45,7 +45,6 @@ struct wine_test
int
resource
;
int
resource
;
int
subtest_count
;
int
subtest_count
;
char
**
subtests
;
char
**
subtests
;
int
is_elf
;
char
*
exename
;
char
*
exename
;
};
};
...
@@ -56,7 +55,7 @@ struct rev_info
...
@@ -56,7 +55,7 @@ struct rev_info
};
};
static
struct
wine_test
*
wine_tests
;
static
struct
wine_test
*
wine_tests
;
static
struct
rev_info
*
rev_infos
;
static
struct
rev_info
*
rev_infos
=
NULL
;
static
const
char
*
wineloader
;
static
const
char
*
wineloader
;
...
@@ -194,7 +193,7 @@ void* extract_rcdata (int id, DWORD* size)
...
@@ -194,7 +193,7 @@ void* extract_rcdata (int id, DWORD* size)
return
addr
;
return
addr
;
}
}
/* Fills in the name
, is_elf
and exename fields */
/* Fills in the name and exename fields */
void
void
extract_test
(
struct
wine_test
*
test
,
const
char
*
dir
,
int
id
)
extract_test
(
struct
wine_test
*
test
,
const
char
*
dir
,
int
id
)
{
{
...
@@ -218,7 +217,6 @@ extract_test (struct wine_test *test, const char *dir, int id)
...
@@ -218,7 +217,6 @@ extract_test (struct wine_test *test, const char *dir, int id)
*
exepos
=
0
;
*
exepos
=
0
;
test
->
name
=
xrealloc
(
test
->
name
,
exepos
-
test
->
name
+
1
);
test
->
name
=
xrealloc
(
test
->
name
,
exepos
-
test
->
name
+
1
);
report
(
R_STEP
,
"Extracting: %s"
,
test
->
name
);
report
(
R_STEP
,
"Extracting: %s"
,
test
->
name
);
test
->
is_elf
=
!
memcmp
(
code
+
1
,
"ELF"
,
3
);
if
(
!
(
fout
=
fopen
(
test
->
exename
,
"wb"
))
||
if
(
!
(
fout
=
fopen
(
test
->
exename
,
"wb"
))
||
(
fwrite
(
code
,
size
,
1
,
fout
)
!=
1
)
||
(
fwrite
(
code
,
size
,
1
,
fout
)
!=
1
)
||
...
@@ -226,54 +224,132 @@ extract_test (struct wine_test *test, const char *dir, int id)
...
@@ -226,54 +224,132 @@ extract_test (struct wine_test *test, const char *dir, int id)
test
->
exename
);
test
->
exename
);
}
}
/* Run a command for MS milliseconds. If OUT != NULL, also redirect
stdout to there.
Return the exit status, -2 if can't create process or the return
value of WaitForSingleObject.
*/
int
run_ex
(
char
*
cmd
,
const
char
*
out
,
DWORD
ms
)
{
STARTUPINFO
si
;
PROCESS_INFORMATION
pi
;
int
fd
,
oldstdout
=
-
1
;
DWORD
wait
,
status
;
GetStartupInfo
(
&
si
);
si
.
wShowWindow
=
SW_HIDE
;
si
.
dwFlags
=
STARTF_USESHOWWINDOW
;
if
(
out
)
{
fd
=
open
(
out
,
O_WRONLY
|
O_CREAT
,
0666
);
if
(
-
1
==
fd
)
report
(
R_FATAL
,
"Can't open '%s': %d"
,
out
,
errno
);
oldstdout
=
dup
(
1
);
if
(
-
1
==
oldstdout
)
report
(
R_FATAL
,
"Can't save stdout: %d"
,
errno
);
if
(
-
1
==
dup2
(
fd
,
1
))
report
(
R_FATAL
,
"Can't redirect stdout: %d"
,
errno
);
close
(
fd
);
}
if
(
!
CreateProcessA
(
NULL
,
cmd
,
NULL
,
NULL
,
TRUE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
))
{
status
=
-
2
;
}
else
{
CloseHandle
(
pi
.
hThread
);
wait
=
WaitForSingleObject
(
pi
.
hProcess
,
ms
);
if
(
wait
==
WAIT_OBJECT_0
)
{
GetExitCodeProcess
(
pi
.
hProcess
,
&
status
);
}
else
{
switch
(
wait
)
{
case
WAIT_FAILED
:
report
(
R_ERROR
,
"Wait for '%s' failed: %d"
,
cmd
,
GetLastError
());
break
;
case
WAIT_TIMEOUT
:
report
(
R_ERROR
,
"Process '%s' timed out."
,
cmd
);
break
;
default:
report
(
R_ERROR
,
"Wait returned %d"
,
wait
);
}
status
=
wait
;
if
(
!
TerminateProcess
(
pi
.
hProcess
,
257
))
report
(
R_ERROR
,
"TerminateProcess failed: %d"
,
GetLastError
());
wait
=
WaitForSingleObject
(
pi
.
hProcess
,
5000
);
switch
(
wait
)
{
case
WAIT_FAILED
:
report
(
R_ERROR
,
"Wait for termination of '%s' failed: %d"
,
cmd
,
GetLastError
());
break
;
case
WAIT_OBJECT_0
:
break
;
case
WAIT_TIMEOUT
:
report
(
R_ERROR
,
"Can't kill process '%s'"
,
cmd
);
break
;
default:
report
(
R_ERROR
,
"Waiting for termination: %d"
,
wait
);
}
}
CloseHandle
(
pi
.
hProcess
);
}
if
(
out
)
{
close
(
1
);
if
(
-
1
==
dup2
(
oldstdout
,
1
))
report
(
R_FATAL
,
"Can't recover stdout: %d"
,
errno
);
close
(
oldstdout
);
}
return
status
;
}
void
void
get_subtests
(
const
char
*
tempdir
,
struct
wine_test
*
test
,
int
id
)
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
total
;
char
*
buffer
,
*
index
;
char
buffer
[
8192
]
,
*
index
;
const
char
header
[]
=
"Valid test names:"
,
seps
[]
=
"
\r\n
"
;
const
char
header
[]
=
"Valid test names:"
,
seps
[]
=
"
\r\n
"
;
int
oldstdout
;
const
char
*
argv
[]
=
{
"wine"
,
NULL
,
NULL
};
int
allocated
;
int
allocated
;
test
->
subtest_count
=
0
;
subname
=
tempnam
(
0
,
"sub"
);
subname
=
tempnam
(
0
,
"sub"
);
if
(
!
subname
)
report
(
R_FATAL
,
"Can't name subtests file."
);
if
(
!
subname
)
report
(
R_FATAL
,
"Can't name subtests file."
);
oldstdout
=
dup
(
1
);
if
(
-
1
==
oldstdout
)
report
(
R_FATAL
,
"Can't preserve stdout."
);
subfile
=
fopen
(
subname
,
"w+b"
);
if
(
!
subfile
)
report
(
R_FATAL
,
"Can't open subtests file."
);
if
(
-
1
==
dup2
(
fileno
(
subfile
),
1
))
report
(
R_FATAL
,
"Can't redirect output to subtests."
);
fclose
(
subfile
);
extract_test
(
test
,
tempdir
,
id
);
extract_test
(
test
,
tempdir
,
id
);
argv
[
1
]
=
test
->
exename
;
run_ex
(
test
->
exename
,
subname
,
5000
)
;
if
(
test
->
is_elf
)
spawnvp
(
_P_WAIT
,
wineloader
,
argv
);
subfile
=
fopen
(
subname
,
"r"
);
else
if
(
!
subfile
)
{
spawnvp
(
_P_WAIT
,
test
->
exename
,
argv
+
1
);
report
(
R_ERROR
,
"Can't open subtests output of %s: %d"
,
subsize
=
lseek
(
1
,
0
,
SEEK_CUR
);
test
->
name
,
errno
);
buffer
=
xmalloc
(
subsize
+
1
)
;
goto
quit
;
}
lseek
(
1
,
0
,
SEEK_SET
);
total
=
fread
(
buffer
,
1
,
sizeof
buffer
,
subfile
);
total
=
0
;
fclose
(
subfile
)
;
while
((
bytes_read
=
read
(
1
,
buffer
+
total
,
subsize
-
total
))
if
(
sizeof
buffer
==
total
)
{
&&
(
signed
)
bytes_read
!=
-
1
)
report
(
R_ERROR
,
"Subtest list of %s too big."
,
total
+=
bytes_read
;
test
->
name
,
sizeof
buffer
)
;
if
(
bytes_read
)
goto
quit
;
report
(
R_FATAL
,
"Can't get subtests of %s"
,
test
->
name
);
}
buffer
[
total
]
=
0
;
buffer
[
total
]
=
0
;
index
=
strstr
(
buffer
,
header
);
index
=
strstr
(
buffer
,
header
);
if
(
!
index
)
if
(
!
index
)
{
report
(
R_
FATAL
,
"Can't parse subtests output of %s"
,
report
(
R_
ERROR
,
"Can't parse subtests output of %s"
,
test
->
name
);
test
->
name
);
goto
quit
;
}
index
+=
sizeof
header
;
index
+=
sizeof
header
;
allocated
=
10
;
allocated
=
10
;
test
->
subtests
=
xmalloc
(
allocated
*
sizeof
(
char
*
));
test
->
subtests
=
xmalloc
(
allocated
*
sizeof
(
char
*
));
test
->
subtest_count
=
0
;
index
=
strtok
(
index
,
seps
);
index
=
strtok
(
index
,
seps
);
while
(
index
)
{
while
(
index
)
{
if
(
test
->
subtest_count
==
allocated
)
{
if
(
test
->
subtest_count
==
allocated
)
{
...
@@ -286,34 +362,26 @@ get_subtests (const char *tempdir, struct wine_test *test, int id)
...
@@ -286,34 +362,26 @@ get_subtests (const char *tempdir, struct wine_test *test, int id)
}
}
test
->
subtests
=
xrealloc
(
test
->
subtests
,
test
->
subtests
=
xrealloc
(
test
->
subtests
,
test
->
subtest_count
*
sizeof
(
char
*
));
test
->
subtest_count
*
sizeof
(
char
*
));
free
(
buffer
);
close
(
1
);
quit:
if
(
-
1
==
dup2
(
oldstdout
,
1
))
report
(
R_FATAL
,
"Can't recover old stdout."
);
close
(
oldstdout
);
if
(
remove
(
subname
))
if
(
remove
(
subname
))
report
(
R_FATAL
,
"Can't remove subtests file."
);
report
(
R_WARNING
,
"Can't delete file '%s': %d"
,
subname
,
errno
);
free
(
subname
);
free
(
subname
);
}
}
/* Return number of failures, -1 if couldn't spawn process. */
void
int
run_test
(
struct
wine_test
*
test
,
const
char
*
subtest
)
run_test
(
struct
wine_test
*
test
,
const
char
*
subtest
)
{
{
int
status
;
int
status
;
const
char
*
argv
[]
=
{
"wine"
,
test
->
exename
,
subtest
,
NULL
};
const
char
*
file
=
get_test_source_file
(
test
->
name
,
subtest
);
const
char
*
file
=
get_test_source_file
(
test
->
name
,
subtest
);
const
char
*
rev
=
get_file_rev
(
file
);
const
char
*
rev
=
get_file_rev
(
file
);
char
*
cmd
=
strmake
(
NULL
,
"%s %s"
,
test
->
exename
,
subtest
);
xprintf
(
"%s:%s start %s %s
\n
"
,
test
->
name
,
subtest
,
file
,
rev
);
xprintf
(
"%s:%s start %s %s
\n
"
,
test
->
name
,
subtest
,
file
,
rev
);
if
(
test
->
is_elf
)
status
=
run_ex
(
cmd
,
NULL
,
120000
);
status
=
spawnvp
(
_P_WAIT
,
wineloader
,
argv
);
free
(
cmd
);
else
status
=
spawnvp
(
_P_WAIT
,
test
->
exename
,
argv
+
1
);
if
(
status
==
-
1
)
xprintf
(
"Can't run: %d, errno=%d: %s
\n
"
,
status
,
errno
,
strerror
(
errno
));
xprintf
(
"%s:%s done (%d)
\n
"
,
test
->
name
,
subtest
,
status
);
xprintf
(
"%s:%s done (%d)
\n
"
,
test
->
name
,
subtest
,
status
);
return
status
;
}
}
BOOL
CALLBACK
BOOL
CALLBACK
...
...
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