From 8244d1d35d2a8ede03f75cb0c5616aaf8228188e Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Sun, 8 Sep 2024 06:53:39 +0200 Subject: [PATCH] * Limit lldb autopkg test to the lldb architectures. * Generate debian/tests/* files. --- debian/changelog | 2 ++ debian/rules | 3 +- debian/tests/cmake-clang-test.in | 29 +++++++++++++++ debian/tests/cmake-llvm-test.in | 39 +++++++++++++++++++++ debian/tests/control | 1 + debian/tests/control.in | 25 +++++++++++++ debian/tests/integration-test-suite-test.in | 39 +++++++++++++++++++++ 7 files changed, 137 insertions(+), 1 deletion(-) create mode 100755 debian/tests/cmake-clang-test.in create mode 100755 debian/tests/cmake-llvm-test.in create mode 100644 debian/tests/control.in create mode 100755 debian/tests/integration-test-suite-test.in diff --git a/debian/changelog b/debian/changelog index 46cddf91..dd462676 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ llvm-toolchain-19 (1:19.1.0~++rc4-3) UNRELEASED; urgency=medium * Consolidate disabling CMake's package validation checks a bit. * debian/qualify-clang.sh: Skip OpenMP test, if libomp-dev is not available. * Disable CMake's package validation check for libLLVM.so.1. + * Limit lldb autopkg test to the lldb architectures. + * Generate debian/tests/* files. -- Matthias Klose Thu, 05 Sep 2024 10:59:19 +0200 diff --git a/debian/rules b/debian/rules index 26a166cc..567237ec 100755 --- a/debian/rules +++ b/debian/rules @@ -681,7 +681,7 @@ stamps/preconfigure: @echo "LLVM_SPIRV_INSTALLED=$(LLVM_SPIRV_INSTALLED)" @echo "DOC_GENERATION=$(DOC_GENERATION)" - for f in debian/*.in; do \ + for f in debian/*.in debian/tests/*.in; do \ f2=$$(echo $$f | sed 's/\.in$$//;s/X\.Y/$(LLVM_VERSION)/'); \ echo "$$f => $$f2"; \ sed -e 's|@DEB_HOST_MULTIARCH@|$(DEB_HOST_MULTIARCH)|g' \ @@ -698,6 +698,7 @@ stamps/preconfigure: -e "s|@LLVM_VERSION_MINOR@|$(LLVM_VERSION_MINOR)|g" \ -e "s|@LLVM_VERSION_NEXT@|$(LLVM_VERSION_NEXT)|g" \ -e "s|@LLVM_VERSION@|$(LLVM_VERSION)|g" $$f > $$f2; \ + [ -x $$f ] && chmod +x $$f2; \ done # Make install file executable for dh-exec diff --git a/debian/tests/cmake-clang-test.in b/debian/tests/cmake-clang-test.in new file mode 100755 index 00000000..19891735 --- /dev/null +++ b/debian/tests/cmake-clang-test.in @@ -0,0 +1,29 @@ +#!/bin/sh + +set -e + +LLVM_VERSION=@LLVM_VERSION@ + +# this is taken from libjsoncpp package +# Presence of $AUTOPKGTEST_TMP implies that someone will handle cleanup for us, so we +# can avoid duplicating the effort (signal handling, etc.) here. +if [ -z "$AUTOPKGTEST_TMP" ] +then + echo "Required envvar AUTOPKGTEST_TMP \"$AUTOPKGTEST_TMP\" is not set" >&2 + exit 1 +fi + + +# the idea was taken from spirv-llvm-translator package + +cd "$AUTOPKGTEST_TMP" +cat < CMakeLists.txt +cmake_minimum_required(VERSION 3.22) +project(cmake-clang-test) +find_package(Clang $LLVM_VERSION.1 REQUIRED) + +EOF + + +mkdir build && cd build +cmake .. diff --git a/debian/tests/cmake-llvm-test.in b/debian/tests/cmake-llvm-test.in new file mode 100755 index 00000000..3c7da843 --- /dev/null +++ b/debian/tests/cmake-llvm-test.in @@ -0,0 +1,39 @@ +#!/bin/sh + +set -e + +LLVM_VERSION=@LLVM_VERSION@ + +# this is taken from libjsoncpp package +# Presence of $AUTOPKGTEST_TMP implies that someone will handle cleanup for us, so we +# can avoid duplicating the effort (signal handling, etc.) here. +if [ -z "$AUTOPKGTEST_TMP" ] +then + echo "Required envvar AUTOPKGTEST_TMP \"$AUTOPKGTEST_TMP\" is not set" >&2 + exit 1 +fi + + +# the idea was taken from spirv-llvm-translator package + +cd "$AUTOPKGTEST_TMP" +cat < CMakeLists.txt +cmake_minimum_required(VERSION 3.22) +project(cmake-llvm-test) +find_package(LLVM $LLVM_VERSION.1 REQUIRED + COMPONENTS + Analysis + BitReader + BitWriter + Core + Support + TransformUtils + llvm-as + llvm-dis +) + +EOF + + +mkdir build && cd build +cmake .. diff --git a/debian/tests/control b/debian/tests/control index 7c44b631..94b20ede 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -19,6 +19,7 @@ Depends: gcc, build-essential, cmake, llvm-19-dev, clang-19, libclang-19-dev Test-Command: python3 -c "import lldb; print(lldb.__file__); print(lldb)" Depends: python3-lldb-19 +Architecture: amd64 arm64 armel armhf i386 ppc64el s390x Test-Command: python3 -c "import clang; print(clang.__file__); print(clang)" Depends: python3-clang-19 diff --git a/debian/tests/control.in b/debian/tests/control.in new file mode 100644 index 00000000..08435165 --- /dev/null +++ b/debian/tests/control.in @@ -0,0 +1,25 @@ +Test-Command: bash -v ./debian/qualify-clang.sh +Depends: @, cmake, make, g++, file, dpkg-dev +# Comment the dbgsym package because of bug #917528 +# dbgsym packages not being available in testing +# clang-@LLVM_VERSION@-dbgsym, libclang1-@LLVM_VERSION@-dbgsym +Restrictions: allow-stderr +Architecture: amd64 arm64 i386 + +Tests: integration-test-suite-test +Depends: @, cmake, make, g++, libstdc++-14-dev +Restrictions: allow-stderr +Architecture: amd64 arm64 + +Tests: cmake-llvm-test +Depends: gcc, build-essential, cmake, llvm-@LLVM_VERSION@-dev + +Tests: cmake-clang-test +Depends: gcc, build-essential, cmake, llvm-@LLVM_VERSION@-dev, clang-@LLVM_VERSION@, libclang-@LLVM_VERSION@-dev + +Test-Command: python3 -c "import lldb; print(lldb.__file__); print(lldb)" +Depends: python3-lldb-@LLVM_VERSION@ +Architecture: amd64 arm64 armel armhf i386 ppc64el s390x + +Test-Command: python3 -c "import clang; print(clang.__file__); print(clang)" +Depends: python3-clang-@LLVM_VERSION@ diff --git a/debian/tests/integration-test-suite-test.in b/debian/tests/integration-test-suite-test.in new file mode 100755 index 00000000..81bbde09 --- /dev/null +++ b/debian/tests/integration-test-suite-test.in @@ -0,0 +1,39 @@ +#!/bin/sh + +set -e + +LLVM_VERSION=@LLVM_VERSION@ + +# this is taken from libjsoncpp package +# Presence of $AUTOPKGTEST_TMP implies that someone will handle cleanup for us, so we +# can avoid duplicating the effort (signal handling, etc.) here. +if [ -z "$AUTOPKGTEST_TMP" ] +then + echo "Required envvar AUTOPKGTEST_TMP \"$AUTOPKGTEST_TMP\" is not set" >&2 + exit 1 +fi + +# Copy the integration repo to the temp dir +cp -Rv integration-test-suite/* "$AUTOPKGTEST_TMP"/ +cd "$AUTOPKGTEST_TMP" + +mkdir build +cd build +cmake -DLIT=/usr/lib/llvm-$LLVM_VERSION/build/utils/lit/lit.py \ + -DCLANG_BINARY=/usr/bin/clang-$LLVM_VERSION \ + -DCLANGXX_BINARY=/usr/bin/clang++-$LLVM_VERSION \ + -DCLANG_TIDY_BINARY=/usr/bin/clang-tidy-$LLVM_VERSION \ + -DCLANG_FORMAT_BINARY=/usr/bin/clang-format-$LLVM_VERSION \ + -DLLD_BINARY=/usr/bin/lld-$LLVM_VERSION \ + -DLLDB_BINARY=/usr/bin/lldb-$LLVM_VERSION \ + -DLLVMCONFIG_BINARY=/usr/bin/llvm-config-$LLVM_VERSION \ + -DOPT_BINARY=/usr/bin/opt-$LLVM_VERSION \ + -DSCANBUILD=/usr/bin/scan-build-$LLVM_VERSION \ + -DCLANG_TIDY_BINARY=/usr/bin/clang-tidy-$LLVM_VERSION \ + -DSCANVIEW=/usr/bin/scan-view-$LLVM_VERSION \ + -DLLVMNM=/usr/bin/llvm-nm-$LLVM_VERSION \ + -DLLVMPROFDATA=/usr/bin/llvm-profdata-$LLVM_VERSION \ + -DENABLE_COMPILER_RT=OFF \ + -DENABLE_LIBCXX=ON \ + -DLLVM_CMAKE_PREFIX_PATH=/usr/lib/llvm-$LLVM_VERSION/lib/cmake/ ../ +make check