[PATCH v2 40/50] test: helper-to-tcg docker tests

Anton Johansson via qemu development <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
Adds a docker container with LLVM versions 15-21 and a docker test for
building helper-to-tcg and running end-to-end tests along with running
check-tcg, for testing targets such as Hexagon.

Signed-off-by: Anton Johansson <[email protected]>
--
NOTE: Last I checked I had some troubles with C++17 support within the
container, was a while ago though.
---
 tests/docker/dockerfiles/debian-llvm.docker | 38 +++++++++++++++++++
 tests/docker/test-helper-to-tcg             | 41 +++++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-llvm.docker
 create mode 100755 tests/docker/test-helper-to-tcg

diff --git a/tests/docker/dockerfiles/debian-llvm.docker b/tests/docker/dockerfiles/debian-llvm.docker
new file mode 100644
index 0000000000..7bfc084a34
--- /dev/null
+++ b/tests/docker/dockerfiles/debian-llvm.docker
@@ -0,0 +1,38 @@
+FROM docker.io/library/debian:11-slim
+
+RUN apt update && \
+    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
+    DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt install -y --no-install-recommends \
+        bison \
+        ca-certificates \
+        flex \
+        gawk \
+        libmpc-dev \
+        libmpfr-dev \
+        libglib2.0-dev \
+        libpixman-1-dev \
+        make \
+        ninja-build \
+        rsync \
+        pkgconf \
+        wget \
+        lsb-release \
+        software-properties-common \
+        gnupg \
+        meson \
+        python3-pip \
+        python3-setuptools \
+        python3-venv \
+        python3-wheel
+
+RUN /usr/bin/pip3 install tomli
+
+RUN wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh
+RUN ./llvm.sh 15 all
+RUN ./llvm.sh 16 all
+RUN ./llvm.sh 17 all
+RUN ./llvm.sh 18 all
+RUN ./llvm.sh 19 all
+RUN ./llvm.sh 20 all
+RUN ./llvm.sh 21 all
diff --git a/tests/docker/test-helper-to-tcg b/tests/docker/test-helper-to-tcg
new file mode 100755
index 0000000000..0c27040d60
--- /dev/null
+++ b/tests/docker/test-helper-to-tcg
@@ -0,0 +1,41 @@
+#!/bin/bash -e
+
+TEST_COMMAND=""
+TARGET_LIST=""
+
+cd "$BUILD_DIR"
+
+# Checks helper-to-tcg builds and passes unit tests
+# for targetted LLVM versions.  Run meson from QEMU source so helper-to-tcg tests can find
+# `tcg-global-mappings.h`.
+for version in {15..21}; do
+    llvm_config=llvm-config-${version}
+    build_dir="${BUILD_DIR}/build-helper-to-tcg-${version}"
+    cxx=$(${llvm_config} --bindir)/clang++
+    [ ! -d ${build_dir} ] && mkdir ${build_dir}
+    CXX=${cxx} meson setup ${build_dir} ${QEMU_SRC}/subprojects/helper-to-tcg -Dllvm_config_path=${llvm_config}
+    meson compile -C ${build_dir}
+    meson test -C ${build_dir} --suite 'helper-to-tcg:helper-to-tcg'
+done
+
+# Runs check-tcg for all LLVM versions
+llvm_config_main=llvm-config-15
+bin_main=$(${llvm_config_main} --bindir)
+cc_main=${bin_main}/clang
+cxx_main=${bin_main}/clang++
+for version in {15..21}; do
+    llvm_config=llvm-config-${version}
+    build_dir=build-qemu-${version}
+    bin=$(${llvm_config} --bindir)
+    cxx=${bin}/clang++
+    cc=${bin}/clang
+    [ ! -d ${build_dir} ] && mkdir ${build_dir}
+
+    pushd ${build_dir}
+
+    TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
+    build_qemu "--cc=${cc_main} --cxx=${cxx_main} -Dhelper-to-tcg:llvm_config_path=${llvm_config} --enable-debug-tcg"
+    check_tcg
+
+    popd
+done
-- 
2.52.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.