diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/build-gating-libomp.fmf b/build-gating-libomp.fmf new file mode 100644 index 0000000..1ddd29e --- /dev/null +++ b/build-gating-libomp.fmf @@ -0,0 +1,37 @@ +summary: libomp clang tests for build/PR gating +adjust: + - because: "Plan to be ran when either executed locally, or executed by CI system to gate a build or PR." + when: >- + trigger is defined + and trigger != commit + and trigger != build + enabled: false + + - because: "When testing SCL-ized LLVM, the collection must be enabled first" + environment+: + WITH_SCL: "scl enable llvm-toolset-13.0" + when: "collection == llvm-toolset-13.0" + - because: "When testing SCL-ized LLVM, the collection must be enabled first" + environment+: + WITH_SCL: "scl enable llvm-toolset-14.0" + when: "collection == llvm-toolset-14.0" + + - because: "libomp not supported in s390x" + when: arch == s390x + enabled: false + +discover: + how: fmf + test: libomp +execute: + how: tmt +prepare: + # We want to make sure libomp is not already present on the system to ensure + # that clang pulls in the correct libomp dependencies when it is installed. + - name: Drop libomp + how: shell + script: | + yum erase -y libomp libomp-devel clang clang-libs +provision: + hardware: + memory: ">= 4 GiB" diff --git a/build-gating-pocl.fmf b/build-gating-pocl.fmf new file mode 100644 index 0000000..4b74ced --- /dev/null +++ b/build-gating-pocl.fmf @@ -0,0 +1,32 @@ +summary: PoCL clang tests for build/PR gating +adjust: + - because: "Plan to be ran when either executed locally, or executed by CI system to gate a build or PR." + when: >- + trigger is defined + and trigger != commit + and trigger != build + enabled: false + + - because: "PoCL is shipped with Fedora, not RHEL/CentOS" + when: >- + distro == rhel + or distro == centos + enabled: false + +discover: + how: fmf + test: pocl +execute: + how: tmt +prepare: + # Programs linked against pocl should be able to run without clang installed, + # so when we run the test we want to make sure clang is not installed to + # verify we haven't introduced an implicit dependency on clang. + - name: Drop clang + how: shell + script: | + dnf erase -y clang + +provision: + hardware: + memory: ">= 4 GiB" diff --git a/build-gating.fmf b/build-gating.fmf new file mode 100644 index 0000000..58b77df --- /dev/null +++ b/build-gating.fmf @@ -0,0 +1,63 @@ +# +# Build/PR gating tests for clang +# +# Compatible with various LLVM 13 distributions: +# +# * Fedora (ursine packages) +# * Centos 9 stream (ursine packages) +# * RHEL-9 (ursine packages) +# * RHEL-8 (Red Hat module) +# * RHEL-7 (software collection) +# + +summary: Clang tests for build/PR gating +adjust: + - because: "Plan to be ran when either executed locally, or executed by CI system to gate a build or PR." + when: >- + trigger is defined + and trigger != commit + and trigger != build + enabled: false + + - because: "When testing SCL-ized LLVM, the collection must be enabled first" + environment+: + WITH_SCL: "scl enable llvm-toolset-13.0" + when: "collection == llvm-toolset-13.0" + - because: "When testing SCL-ized LLVM, the collection must be enabled first" + environment+: + WITH_SCL: "scl enable llvm-toolset-14.0" + when: "collection == llvm-toolset-14.0" + + # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. + - because: "On RHEL, CRB must be enabled to provide rarer packages" + prepare+: + - name: Enable CRB + how: shell + script: dnf config-manager --set-enabled rhel-CRB + when: >- + distro == rhel-9 + or distro == rhel-8 + + # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. + - because: "On CentOS, CRB must be enabled to provide rarer packages" + prepare+: + - name: Enable CRB + how: shell + script: dnf config-manager --set-enabled crb + when: >- + distro == centos + +discover: + - name: clang-tests + how: fmf + filter: "tag:-not-in-default" + - name: upstream-llvm-integration-testsuite + how: fmf + url: https://src.fedoraproject.org/rpms/llvm.git + ref: rawhide + test: integration-test-suite +execute: + how: tmt +provision: + hardware: + memory: ">= 4 GiB" diff --git a/clang-format-diff/main.fmf b/clang-format-diff/main.fmf new file mode 100644 index 0000000..06ed176 --- /dev/null +++ b/clang-format-diff/main.fmf @@ -0,0 +1,15 @@ +summary: clang-format-diff +test: "$WITH_SCL ./test.sh" +adjust: + # Common requirements when LLVM is not SCL-ized + - require: + - clang-tools-extra + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require: + - llvm-toolset-13.0-clang-tools-extra + when: "collection == llvm-toolset-13.0" + - require: + - llvm-toolset-14.0-clang-tools-extra + when: "collection == llvm-toolset-14.0" diff --git a/clang-format-diff/test.sh b/clang-format-diff/test.sh new file mode 100755 index 0000000..d6fcb47 --- /dev/null +++ b/clang-format-diff/test.sh @@ -0,0 +1,5 @@ +#!/bin/sh -eux + +# Check that clang-format-diff is in PATH. +# rhbz#1939018 +clang-format-diff -h diff --git a/fedora-flags/main.fmf b/fedora-flags/main.fmf new file mode 100644 index 0000000..945b493 --- /dev/null +++ b/fedora-flags/main.fmf @@ -0,0 +1,30 @@ +summary: fedora-flags +test: "$WITH_SCL ./runtest.sh" +require: + - redhat-rpm-config +adjust: + + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" + + - because: s390x does not have epel repo which is required to provide rpm macros + enabled: false + when: >- + distro == rhel-7 + and arch == s390x + + # Note: this needs epel-release repo to be available + - because: "To enable rpm macros not available by default (e.g. build_cflags), epel-rpm-macros is needed" + require+: + - epel-rpm-macros + when: distro == rhel-7 diff --git a/libomp/main.fmf b/libomp/main.fmf new file mode 100644 index 0000000..d9c5b5c --- /dev/null +++ b/libomp/main.fmf @@ -0,0 +1,36 @@ +# TODO: get fitting summary - what's the purpose of this test? Comment from the STI version says: +# +# We want to make sure libomp is not already present on the system to ensure +# that clang pulls in the correct libomp dependencies when it is installed. +summary: libomp tests +# This test requires a special preparation, see `/tests/tests-libomp` plan. As such, +# it shouldn't be part of the `/tests/default` plan. +tag: + - not-in-default +test: "$WITH_SCL ./runtest.sh" +adjust: + - because: "libomp is not supported in s390x" + when: arch == s390x + enabled: false + + # Common requirements when LLVM is not SCL-ized + - require: + - clang + - clang-libs + - libomp + - libomp-devel + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-clang-libs + - llvm-toolset-13.0-libomp + - llvm-toolset-13.0-libomp-devel + when: "collection == llvm-toolset-13.0" + - require: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-clang-libs + - llvm-toolset-14.0-libomp + - llvm-toolset-14.0-libomp-devel + when: "collection == llvm-toolset-14.0" \ No newline at end of file diff --git a/llvm-test-suite/main.fmf b/llvm-test-suite/main.fmf new file mode 100644 index 0000000..7d61dfb --- /dev/null +++ b/llvm-test-suite/main.fmf @@ -0,0 +1,18 @@ +# TODO: once llvm-test-suite is converted to TMT, we can just link the test from plan. +summary: Run tests from llvm-test-suite package + +adjust: + - because: "llvm-test-suite is available for Fedora, not RHEL/CentOS" + when: >- + distro == rhel + or distro == centos + enabled: false + +test: "$WITH_SCL ./test.sh" + +require: + - git + - clang + - ninja-build + - llvm-test-suite +duration: 1h diff --git a/llvm-test-suite/test.sh b/llvm-test-suite/test.sh new file mode 100755 index 0000000..85418bc --- /dev/null +++ b/llvm-test-suite/test.sh @@ -0,0 +1,7 @@ +#!/bin/sh -eux + +# TODO: tmt does not support a remote git repo as a requirement, one has to clone it "manually". + +git clone --depth 1 https://src.fedoraproject.org/rpms/llvm-test-suite.git llvm-test-suite +cd llvm-test-suite/tests/test-suite +./runtest.sh diff --git a/llvm-toolchain/runtest.sh b/llvm-toolchain/runtest.sh deleted file mode 100755 index eeebda5..0000000 --- a/llvm-toolchain/runtest.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# Tests for using a full LLVM toolchain: clang + compiler-rt + libcxx + lld - -set -ex pipefail - -# Test compile a C program. -cat << EOF | \ - clang -fuse-ld=lld -rtlib=compiler-rt -x c - && \ - ./a.out | grep 'Hello World' - -#include -int main(int argc, char **argv) { - printf("Hello World\n"); - return 0; -} -EOF - -# Test compile a C++ program. -cat << EOF | \ - clang++ -x c++ -fuse-ld=lld -rtlib=compiler-rt -stdlib=libc++ - && \ - ./a.out | grep 'Hello World' - -#include -int main(int argc, char **argv) { - std::cout << "Hello World\n"; - return 0; -} -EOF diff --git a/openmp-rpm/main.fmf b/openmp-rpm/main.fmf new file mode 100644 index 0000000..2344193 --- /dev/null +++ b/openmp-rpm/main.fmf @@ -0,0 +1,30 @@ +summary: Test build a simple RPM package to ensure that -fopenmp works +test: "$WITH_SCL ./runtest.sh" +require: + - rpm-build +adjust: + - because: "libomp not supported in s390x" + when: arch == s390x + enabled: false + + - because: "Use yum in RHEL < 8" + require+: + - yum-utils + environment+: + BUILDDEP_CMD: "yum-builddep" + when: distro < rhel-8 + + - because: "Use dnf in RHEL >= 8, Fedora and CentOS" + require+: + - dnf-plugins-core + environment+: + BUILDDEP_CMD: "dnf builddep" + when: distro >= rhel-8 or distro != rhel + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-build + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-build + when: "collection == llvm-toolset-14.0" \ No newline at end of file diff --git a/openmp-rpm/runtest.sh b/openmp-rpm/runtest.sh new file mode 100755 index 0000000..37647fe --- /dev/null +++ b/openmp-rpm/runtest.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -ex + +${BUILDDEP_CMD} -y test.spec +rpmbuild --define '_sourcedir .' --define '_builddir .' -bb test.spec diff --git a/openmp-rpm/test.c b/openmp-rpm/test.c new file mode 100644 index 0000000..b20d164 --- /dev/null +++ b/openmp-rpm/test.c @@ -0,0 +1,7 @@ +int main(int argc, char **argv) { + int res = 1; +#pragma omp parallel +#pragma omp single + res = 0; + return res; +} diff --git a/openmp-rpm/test.spec b/openmp-rpm/test.spec new file mode 100644 index 0000000..e317a6a --- /dev/null +++ b/openmp-rpm/test.spec @@ -0,0 +1,36 @@ +%global toolchain clang +%{?scl:%global scl_prefix %{scl}-} + +Name: test +Version: 1 +Release: 1 +Summary: Test package for checking that RPM packages using -fopenmp build correctly +License: MIT + +BuildRequires: %{?scl_prefix}clang +BuildRequires: %{?scl_prefix}libomp + +Source0: test.c + +%description +clang was adding RUNPATH to binaries that use OpenMP, and since RUNPATH +is prohibited in Fedora builds, this was causing packages using clang +and OpenMP to fail to build. + +References: +https://fedoraproject.org/wiki/Changes/Broken_RPATH_will_fail_rpmbuild +https://github.com/llvm/llvm-project/commit/9b9d08111b618d74574ba03e5cc3d752ecc56f55 + +%build +clang ${CFLAGS} -c %{SOURCE0} -o test.o +clang ${LDFLAGS} -fopenmp test.o -o main + +%check +./main + +%install +install -d %{buildroot}%{_bindir} +install main %{buildroot}%{_bindir} + +%files +%{_bindir}/main diff --git a/pocl/main.fmf b/pocl/main.fmf new file mode 100644 index 0000000..1143416 --- /dev/null +++ b/pocl/main.fmf @@ -0,0 +1,24 @@ +# TODO REVIEW: get fitting summary - what's the purpose of this test? Comment from the STI version says: +# +# This is separate from tests.yml because we want to run the tests without +# clang installed. +summary: pocl + +adjust: + - because: "PoCL is shipped with Fedora, not RHEL/CentOS" + when: >- + distro == rhel + or distro == centos + enabled: false + +# This test requires a special preparation, see `/tests/tests-pocl` plan. As such, +# it shouldn't be part of the `/tests/default` plan. +tag: + - not-in-default +# rhbz#1582884 +test: "$WITH_SCL ./test.sh" +require: + - git + - ocl-icd-devel + - pocl + - gcc diff --git a/pocl/test.sh b/pocl/test.sh new file mode 100755 index 0000000..fd9f92b --- /dev/null +++ b/pocl/test.sh @@ -0,0 +1,7 @@ +#!/bin/sh -eux + +# TODO: tmt does not support a remote git repo as a requirement, one has to clone it "manually". + +git clone --depth 1 https://src.fedoraproject.org/rpms/pocl.git pocl +cd pocl/tests/simple-opencl-no-clang +./runtest.sh diff --git a/ppc64le-long-double/main.fmf b/ppc64le-long-double/main.fmf new file mode 100644 index 0000000..70cb665 --- /dev/null +++ b/ppc64le-long-double/main.fmf @@ -0,0 +1,33 @@ +summary: Test that gcc and clang use the same long double format on ppc64le +test: $WITH_SCL ./runtest.sh +duration: 1h +# see https://bugzilla.redhat.com/show_bug.cgi?id=2100546 +enabled: false +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + when: "collection is not defined" + + - because: "Fedora CI runs in x86_64 only, emulate with qemu and mock" + require+: + - qemu-user-static + - mock + test: ./runtest-fedora.sh + when: distro == fedora and arch == x86_64 + continue: false + + - enabled: false + when: arch != ppc64le + + - require+: + - gcc + when: distro != fedora + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" diff --git a/ppc64le-long-double/runtest-fedora.sh b/ppc64le-long-double/runtest-fedora.sh new file mode 100755 index 0000000..25dbb9c --- /dev/null +++ b/ppc64le-long-double/runtest-fedora.sh @@ -0,0 +1,14 @@ +set -e + +fedora_release=`rpm -E %{fedora}` +mock_root=fedora-$fedora_release-ppc64le +triple=ppc64le-redhat-linux + +mock -r $mock_root --isolation=simple --install gcc +gcc_output=$(mock -r $mock_root --isolation=simple -q --shell gcc -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) +clang_output=$(clang -target $triple -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) + +echo "gcc: $gcc_output" +echo "clang: $clang_output" + +test "$gcc_output" = "$clang_output" diff --git a/ppc64le-long-double/runtest.sh b/ppc64le-long-double/runtest.sh new file mode 100755 index 0000000..8061bd7 --- /dev/null +++ b/ppc64le-long-double/runtest.sh @@ -0,0 +1,9 @@ +set -e + +gcc_output=$(gcc -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) +clang_output=$(clang -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) + +echo "gcc: $gcc_output" +echo "clang: $clang_output" + +test "$gcc_output" = "$clang_output" diff --git a/rhbz_1647130/main.fmf b/rhbz_1647130/main.fmf new file mode 100644 index 0000000..bcc8565 --- /dev/null +++ b/rhbz_1647130/main.fmf @@ -0,0 +1,19 @@ +summary: RHBZ1647130 +test: "$WITH_SCL ./runtest.sh" +require: [] +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + - clang-analyzer + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-clang-analyzer + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-clang-analyzer + when: "collection == llvm-toolset-14.0" \ No newline at end of file diff --git a/rhbz_1657544/main.fmf b/rhbz_1657544/main.fmf new file mode 100644 index 0000000..5849a70 --- /dev/null +++ b/rhbz_1657544/main.fmf @@ -0,0 +1,16 @@ +summary: RHBZ1657544 +test: "$WITH_SCL ./runtest.sh" +require: [] +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" diff --git a/rhbz_1657544/runtest.sh b/rhbz_1657544/runtest.sh index 758de0b..58c088f 100755 --- a/rhbz_1657544/runtest.sh +++ b/rhbz_1657544/runtest.sh @@ -1,6 +1,4 @@ -#!/bin/sh -set -e -set -x +#!/bin/sh -eux clang++ from_chars.cpp ./a.out 100 | grep 100 diff --git a/rhbz_1794936/runtest.sh b/rhbz_1794936/runtest.sh deleted file mode 100755 index 33f7072..0000000 --- a/rhbz_1794936/runtest.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -set -e -set -x - -echo 'int main() { return 0; }' | clang -flto -fsanitize=cfi -fvisibility=hidden -xc - - diff --git a/rhbz_482491/main.fmf b/rhbz_482491/main.fmf new file mode 100644 index 0000000..f0929e9 --- /dev/null +++ b/rhbz_482491/main.fmf @@ -0,0 +1,17 @@ +summary: rhbz-482491 +test: "$WITH_SCL ./test.sh" +require: + - libgcc +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" \ No newline at end of file diff --git a/rhbz_482491/test.sh b/rhbz_482491/test.sh new file mode 100755 index 0000000..2360238 --- /dev/null +++ b/rhbz_482491/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh -eux + +find /usr -name 'libgcc_s.so*' && echo "int main(){}" | clang -v -x c - diff --git a/tests-clang.yml b/tests-clang.yml deleted file mode 100644 index 7456128..0000000 --- a/tests-clang.yml +++ /dev/null @@ -1,38 +0,0 @@ -- hosts: localhost - roles: - - role: standard-test-basic - tags: - - classic - required_packages: - # Required for rhbz_1657544 - - clang - # Required for rhbz_1647130 - - clang-analyzer - # FIXME: It would be nice if we could only install dependencies for a - # single test rather than installing dependencies for all tests. This - # will help us catch bugs with implicit package dependencies e.g. - # package A depends on package B but does not have an explicit Requires. - # These are required for the llvm-toolchain test: - - clang - - lld - # required for rhbz_1794936 - - compiler-rt - - libcxx-devel - - glibc-devel - - gcc - # Required for fedora-flags: - - annobin - - redhat-rpm-config - # Required for toolchains: - - glibc-static - - libstdc++-static - - libcxx-static - - libcxxabi-devel - - libcxxabi-static - tests: - - rhbz_1657544 - - rhbz_1647130 - - rhbz_1794936 - - llvm-toolchain - - toolchains - - fedora-flags diff --git a/tests-libomp.yml b/tests-libomp.yml deleted file mode 100644 index 17def2e..0000000 --- a/tests-libomp.yml +++ /dev/null @@ -1,19 +0,0 @@ -- hosts: localhost - pre_tasks: - # We want to make sure libomp is not already present on the system to ensure - # that clang pulls in the correct libomp dependencies when it is installed. - - name: Uninstall libomp - package: - name: "{{ item }}" - state: absent - with_items: - - libomp - - libomp-devel - roles: - - role: standard-test-basic - tags: - - classic - required_packages: - - clang - tests: - - libomp diff --git a/toolchains/main.fmf b/toolchains/main.fmf new file mode 100644 index 0000000..9edf27f --- /dev/null +++ b/toolchains/main.fmf @@ -0,0 +1,55 @@ +# TODO REVIEW: better summary +summary: "" +test: "$WITH_SCL ./runtest.sh" +require: + - glibc-static + - yum-utils + # This require EPEL/CRB to be enabled on RHEL + - libstdc++-static +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + - compiler-rt + - lld + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-compiler-rt + - llvm-toolset-13.0-lld + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-compiler-rt + - llvm-toolset-14.0-lld + when: "collection == llvm-toolset-14.0" + + # lld not supported in s390x or ppc64. If any lld package was added to + # requirements, remove it. + - require-: + - lld + - llvm-toolset-13.0-lld + - llvm-toolset-14.0-lld + when: arch == s390x or arch == ppc64 + + - environment+: + CXXLIBS: "libc++" + require+: + - libcxx-devel + - libcxx-static + when: "distro == fedora" + because: testing against libcxx package in Fedora + + - environment+: + CXXLIBS: "libstdc++" + require+: + - libstdc++ + when: >- + distro == rhel + or distro == centos + because: testing against libstdc++ package in RHEL as libcxx is not shipped with RHEL + +# TODO REVIEW: are these all requirements? test.sh seems to run quite a lot of stuff, looks like we +# need more packages from LLVM family. diff --git a/toolchains/runtest.sh b/toolchains/runtest.sh index c928ae4..65594e6 100755 --- a/toolchains/runtest.sh +++ b/toolchains/runtest.sh @@ -1,7 +1,13 @@ -#!/bin/sh +#!/bin/sh -eux set pipefail +if [ -z "${CXXLIBS:-}" ]; then + echo "CXXLIBS variable is a required input but it's not specified!" + echo "Test metadata should have picked a proper value, depending on distro." + exit 1 +fi + status=0 test_toolchain() { @@ -25,6 +31,9 @@ test_toolchain() { libc++) args="$args -stdlib=$1" ;; + libstdc++) + args="$args -stdlib=$1" + ;; lld) args="$args -fuse-ld=$1" ;; @@ -48,13 +57,14 @@ test_toolchain() { } clang --version -dnf info installed clang | grep ^Source +# Repoquery is needed instead yum info for compatibility with RHEL-7 +repoquery -i --installed $(rpm -qf $(which clang)) | grep ^Source echo "" for compiler in clang clang++; do for rtlib in "" compiler-rt; do for linker in "" lld; do - for cxxlib in "" libc++; do + for cxxlib in "" $CXXLIBS; do if [ "$compiler" = "clang" -a -n "$cxxlib" ]; then continue fi @@ -70,6 +80,18 @@ for compiler in clang clang++; do args="$args -pthread" fi + # lld is not supported in s390x and ppc64 + if [[ "$(uname -m)" = "s390x" || "$(uname -m)" = "ppc64" ]] \ + && [[ "$linker" = "lld" ]]; + then + continue + fi + + # compiler-rt does not provide builtins for s390x + if [[ "$(uname -m)" = "s390x" && "$rtlib" = "compiler-rt" ]]; then + continue + fi + test_toolchain $compiler $rtlib $linker $cxxlib $args done done diff --git a/use-dwarf4-by-default/main.fmf b/use-dwarf4-by-default/main.fmf new file mode 100644 index 0000000..3151d7e --- /dev/null +++ b/use-dwarf4-by-default/main.fmf @@ -0,0 +1,20 @@ +summary: Test that clang uses DWARFv4 by default +test: "$WITH_SCL ./test.sh" +require: + - libgcc +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + - llvm + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-llvm + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-llvm + when: "collection == llvm-toolset-14.0" diff --git a/use-dwarf4-by-default/test.sh b/use-dwarf4-by-default/test.sh new file mode 100755 index 0000000..5da8196 --- /dev/null +++ b/use-dwarf4-by-default/test.sh @@ -0,0 +1,7 @@ +#!/bin/sh -eux + +echo "int main(){ return 0; }" | clang -g -v -x c - 2> build.log +# Make sure that clang is using the expected flag to use DWARF 4 +grep -q "\-dwarf-version=4" build.log +# Inspect the binary to double check expected DWARF version +llvm-dwarfdump a.out | grep -i version | grep 0x0004