-
Notifications
You must be signed in to change notification settings - Fork 21
/
test.sh
143 lines (130 loc) · 2.77 KB
/
test.sh
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
platform=win32
noorig=0 # use original C code
noasm=0 # use asm code
noc=0 # use optimized C code
nodll=0 # use dll with asm optimizations (original code)
nong=0 # use zlib-ng
extraargs="--delete --compact --memory"
dllname=zlibwapi32.dll
dllname_ng=zlib-ng_32.dll
if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == "linux" ]; then
platform=unix
nodll=1
nong=1
fi
for arg in "$@"; do # using quoted $@ will allow to correctly separate arguments like [ --path="some string with spaces" -debug ]
# echo "ARG=$arg"
case $arg in
--noasm)
noasm=1
;;
--noc)
noc=1
;;
--noorig)
noorig=1
;;
--nodll)
nodll=1
;;
--nong)
nong=1
;;
--c)
noasm=1
nodll=1
noorig=1
nong=1
;;
--asm)
noc=1
nodll=1
noorig=1
nong=1
;;
--orig)
noc=1
nodll=1
noasm=1
nong=1
;;
--ng)
noc=1
noasm=1
nodll=1
noorig=1
nong=0
;;
--win64)
platform=win64
dllname=zlibwapi64.dll
dllname_ng=zlib-ng_64.dll
;;
--level=*|--exclude=*|--verify)
extraargs="$extraargs $arg"
;;
*)
if [ -d "$arg" ]; then
dir="$arg"
else
cat <<EOF
Usage: test.sh [path] [options]
Options:
--no[asm|c|orig|dll|ng] disable particular target
--c test only C implementation
--asm test only Asm implementation
--orig test only original implementation
--ng test only zlib-ng
--win64 test for 64-bit Windows
--level=X select compression level
--exclude=dir exclude directory from testing
--verify unpack compressed file
EOF
exit
fi
esac
done
# build all targets with hiding build output
target=vc-$platform
[ "$platform" == "unix" ] && target=linux # shame, "unix" vs "linux"
[ "$platform" == "win64" ] && noasm=1
if ! ./build.sh $target > /dev/null 2>&1; then
echo "Build failed!"
exit 1
fi
echo "Testing $platform ($extraargs)"
function DoTests
{
local dir="$1"
shift
echo "--- Processing data at $dir ---"
if [ "$platform" == "unix" ]; then
# convert Windows path to Linux (VM)
if [ "${dir:1:1}" == ":" ]; then
dir="/mnt/hgfs/${dir:0:1}${dir:2}"
fi
fi
if [ $noasm == 0 ]; then
obj/bin/test-Asm-$platform "$dir" $extraargs $*
fi
if [ $noc == 0 ]; then
obj/bin/test-C-$platform "$dir" $extraargs $*
fi
if [ $nong == 0 ]; then
obj/bin/test-Orig-$platform "$dir" $extraargs --dll=test/dll/$dllname_ng $*
fi
if [ $nodll == 0 ]; then
obj/bin/test-Orig-$platform "$dir" $extraargs --dll=test/dll/$dllname $*
fi
if [ $noorig == 0 ]; then
obj/bin/test-Orig-$platform "$dir" $extraargs $*
fi
}
if [ "$dir" ]; then
DoTests "$dir"
else
DoTests D:/EpicGames/UE_5.0/Engine/Source --exclude=ThirdParty
DoTests D:/EpicGames/UE_5.0/Engine/Binaries/Win64
DoTests D:/!unsorted/silesia
fi