diff --git a/.gitignore b/.gitignore index f5af83ea5..fa75a1dc9 100644 --- a/.gitignore +++ b/.gitignore @@ -459,3 +459,4 @@ uwp-project/Assets/fonts uwp-project/Assets/gendata uwp-project/Assets/ui_art !uwp-project/devilutionX_TemporaryKey.pfx +/.s390x-ccache/ diff --git a/tools/Dockerfile.s390x b/tools/Dockerfile.s390x new file mode 100644 index 000000000..5a166769b --- /dev/null +++ b/tools/Dockerfile.s390x @@ -0,0 +1,13 @@ +FROM s390x/alpine + +# This command uses the `wget` from BusyBox. +RUN wget -nv -nc https://github.com/diasurgical/devilutionx-assets/releases/download/v2/spawn.mpq -P /opt/ + +# We use clang instead of GCC to have ASAN. GCC does not support ASAN with musl. +# We also need to install GCC because it provides crtbeginS.o: +# https://pkgs.alpinelinux.org/contents?file=crtbeginS.o&path=&name=gcc&branch=edge&repo=main&arch=s390x +RUN apk add --no-cache \ + clang15 gcc binutils musl-dev ninja cmake ccache sdl2-dev sdl2_image-dev fmt-dev \ + libpng-dev bzip2-dev gtest-dev + +ENV CC=/usr/bin/clang CXX=/usr/bin/clang++ diff --git a/tools/run_big_endian_tests.sh b/tools/run_big_endian_tests.sh new file mode 100755 index 000000000..4b6e76278 --- /dev/null +++ b/tools/run_big_endian_tests.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +PARALLELISM="$(getconf _NPROCESSORS_ONLN)" + +set -xeuo pipefail + +if [[ "$(docker images -q devilutionx-s390x-test)" = "" ]]; then + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + docker build -f tools/Dockerfile.s390x -t devilutionx-s390x-test tools/ +fi + +# We disable ASAN and UBSAN for now because of: +# https://gitlab.alpinelinux.org/alpine/aports/-/issues/14435 +docker run -u "$(id -u "$USER"):$(id -g "$USER")" --rm --mount "type=bind,source=${PWD},target=/host" devilutionx-s390x-test sh -c "cd /host && \ +export CCACHE_DIR=/host/.s390x-ccache && \ +cmake -S. -Bbuild-s390x-test -G Ninja -DASAN=OFF -DUBSAN=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \ + -DNONET=ON -DNOSOUND=ON -DVERSION_NUM=1.0.0 -DVERSION_SUFFIX=FFFFFFF && \ +ln -sf /opt/spawn.mpq /host/build-s390x-test/spawn.mpq && \ +cmake --build build-s390x-test -j ${PARALLELISM} && \ +ctest --test-dir build-s390x-test --output-on-failure -j ${PARALLELISM}"