From 4b3f371d75c5caf81aefd477962bd78645c2997f Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Sat, 20 Apr 2024 21:11:13 +0000 Subject: [PATCH] Gitlab CI: Run tests on Wine. --- .gitlab-ci.yml | 2 + tools/ci/download-addons.py | 59 +++++++++++++++++++++++++ tools/ci/test.yml | 46 +++++++++++++++++++ tools/run-tests/gitlab-wine-failing.txt | 11 +++++ 4 files changed, 118 insertions(+) create mode 100755 tools/ci/download-addons.py create mode 100644 tools/ci/test.yml create mode 100644 tools/run-tests/gitlab-wine-failing.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f596c2f1..7f5c0453 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ stages: - image - build + - test variables: GIT_SUBMODULE_STRATEGY: "none" @@ -8,3 +9,4 @@ variables: include: - local: "tools/ci/image.yml" - local: "tools/ci/build.yml" + - local: "tools/ci/test.yml" diff --git a/tools/ci/download-addons.py b/tools/ci/download-addons.py new file mode 100755 index 00000000..2ec369ef --- /dev/null +++ b/tools/ci/download-addons.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 + +import os +import shutil +import tempfile +import urllib.request + +need_gecko = True +need_mono = False + +basedir = os.path.join(os.getcwd(), "wine-addons") + +existing_files = set(os.listdir(basedir)) + +addons_url = 'https://gitlab.winehq.org/wine/wine/-/raw/master/dlls/appwiz.cpl/addons.c?ref_type=heads&inline=false' + +with urllib.request.urlopen(addons_url) as response: + addons_contents = response.read().decode('ascii') + +gecko_version = None +mono_version = None + +for line in addons_contents.splitlines(): + if line.startswith('#define GECKO_VERSION '): + gecko_version = line.split()[2].strip('"') + print('Gecko version: ' + gecko_version) + if line.startswith('#define MONO_VERSION '): + mono_version = line.split()[2].strip('"') + print('Mono version: ' + mono_version) + +needed_files = {} + +if need_gecko: + needed_files['wine-gecko-' + gecko_version + '-x86.msi'] = 'https://dl.winehq.org/wine/wine-gecko/' + gecko_version + '/wine-gecko-' + gecko_version + '-x86.msi' + needed_files['wine-gecko-' + gecko_version + '-x86_64.msi'] = 'https://dl.winehq.org/wine/wine-gecko/' + gecko_version + '/wine-gecko-' + gecko_version + '-x86_64.msi' +if need_mono: + needed_files['wine-mono-' + mono_version + '-x86.msi'] = 'https://dl.winehq.org/wine/wine-mono/' + mono_version + '/wine-mono-' + mono_version + '-x86.msi' + +def download(url, filename): + print("Downloading "+url) + with urllib.request.urlopen(url) as response: + with tempfile.NamedTemporaryFile(delete=False) as tmpfile: + try: + shutil.copyfileobj(response, tmpfile) + shutil.move(tmpfile.name, filename) + except: + os.unlink(tmpfile.name) + raise + +for f in needed_files: + if f in existing_files: + continue + download(needed_files[f], os.path.join(basedir, f)) + +for f in existing_files: + if f not in needed_files: + print("Removing "+f) + os.unlink(os.path.join(basedir, f)) + diff --git a/tools/ci/test.yml b/tools/ci/test.yml new file mode 100644 index 00000000..1be38205 --- /dev/null +++ b/tools/ci/test.yml @@ -0,0 +1,46 @@ +linux-test: + stage: test + image: $CI_REGISTRY/wine/wine:debian-bookworm + interruptible: true + cache: + - key: wine-addons + paths: + - wine-addons/ + needs: + - job: build + before_script: + - | + - export BASEDIR=$PWD + - export PATH=$BASEDIR/usr/local/bin:$PATH + - export DISPLAY=:0 + - export LC_ALL=C.UTF-8 + - export LP_NUM_THREADS=4 + - export WINEDEBUG=err-all,fixme-all + - | + cat >$HOME/xorg.conf << EOF + Section "Device" + Identifier "dummy" + Driver "dummy" + VideoRam 32768 + EndSection + EOF + - echo 'exec /usr/bin/fvwm -f config -c "Style * MwmDecor" -c "Style * UsePPosition" 2>/dev/null' >$HOME/.xinitrc + - startx -- -config $HOME/xorg.conf $DISPLAY & + - mkdir -p wine-addons + - tools/ci/download-addons.py + - curl -s -S -L -o wine-build.zip "https://gitlab.winehq.org/wine/wine/-/jobs/artifacts/master/download?job=build-daily-linux" + - unzip -q wine-build.zip + - mkdir -p $HOME/Documents $HOME/Desktop usr/local/share/wine/gecko + - cp -l $BASEDIR/wine-addons/*.msi usr/local/share/wine/gecko + - pulseaudio --start --exit-idle-time=-1 + - WINEDLLOVERRIDES=mscoree= wine wineboot.exe -u + - wine reg add 'HKCU\Software\Wine\WineDbg' /v ShowCrashDialog /t REG_DWORD /d 0 /f + - wine reg add 'HKCU\Software\Wine\Mono' /v RuntimePath /d "$(wine winepath -w ${BASEDIR}/image)" /f + - wine64 regsvr32 /s mscoree + - wineserver -w + script: + - wine tests/run-tests.exe -fail-list:tests/gitlab-wine-failing.txt >mono-tests.log 2>&1 + artifacts: + when: always + paths: + - mono-tests.log diff --git a/tools/run-tests/gitlab-wine-failing.txt b/tools/run-tests/gitlab-wine-failing.txt new file mode 100644 index 00000000..6aeac735 --- /dev/null +++ b/tools/run-tests/gitlab-wine-failing.txt @@ -0,0 +1,11 @@ +WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest:EmptyLineCollapsibleTest +WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest:EmptyLineTest +WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest:IndentTest +WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest:InlineObjectTest +WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest:NewlineCharacterCollapsibleTest +WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest:OverflowTest +WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest:SingleWordCollapsibleTest +WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest:SingleWordTest +WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest:WrapTest +MonoTests.System.Windows.Forms.DataGridTableStyleTest:HeaderFontNull2 +MonoTests.System.Windows.Forms.FormTest:FormStartupPositionChangeTest