tests: Re-use Fedora tests
Related: rhbz#2061056
This commit is contained in:
parent
94e3ce033b
commit
b04fb0b5e9
@ -7,21 +7,14 @@ adjust:
|
||||
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
|
||||
url: https://src.fedoraproject.org/rpms/clang.git
|
||||
ref: rawhide
|
||||
test: libomp
|
||||
execute:
|
||||
how: tmt
|
||||
|
@ -1,32 +0,0 @@
|
||||
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"
|
@ -1,13 +1,12 @@
|
||||
#
|
||||
# Build/PR gating tests for *LLVM 13*
|
||||
#
|
||||
# Compatible with various LLVM 13 distributions:
|
||||
# Imports and runs tests provided by Fedora LLVM git for the matching LLVM version.
|
||||
#
|
||||
# * Fedora (ursine packages)
|
||||
# * Centos 9 stream (ursine packages)
|
||||
# * RHEL-9 (ursine packages)
|
||||
# * RHEL-8 (Red Hat module)
|
||||
# * RHEL-7 (software collection)
|
||||
# NOTE: *always* keep this file in sync with upstream, i.e. Fedora. Since we cannot "discover" a plan,
|
||||
# we must duplicate at least some part of upstream plan setup, like `adjust` or `provision`. Not necessarily
|
||||
# all steps, btu if we do need some of them here, let's focus on making changes in upstream first, to preserve
|
||||
# one source of truth. Once TMT learns to include whole plans, we could drop the copied content from here.
|
||||
#
|
||||
|
||||
summary: Clang tests for build/PR gating
|
||||
@ -19,15 +18,6 @@ adjust:
|
||||
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+:
|
||||
@ -50,6 +40,8 @@ adjust:
|
||||
discover:
|
||||
- name: clang-tests
|
||||
how: fmf
|
||||
url: https://src.fedoraproject.org/rpms/clang.git
|
||||
ref: rawhide
|
||||
filter: "tag:-not-in-default"
|
||||
- name: upstream-llvm-integration-testsuite
|
||||
how: fmf
|
||||
|
@ -1,15 +0,0 @@
|
||||
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"
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh -eux
|
||||
|
||||
# Check that clang-format-diff is in PATH.
|
||||
# rhbz#1939018
|
||||
clang-format-diff -h
|
@ -1,5 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void hello() {
|
||||
printf("Hello World\n");
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
void hello() {
|
||||
std::cout << "Hello World\n";
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
void hello();
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
hello();
|
||||
return 0;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
void hello();
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
hello();
|
||||
return 0;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
summary: fedora-flags
|
||||
test: "$WITH_SCL ./test.sh"
|
||||
require:
|
||||
- annobin
|
||||
- clang
|
||||
- redhat-rpm-config
|
||||
adjust:
|
||||
- because: s390x does not have epel repo which is required to provide rpm macros
|
||||
enabled: false
|
||||
when: >-
|
||||
distro == rhel-7
|
||||
and arch == s390x
|
||||
|
||||
- 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
|
@ -1,20 +0,0 @@
|
||||
#!/bin/sh -eux
|
||||
|
||||
set pipefail
|
||||
|
||||
cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`
|
||||
cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`
|
||||
ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`
|
||||
|
||||
|
||||
# Test a c program
|
||||
clang $cflags -c hello.c -o hello.o
|
||||
clang $cflags -c main.c -o main.o
|
||||
clang $ldflags -o hello main.o hello.o
|
||||
./hello | grep "Hello World"
|
||||
|
||||
# Test a cxx program
|
||||
clang++ $cxxflags -c hello.cpp -o hello-cpp.o
|
||||
clang++ $cxxflags -c main.cpp -o main-cpp.o
|
||||
clang++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o
|
||||
./hello-cpp | grep "Hello World"
|
@ -1,36 +0,0 @@
|
||||
# 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 ./test.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"
|
@ -1,8 +0,0 @@
|
||||
#include <omp.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int nthreads = omp_get_num_threads();
|
||||
printf("Num Threads: %d\n", nthreads);
|
||||
return 0;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -exo pipefail
|
||||
|
||||
clang -fopenmp openmp-compile-link-test.c
|
||||
|
||||
./a.out | grep "Num Threads: 1"
|
@ -1,18 +0,0 @@
|
||||
# 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
|
@ -1,7 +0,0 @@
|
||||
#!/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
|
@ -1,30 +0,0 @@
|
||||
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"
|
@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
${BUILDDEP_CMD} -y test.spec
|
||||
rpmbuild --define '_sourcedir .' --define '_builddir .' -bb test.spec
|
@ -1,7 +0,0 @@
|
||||
int main(int argc, char **argv) {
|
||||
int res = 1;
|
||||
#pragma omp parallel
|
||||
#pragma omp single
|
||||
res = 0;
|
||||
return res;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
%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
|
@ -1,24 +0,0 @@
|
||||
# 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
|
@ -1,7 +0,0 @@
|
||||
#!/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
|
@ -1,31 +0,0 @@
|
||||
summary: Test that gcc and clang use the same long double format on ppc64le
|
||||
test: $WITH_SCL ./runtest.sh
|
||||
duration: 1h
|
||||
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"
|
@ -1,14 +0,0 @@
|
||||
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"
|
@ -1,9 +0,0 @@
|
||||
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"
|
@ -1,19 +0,0 @@
|
||||
summary: RHBZ1647130
|
||||
test: "$WITH_SCL ./test.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"
|
@ -1,8 +0,0 @@
|
||||
#!/bin/sh -eux
|
||||
|
||||
tmp_cpp=`mktemp -t XXXXX.cpp`
|
||||
tmp_dir=`mktemp -d`
|
||||
echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > $tmp_cpp
|
||||
scan-build -o $tmp_dir clang++ -c $tmp_cpp -o /dev/null
|
||||
(scan-view --no-browser $tmp_dir/* & WPID=$! && sleep 10s && kill $WPID)
|
||||
|
@ -1,15 +0,0 @@
|
||||
#include <charconv>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
size_t r=0;
|
||||
const char *begin = argv[1];
|
||||
const char *end = begin + strlen(begin);
|
||||
from_chars(begin, end, r);
|
||||
cout << r << '\n';
|
||||
return 0;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
summary: RHBZ1657544
|
||||
test: "$WITH_SCL ./test.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"
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh -eux
|
||||
|
||||
clang++ from_chars.cpp
|
||||
./a.out 100 | grep 100
|
@ -1,17 +0,0 @@
|
||||
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"
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh -eux
|
||||
|
||||
find /usr -name 'libgcc_s.so*' && echo "int main(){}" | clang -v -x c -
|
@ -1,5 +0,0 @@
|
||||
#include<stdio.h>
|
||||
int main(int argc, char **argv) {
|
||||
printf("Hello World\n");
|
||||
return 0;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#include <iostream>
|
||||
int main(int argc, char **argv) {
|
||||
std::cout << "Hello World\n";
|
||||
return 0;
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
# TODO REVIEW: better summary
|
||||
summary: ""
|
||||
test: "$WITH_SCL ./test.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.
|
@ -1,102 +0,0 @@
|
||||
#!/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() {
|
||||
|
||||
toolchain=$@
|
||||
args=""
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
clang)
|
||||
compiler=$1
|
||||
src=hello.c
|
||||
;;
|
||||
clang++)
|
||||
compiler=$1
|
||||
src=hello.cpp
|
||||
;;
|
||||
compiler-rt)
|
||||
args="$args -rtlib=$1"
|
||||
;;
|
||||
libc++)
|
||||
args="$args -stdlib=$1"
|
||||
;;
|
||||
libstdc++)
|
||||
args="$args -stdlib=$1"
|
||||
;;
|
||||
lld)
|
||||
args="$args -fuse-ld=$1"
|
||||
;;
|
||||
*)
|
||||
args="$args $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cmd="$compiler $args $src"
|
||||
rm -f a.out
|
||||
echo "* $toolchain"
|
||||
echo " command: $cmd"
|
||||
if $cmd && ./a.out | grep -q 'Hello World'; then
|
||||
echo " PASS"
|
||||
else
|
||||
echo " FAIL"
|
||||
status=1
|
||||
fi
|
||||
}
|
||||
|
||||
clang --version
|
||||
# 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 "" $CXXLIBS; do
|
||||
if [ "$compiler" = "clang" -a -n "$cxxlib" ]; then
|
||||
continue
|
||||
fi
|
||||
for args in "" -static; do
|
||||
# Skip known failures
|
||||
# TODO: Fix these
|
||||
if [[ "$args" = "-static" && "$rtlib" = "compiler-rt" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Static libc++ needs -pthread
|
||||
if [[ "$args" = "-static" && "$cxxlib" = "libc++" ]]; then
|
||||
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
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
exit $status
|
@ -1,20 +0,0 @@
|
||||
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"
|
@ -1,7 +0,0 @@
|
||||
#!/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
|
Loading…
Reference in New Issue
Block a user