-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwt-bot
executable file
·927 lines (849 loc) · 25 KB
/
wt-bot
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
#!/bin/sh
# Copyright (C) 2009-2016 Francois Gouget
#
# A script to update, build and check the Wine source code, and run the tests.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
name0=`basename "$0"`
case "$0" in
/*) dir0="$0" ;;
*/*) dir0=`pwd`/"$0" ;;
*) dir0=`which "$0" || echo \`pwd\`/"$0"` ;;
esac
dir0=`realpath "$dir0" 2>/dev/null || echo "$dir0"`
dir0=`dirname "$dir0"`
# Try to set a nicer output for the time command
time=""
which time >/dev/null 2>&1 && time="time"
TIME="Took %E (user %U system %S)"
export TIME
platform=`uname -s`
error()
{
echo "$name0:error:" "$@" >&2
}
run_ext()
{
type "$1" >/dev/null 2>&1 && "$@"
}
### Load the optional configuration file
[ -f "$dir0/$name0.config" ] && . "$dir0/$name0.config"
### Main
check_opt_val()
{
option="$1"
var="$2"
argc="$3"
if [ -n "$var" ]
then
error "$option can only be specified once"
opt_usage=2 # but continue processing options
fi
if [ $argc -eq 0 ]
then
error "missing value for $option"
opt_usage=2
return 1
fi
return 0
}
opt_dir=""
opt_update=""
opt_build=""
opt_buildtype=""
opt_buildretry=""
opt_gcc=""
opt_chroot=""
opt_spelling=""
opt_winapicheck=""
opt_wineprefix=""
opt_new_wineprefix=""
opt_macdrv=""
opt_winetest=""
opt_testexe=""
opt_email=""
opt_desc=""
opt_exclude=""
opt_submit=""
opt_submit_urls=""
opt_skip_old=""
opt_extras=""
usage=""
while [ $# -gt 0 ]
do
arg="$1"
shift
case "$arg" in
--dir)
if check_opt_val "$arg" "$opt_dir" $#
then
opt_dir="$1"
shift
fi
;;
--update)
opt_update="1"
;;
--build)
opt_build="1"
;;
--64)
opt_buildtype="64"
;;
--wow)
opt_buildtype="wow"
;;
--build-retry)
opt_buildretry="1"
;;
--chroot)
if check_opt_val "$arg" "$opt_chroot" $#
then
opt_chroot="$1"
shift
fi
;;
--gcc)
if check_opt_val "$arg" "$opt_gcc" $#
then
opt_gcc="$1"
shift
fi
;;
--spelling)
opt_spelling="1"
;;
--winapicheck)
opt_winapicheck="1"
;;
--wineprefix)
if check_opt_val "$arg" "$opt_wineprefix" $#
then
opt_wineprefix="$1"
shift
fi
;;
--new-wineprefix)
opt_new_wineprefix="1"
;;
--macdrv)
opt_macdrv="1"
;;
--winetest)
if check_opt_val "$arg" "$opt_winetest" $#
then
opt_winetest="$1"
shift
fi
;;
--testexe)
if check_opt_val "$arg" "$opt_testexe" $#
then
opt_testexe="$1"
shift
fi
;;
--exclude)
if check_opt_val "$arg" "$opt_exclude" $#
then
[ -n "$1" ] && opt_exclude="-n $1"
shift
fi
;;
--email)
if check_opt_val "$arg" "$opt_email" $#
then
opt_email="$1"
shift
fi
;;
--desc)
if check_opt_val "$arg" "$opt_desc" $#
then
opt_desc="$1"
shift
fi
;;
--no-submit)
opt_submit=""
;;
--submit)
opt_submit="1"
;;
--submit-urls)
if check_opt_val "$arg" "$opt_submit_urls" $#
then
opt_submit_urls="$1"
shift
fi
;;
--skip-old)
opt_skip_old="1"
;;
--help|-h|-\?)
usage="0"
;;
*)
if ! type is_extra_option >/dev/null 2>&1 || ! is_extra_option "$arg"
then
error "unknown option '$arg'"
usage="2"
break
fi
esac
done
if [ -z "$usage" ]
then
if [ -z "$opt_update$opt_build$opt_localchecks$opt_spelling$opt_winapicheck$opt_new_wineprefix$opt_winetest$opt_extras" ]
then
error "you must specify one or more tasks to perform"
usage="2"
fi
[ -n "$opt_dir" ] || opt_dir=`pwd`
if [ -f "$opt_dir/dlls/winecrt0/Makefile.in" ]
then
src_dir="."
elif [ -f "$opt_dir/../src/dlls/winecrt0/Makefile.in" ]
then
src_dir="../src"
if [ -n "$opt_spelling" -o -n "$opt_winapicheck" ]
then
error "--spelling and --winapicheck are not supported for out-of-tree builds"
usage="2"
fi
else
error "unable to find the Wine source for '$opt_dir'"
usage="2"
fi
if [ -z "$opt_build" ]
then
if [ -n "$opt_buildtype$opt_buildretry$opt_gcc$opt_chroot" ]
then
error "--64, --wow, --build-retry, --gcc and --chroot can only be used with --build"
usage="2"
fi
fi
if [ -n "$opt_wineprefix" ]
then
WINEPREFIX="$opt_wineprefix"
export WINEPREFIX
else
opt_wineprefix="$HOME/.wine"
fi
if [ -n "$opt_winetest" ]
then
if [ -z "$opt_email" ]
then
error "you must specify an email address for --winetest"
usage="2"
fi
if [ -z "$opt_submit" -a -n "$opt_skip_old$opt_submit_urls" ]
then
error "--skip-old and --submit-urls cannot be used without --submit"
usage="2"
fi
if [ -n "$opt_testexe" -a ! -f "$opt_testexe" ]
then
error "'$opt_testexe' does not point to a valid test executable"
usage="2"
fi
else
if [ -n "$opt_email$opt_desc$opt_testexe$opt_skip_old$opt_submit$opt_submit_urls$opt_exclude" ]
then
error "--email, --desc, --testexe, --skip-old, --submit, --submit-urls and --exclude cannot be used without --winetest"
usage="2"
fi
fi
fi
if [ "$usage" = "0" ]
then
echo "Usage: $name0 [--dir DIR] [--update]"
echo " [--build [--64|--wow] [--chroot ROOT] [--gcc GCC]"
echo " [--build-retry]] [--wineprefix DIR] [--new-wineprefix]"
echo " [--winetest TAG [--email EMAIL] [--desc DESC] [--exclude TESTS]"
echo " [--macdrv] [--testexe PATH] [--skip-old] [--no-submit]"
echo " [--submit-urls URL1[,URL2]] [--spelling] [--winapicheck] [--help]"
echo
echo "Update, build and check the Wine source code, and run the tests."
echo
echo "Where:"
echo " --dir DIR Specifies the Wine build directory. For out-of-tree builds"
echo " the source is supposed to be in '../src'."
echo " --update Update the Wine source."
echo " --build Unless specified otherwise performs a 32 bit Wine build. The"
echo " build log is stored in '$name0-make.log'."
echo " --64 Perform a 64 bit Wine build."
echo " --wow Perform a Windows on Windows build. The directory must point"
echo " to the 64 bit out-of-tree directory and the 32 bit one is"
echo " supposed to be in a sibling directory where the trailing"
echo " '64' was replaced with '32'."
echo " --chroot ROOT schroot to ROOT for the build."
echo " --gcc GCC Set \$CC to the specified compiler."
echo " --build-retry Retry the build from a clean tree if it fails."
echo " --wineprefix DIR Specifies the WINEPREFIX directory to operate on. By default"
echo " this is \$HOME/.wine."
echo " --new-wineprefix Resets the wineprefix."
echo " --winetest TAG Run the Wine tests using the specified tag. The test report"
echo " is stored in '$name0-TAG.report' and the log in"
echo " '$name0-TAG.log'."
echo " --email EMAIL The email address to use for the tests."
echo " --desc DESC A description string to be submitted with the WineTest"
echo " results."
echo " --exclude TESTS Tests to exclude. Note that excluding too many tests will"
echo " cause your report to be rejected."
echo " --macdrv Run the tests using the Mac driver."
echo " --testexe PATH Run the tests using the specified executable instead of the"
echo " in-tree Winelib binary."
echo " --skip-old The commitid of the last test run is stored in"
echo " '$name0-TAG.commit'. This option skips the tests if the last"
echo " commit has not changed."
echo " --no-submit Don't submit the test results."
echo " --submit-urls URL1[,URL2] A comma-separated list of URLs to submit the test"
echo " results to. An empty string means sending the results to the"
echo " default URL. Duplicate entries will cause duplicate uploads."
echo " --spelling Looks for spelling errors if the 'typos' tool is available."
echo " The result is stored in 'spelling.txt'."
echo " --winapicheck Runs winapi_check on the Wine source and store the report"
echo " in 'winapi_check.xxx'."
run_ext print_extra_usage
echo " --help, -h Shows this help message."
exit 0
elif [ -n "$usage" ]
then
error "try '$name0 --help' for more information"
exit $usage
fi
errors=""
##### Check if we're allowed to make noise
if [ -f "/tmp/quiet" ]
then
echo "Waiting for the green light"
while [ -f "/tmp/quiet" ]
do
echo -n .
sleep 60
done
echo
fi
##### --update
cd "$opt_dir"
run_ext pre_update
if [ -n "$opt_update" ]
then
cd "$src_dir"
git fetch -q origin 2>&1 | egrep -v '^(remote|Receiving objects|Resolving deltas):'
if [ -d ".dotest" ]
then
error "it looks like a rebase is already in progress. Aborting!"
exit 1
fi
git diff >"git.diff"
if [ -s "git.diff" ]
then
# There is uncommitted stuff. Just commit it so we can do a rebase
git commit -a -m "$name0 commit `date +%Y%m%d`"
if [ $? -ne 0 ]
then
error "the temporary commit failed"
exit 1
fi
fi
upstream=`git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || true`
git rebase $upstream >rebase.log 2>&1
if [ $? -ne 0 ]
then
error "the rebase failed. Finish the merge manually!"
cat rebase.log >&2
git diff >git.diff
exit 1
fi
rm rebase.log
cd "$opt_dir"
fi
##### --build
run_ext pre_build
prepare_tree()
{
# NFS failures or host crashes can leave 0 byte files behind.
find . -size 0c \( -name "*.o" -o -name "*.so" \) -print -exec rm {} \;
if [ ! -x "configure" ]
then
# When a tree is alternatively built by one user and then another,
# configure gets confused when it tries to change the permissions
# on an executable file that was not originally created by the
# current user. So delete any such file. However we don't want to
# do that on checked-in files (such are configure itself) so only
# do it for out-of-tree builds.
[ -n "$USER" ] || USER=`id -u`
find . -type f ! -user $USER -perm -u+x -print -exec rm {} \;
fi
}
do_build()
{
_config="$1"
if [ -n "$opt_gcc" ]
then
CC="$opt_gcc"
export CC
fi
chroot=""
if [ -n "$opt_chroot" ]
then
chroot="schroot -p -c $opt_chroot --"
fi
echo "Running: $_config"
$time $chroot sh -c "$_config"
_rc=$?
[ $_rc -ne 0 ] && return $_rc
prepare_tree
if [ -z "$opt_buildretry" ]
then
_build="( \"$dir0/wt-make\" -k || \"$dir0/wt-make\" -j1 )"
else
_build="\"$dir0/wt-make\""
fi
echo
echo "Running: $_build"
$time $chroot sh -c "$_build"
_rc=$?
[ $_rc -eq 0 -o -z "$opt_buildretry" ] && return $_rc
echo
echo "The build failed. Trying again from a clean tree..."
prepare_tree
_clean="\"$dir0/wt-make\" distclean"
_src=`cd "$src_dir" && pwd`
[ "$_src" = `pwd` ] && _clean="$_clean; git clean -Xdf"
echo "Running: $_clean"
$time $chroot sh -c "$_clean"
_build="( \"$dir0/wt-make\" || \"$dir0/wt-make\" -j1 )"
echo "Running: $_config && $_build"
$time $chroot sh -c "$_config && $_build"
}
if [ -n "$opt_build" ]
then
(
config_opts=""
case "$opt_buildtype" in
64|wow)
config_opts="$config_opts --enable-win64"
;;
esac
if [ "$platform" = "Darwin" ]
then
# Needed since XQuartz 2.7.2
config_opts="$config_opts --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib"
fi
do_build "\"$src_dir/configure\" $config_opts"
) >"$name0-make.log" 2>&1
[ $? -ne 0 ] && failed_compile="`pwd`/$name0-make.log"
if [ "$opt_buildtype" = "wow" ]
then
dir32=`basename "$opt_dir" | sed -e 's/64$/32/'`
dir32=`cd "../$dir32" && pwd`
(
cd "$dir32" &&
do_build "\"$src_dir/configure\" --with-wine64=\"$opt_dir\""
) >"$dir32/$name0-make.log" 2>&1
[ $? -ne 0 ] && failed_compile="$dir32/$name0-make.log"
fi
if [ -n "$failed_compile" ]
then
error "the compilation failed (see $failed_compile):"
tail "$failed_compile" >&2
errors="1"
fi
cd "$opt_dir"
fi
run_ext post_build
##### --spelling
if [ -n "$opt_spelling" ] && which typos >/dev/null
then
typos >spelling.txt 2>spelling.err
if [ -s "spelling.txt" ]
then
echo
echo "*****"
echo "Spelling errors (see spelling.txt):"
cat spelling.txt spelling.err
errors="1"
else
rm spelling.txt spelling.err
fi
fi
##### --winapicheck
if [ -n "$opt_winapicheck" ]
then
./tools/winapi/winapi_check --no-progress >winapi_check.new
{
grep ': calling convention mismatch' winapi_check.new
grep 'not declared in the spec file' winapi_check.new
grep ': argument count differs:' winapi_check.new
grep 'but config.h is not included' winapi_check.new
egrep '(: file not found|is not a local include)' winapi_check.new
grep 'C++ comments not allowed' winapi_check.new | grep -v '//www\.'
} | egrep -v '(DllGetClassObject|DllMain|MSVCRT__setjmp3|RtlRaiseException|RtlUnwind)' >winapi_check.worst
if [ -s "winapi_check.worst" ]
then
echo
echo "*****"
echo "Worst winapi_check errors (see winapi_check.worst):"
cat winapi_check.worst
else
rm winapi_check.worst
fi
cmp -s winapi_check.log winapi_check.new
if [ $? -ne 0 ]
then
diff -u winapi_check.log winapi_check.new | egrep "^\+[^+]" >winapi_check.diff
echo
echo "*****"
echo "New winapi_check errors (see winapi_check.new):"
cat winapi_check.diff
fi
fi
##### --new-wineprefix
BASE_ADDON_URL="https://dl.winehq.org/wine"
verify_addon()
{
key="$1"
basename="$2"
filename="$3"
[ -f "$filename" ] || return 1
checksums=`sed -e "s/^.*define *${key}_SHA *\"\\([^\"]*\\)\"/\1/" -e t -e d "$src_dir/dlls/appwiz.cpl/addons.c"`
for refsum in $checksums
do
if [ `echo $refsum | wc -c` -gt 42 ]
then
csum=`"$dir0/wt-sum" --sha256 "$filename"`
else
csum=`"$dir0/wt-sum" --sha1 "$filename"`
fi
[ "$refsum" = "$csum" ] && return 0
done
error "the $addon_base checksum does not match"
return 1
}
download_msi_addon()
{
addon="$1"
version="$2"
arch="$3"
key="$4"
if [ -z "$arch" ]
then
addon_base="wine-$addon-$version.msi"
else
addon_base="wine-$addon-$version-$arch.msi"
fi
addon_path="$opt_dir/../$addon/$addon_base"
if ! verify_addon "$key" "$addon_base" "$addon_path"
then
echo "Downloading $addon_base"
rm -f "$addon_path"
fi
if [ ! -f "$addon_path" ]
then
mkdir -p `dirname "$addon_path"`
url="$BASE_ADDON_URL/wine-$addon/$version/$addon_base"
$urlget "$url" >"$addon_path"
if [ ! -s "$addon_path" ]
then
rm -f "$addon_path"
error "$addon_path is empty, aborting"
exit 1
fi
if ! verify_addon "$key" "$addon_base" "$addon_path"
then
# Make sure the broken (malicious?) addon will not be used
mv "$addon_path" "$addon_path.bad"
rm -f "$addon_path" # in case mv failed
error "the $addon_base checksum does not match, aborting"
exit 1
fi
fi
}
decompress()
{
filename="$1"
case "$filename" in
*.bz2) bzip2 -c -d "$filename" ;;
*.gz) gzip -c -d "$filename" ;;
*.xz) xz -c -d "$filename" ;;
esac
}
download_tar_addon()
{
addon="$1"
version="$2"
arch="$3"
addon_base="wine-$addon-$version"
addon_file="$addon_base-$arch"
[ "$addon" = "gecko" ] && addon_base="$addon_file"
addon_path="$opt_dir/../$addon/$addon_base"
if [ ! -d "$addon_path" ]
then
echo "Downloading $addon_file"
url="$BASE_ADDON_URL/wine-$addon/$version/$addon_file"
# FIXME Ignore the unstripped binaries for now because the Gecko ones
# don't work :-(
#for suffix in -unstripped.tar.xz .tar.xz -unstripped.tar.bz2 .tar.bz2 .tar.gz
for suffix in .tar.xz .tar.bz2 .tar.gz
do
$urlget "$url$suffix" >"$addon_file$suffix"
[ -s "$addon_file$suffix" ] && break
rm -f "$addon_file$suffix"
done
addon_file="$addon_file$suffix"
if [ ! -s "$addon_file" ]
then
rm -f "$addon_file"
return 1
fi
parentdir=`dirname "$addon_path"`
mkdir -p "$parentdir"
decompress "$addon_file" | ( cd "$parentdir" && tar xf - )
if [ $? -ne 0 ]
then
error "could not extract $addon_file, aborting"
exit 1
fi
case "$addon_file" in
*-unstripped.tar.*)
mv "$addon_path-unstripped" "$addon_path"
;;
esac
if [ ! -d "$addon_path" ]
then
error "$addon_file did not contain $addon_base, aborting"
exit 1
fi
rm -f "$addon_file"
fi
return 0
}
download_addon()
{
addon="$1"
arch="$2"
key=`echo $addon | tr a-z A-Z`
version=`sed -e "s/^.*define *${key}_VERSION *\"\\([^\"]*\\)\"/\\1/" -e t -e d "$src_dir/dlls/appwiz.cpl/addons.c"`
if [ -z "$version" ]
then
error "could not get the $addon version, aborting"
exit 1
fi
download_tar_addon "$addon" "$version" "$arch" ||
download_msi_addon "$addon" "$version" "$arch" "$key"
}
if [ -n "$opt_new_wineprefix" ]
then
if [ -d "$opt_wineprefix/dosdevices" ]
then
rm -rf "$opt_wineprefix"
fi
if type wget >/dev/null 2>&1
then
urlget="wget -O-"
else
urlget="curl --location"
fi
# Grab the addons
arch="x86"
if [ -f "$opt_dir/programs/reg/x86_64-windows/reg.exe" ]
then
arch="x86_64"
fi
download_addon "gecko" "$arch"
download_addon "mono" "x86" || download_addon "mono"
fi
if [ "$platform" = "Darwin" -a -z "$opt_macdrv" ]
then
# Use this hack so it works even during the WINEPREFIX creation
if [ ! -d "$opt_wineprefix/dosdevices" ]
then
mkdir "$opt_wineprefix"
echo "WINE REGISTRY Version 2" >"$opt_wineprefix/user.reg"
fi
cat >>"$opt_wineprefix/user.reg" <<EOF
[Software\\\\Wine\\\\Drivers] 0
"Graphics"="x11,mac"
EOF
fi
##### --winetest
get_git_head()
{
cd "$src_dir"
git rev-parse HEAD 2>/dev/null
if [ $? -ne 0 ]
then
branch=`cat ".git/HEAD" | cut -d' ' -f2`
git rev-parse "$branch"
fi
}
logbase="$name0-$opt_winetest"
[ -n "$failed_compile" ] && opt_winetest=""
if [ -n "$opt_winetest" -a -n "$opt_skip_old" ]
then
latest=`get_git_head`
if [ -z "$latest" ]
then
error "unable to determine the current commit id"
else
last=`cat "$logbase.commit" 2>/dev/null`
[ "$last" != "$latest" ] || opt_winetest=""
fi
elif [ -z "$opt_winetest" -a -n "$opt_wineprefix" ]
then
logbase="$name0-wineprefix"
fi
if [ -n "$opt_new_wineprefix$opt_winetest" ]
then
if [ "$platform" = "Darwin" ]
then
if [ -n "$DYLD_FALLBACK_LIBRARY_PATH" ]
then
true # Leave it as is
elif [ -f "/usr/X11/lib/libfreetype.6.dylib" ]
then
DYLD_FALLBACK_LIBRARY_PATH="/usr/X11/lib"
export DYLD_FALLBACK_LIBRARY_PATH
elif [ -f "/opt/local/lib/libfreetype.6.dylib" ]
then
DYLD_FALLBACK_LIBRARY_PATH="/opt/local/lib"
export DYLD_FALLBACK_LIBRARY_PATH
fi
elif [ -z "$DISPLAY" ]
then
DISPLAY=":0.0"
export DISPLAY
fi
run_ext pre_winetest
sleep 10800 &
sleep_pid=$!
rm -f "$logbase.report"
"$dir0/wt-screensaver" 10800 &
dssaver_pid=$!
{
# Tell winedbg not to bring up the crash dialog as that causes
# everything to stop until a timeout kicks in.
./wine "reg.exe" ADD "HKCU\\Software\\Wine\\WineDbg" /v ShowCrashDialog /t REG_DWORD /d 0 /f
rc=$?
if [ -n "$opt_new_wineprefix" ]
then
# FIXME Workaround for bug 41713: Ensure the WINEPREFIX has been
# created *before* starting winetest.exe.
./server/wineserver -w
fi
[ -n "$opt_winetest" ] || return $rc
if [ -z "$opt_testexe" ]
then
opt_testexe="programs/winetest/x86_64-windows/winetest.exe"
[ -f "$opt_testexe" ] || opt_testexe="programs/winetest/i386-windows/winetest.exe"
fi
set -x
$time ./wine "$opt_testexe" -c -t $opt_winetest -m "$opt_email" \
-i "$opt_desc" -o "$logbase.report" $opt_exclude
set +x
if [ -n "$opt_submit" ]
then
# If unset, add a comma so we get in the for loop and send the
# results to the default server.
[ -n "$opt_submit_urls" ] || opt_submit_urls=","
saved_IFS=$IFS
IFS=","
for url in $opt_submit_urls
do
IFS=$saved_IFS
options=""
[ -n "$url" ] && options="-S $url"
set -x
$time ./wine "$opt_testexe" -c -s "$logbase.report" $options
set +x
done
fi
} >"$logbase.log" 2>&1 &
winetest_pid=$!
progress=""
count=0
while kill -0 $sleep_pid 2>/dev/null
do
sleep 10
kill -0 $winetest_pid 2>/dev/null
if [ $? -ne 0 ]
then
wait $winetest_pid
rc=$?
if [ $rc -ne 0 ]
then
echo
echo "*****"
echo "winetest failed (rc=$rc, see $logbase.log):"
tail "$logbase.log"
errors="1"
elif ! grep "Running: Done" "$logbase.log" >/dev/null
then
echo
echo "*****"
echo "winetest could not complete (see $logbase.log):"
tail "$logbase.log"
elif ! grep "Network transfer: Done" "$logbase.log" >/dev/null
then
echo
echo "*****"
echo "The network transfer failed (see $logbase.log):"
tail "$logbase.log"
elif [ -n "$opt_submit" ]
then
echo "$latest" >"$logbase.commit"
fi
winetest_pid=""
break
fi
count=`expr $count + 1`
if [ $count -eq 30 ] # 5 minutes
then
last=`egrep -a '^(Extracting|Running):' "$logbase.log" | tail -1`
if [ "$progress" = "$last" ]
then
echo
echo "*****"
echo "winetest got stuck (see $logbase.log):"
tail "$logbase.log"
errors="1"
break
fi
progress="$last"
count=0
fi
done
kill $sleep_pid
kill $dssaver_pid
if [ -n "$opt_submit" ]
then
# Don't leave Wine processes behind. They may interfere with the next
# winetest run or with the machine shutting down.
./server/wineserver -k
fi
if [ -n "$winetest_pid" ]
then
echo
echo "*****"
echo "winetest timed out (see $logbase.log):"
tail "$logbase.log"
errors="1"
fi
run_ext post_winetest
fi
[ -n "$errors" ] && exit 1
exit 0