-
Notifications
You must be signed in to change notification settings - Fork 3
/
winetricks-alpha-test
142 lines (124 loc) · 3.79 KB
/
winetricks-alpha-test
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
#!/bin/sh
# Regression test for winetricks-alpha
set -x
# verbs known to not work in -q mode yet
BLACKLIST="cygwin"
errors=0
fail()
{
echo FAIL: $@
errors=`expr $errors + 1`
}
case "$LANG" in
""|"C") echo "Some games won't install in the Posix locale; doing 'export LANG=en_US.UTF-8'" ; export LANG=en_US.UTF-8;;
esac
case "$OS" in
"Windows_NT")
# Mostly unimplemented...
# Cheezy fix for getting rid of double slashes when running cygwin in wine
case "$HOME" in
/) HOME="" ;;
esac
WINE=""
WINESERVER=true
DRIVE_C="C:/"
;;
*)
export WINE=${WINE:-wine}
export WINESERVER=${WINESERVER:-wineserver}
;;
esac
srcdir=`dirname $0`
srcdir=`cd $srcdir; pwd`
test_speed()
{
(/usr/bin/time sh winetricks-alpha $1) 2> time.log > /dev/null
# 0.44user 0.19system 0:00.84elapsed 75%CPU (0avgtext+0avgdata 26656maxresident)k
t=`awk '/elapsed/ {print $3}' < time.log`
seconds=`echo $t | sed 's/0://;s/\..*//'`
minutes=`echo $t | sed 's/:.*//'`
seconds=`expr $seconds + $minutes \* 60`
echo test_speed: winetricks-alpha $1 took $seconds seconds
# Longest runtime as of 11 Dec 2010 is 5 seconds on an e8400 with cygwin
if test $seconds -gt 7
then
fail "test_speed: winetricks-alpha $1 took $seconds seconds"
fi
}
test_app_checksums()
{
# Verify the installation
if [ -f "$srcdir/winetricksverify.d/$app.sha1sum" ]
then
windir="`$WINE cmd /c echo "%windir%" | cut -c 4- | tr -d '\015'`"
progdir="`$WINE cmd /c echo "%ProgramFiles%" | cut -c 4- | tr -d '\015'`"
cd "$DRIVE_C"
# Fix up the filenames, which can differ between Windows versions/Wine:
# FIXME: we need a way to guarantee that all _original_ .sha1sums are the same.
# Preferably generated under 32-bit wine, so that we don't need a really complex sed
# substitution here...
sed -e "s|/Program\ Files/|/$progdir/|" -e "s|/windows/|/$windir/|" < "$srcdir/winetricksverify.d/$app.sha1sum" > $app.sha1sum.tmp
if ! sha1sum -c $app.sha1sum.tmp
then
fail "test_app_checksum $app !"
fi
rm $app.sha1sum.tmp
cd $srcdir
fi
}
test_app()
{
app=$1
export WINEPREFIX=$HOME/winetrickstest-prefixes/$app
DRIVE_C="$WINEPREFIX/dosdevices/c:"
# change if you don't want to skip ones already installed
if test -d $HOME/winetrickstest-prefixes/$app
then
echo "Skipping $app, already installed"
return 0
#rm -rf $WINEPREFIX
fi
mkdir -p $WINEPREFIX
# Isolate us from the user's home directory
sh -x winetricks sandbox gecko
echo "Installing $app"
if ! sh winetricks-alpha -v -q $app
then
fail "test_app $app failed!"
return
fi
echo -n "Done installing $app, disk usage "
du -sh $WINEPREFIX
$WINESERVER -w
echo "Wineserver done."
ps augxw | grep exe
test_app_checksums
}
test_install_cached_or_download()
{
sh winetricks-alpha list-cached list-download > ticd.log
if grep .------------------- ticd.log
then
fail "output of list-cached list-download contained garbage"
exit 1
fi
sort -u < ticd.log | egrep -v "$BLACKLIST" > ticd.verbs
for a in `cat ticd.verbs`
do
test_app $a
done
sh winetricks-alpha list-cached > cached.txt
sh winetricks-alpha list-download > download.txt
comm -23 download.txt cached.txt > download-but-not-cached.txt
if test `wc -l < download-but-not-cached.txt` != 0
then
fail "test_install_cached_or_download: asked to install all downloadable apps, but some not listed as cached afterwards"
fi
}
test_speed list
test_speed list-download
test_speed list-cached
test_speed list-installed
test_install_cached_or_download
echo "Test over, $errors failures."
test $errors = 0