-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_winloader.sh
More file actions
executable file
·82 lines (71 loc) · 1.6 KB
/
test_winloader.sh
File metadata and controls
executable file
·82 lines (71 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#! /bin/bash
assert() {
if ! "$@"; then
echo "Assertion failed: $@" >&2
echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]}" >&2
exit 1
fi
}
pushd build
# Dynamic Test
expected=`cat <<EOF
'./windynamic.exe', 'a', 'b', 'c'
large params: 1, 2, 3, 4, 5, 6, 7, 8
uint32: 12345678, uint64: 1234567812345678
pow: 16
malloc: abcdef01
stdin: 0, stdout: 1, stderr: 2
exe_global_var_bss: 0
exe_global_var_bss: 1
exe_global_var_data: 42
exe_global_var_data: 24
*get_lib_var_bss(): 0
lib_var_bss: 0
lib_var_bss: 1
lib_var_bss: 44
*get_lib_var_bss(): 44
*get_lib_var_data(): 42
lib_var_data: 42
lib_var_data: 43
lib_var_data: 44
*get_lib_var_data(): 44
preserved registers: 1, 2, 3, 4, 5, 6, 7, 8
large_params_swap 36
EOF
`
result=`./winloader ./windynamic.exe a b c`
assert [ $? == 0 ]
assert [ "$result" == "$expected" ]
# Dynamic stdlib test
expected=`cat <<EOF
'./windynamicfull.exe', 'a', 'b', 'c'
large params: 1, 2, 3, 4, 5, 6, 7, 8
uint32: 12345678, uint64: 1234567812345678
pow: 16
malloc: abcdef01
stdin: 0, stdout: 1, stderr: 2
exe_global_var_bss: 0
exe_global_var_bss: 1
exe_global_var_data: 42
exe_global_var_data: 24
*get_lib_var_bss(): 0
lib_var_bss: 0
lib_var_bss: 1
lib_var_bss: 44
*get_lib_var_bss(): 44
*get_lib_var_data(): 42
lib_var_data: 42
lib_var_data: 43
lib_var_data: 44
*get_lib_var_data(): 44
EOF
`
result=`./winloader ./windynamicfull.exe a b c`
assert [ $? == 0 ]
assert [ "$result" == "$expected" ]
result=`./winloader ./readwin.exe ./readwin.exe`
assert [ $? == 0 ]
expected="Hello Tiny Wine!"
assert [ "`./winloader ./windows_hello_printf.exe`" == "$expected" ]
echo All tests passed
popd