tests: parametrize "libc++" in tests
Downstream has no `libc++`, but it can run clang tests with `libstdc++`. Parametrize the tests, leaving the actual library to use on their respective `main.fmf` files that are easier to overturn in downstream repos.
This commit is contained in:
parent
90e30031a9
commit
5f6796def1
@ -1,12 +1,30 @@
|
||||
# TODO REVIEW: better summary
|
||||
summary: ""
|
||||
test: ./test.sh
|
||||
require:
|
||||
- clang
|
||||
- lld
|
||||
- compiler-rt
|
||||
- libcxx-devel
|
||||
- libcxx-static
|
||||
- glibc-devel
|
||||
- glibc-static
|
||||
- gcc
|
||||
adjust:
|
||||
- environment+:
|
||||
CXXLIB: "libc++"
|
||||
require:
|
||||
- clang
|
||||
- lld
|
||||
- compiler-rt
|
||||
- libcxx-devel
|
||||
- libcxx-static
|
||||
- glibc-devel
|
||||
- glibc-static
|
||||
- gcc
|
||||
when: "distro == fedora"
|
||||
because: testing against libcxx package in Fedora
|
||||
- environment+:
|
||||
CXXLIB: "libstdc++"
|
||||
require:
|
||||
- clang
|
||||
- lld
|
||||
- compiler-rt
|
||||
- glibc-devel
|
||||
- glibc-static
|
||||
- gcc
|
||||
- libstdc++
|
||||
when: "distro == rhel"
|
||||
because: testing against libstdc++ package in RHEL as libcxx is not shipped with RHEL
|
||||
require: []
|
||||
|
@ -4,6 +4,12 @@
|
||||
|
||||
set pipefail
|
||||
|
||||
if [ -z "${CXXLIB:-}" ]; then
|
||||
echo "CXXLIB 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
|
||||
|
||||
# Test compile a C program.
|
||||
cat << EOF | \
|
||||
clang -fuse-ld=lld -rtlib=compiler-rt -x c - && \
|
||||
@ -18,7 +24,7 @@ EOF
|
||||
|
||||
# Test compile a C++ program.
|
||||
cat << EOF | \
|
||||
clang++ -x c++ -fuse-ld=lld -rtlib=compiler-rt -stdlib=libc++ - && \
|
||||
clang++ -x c++ -fuse-ld=lld -rtlib=compiler-rt -stdlib="$CXXLIB" - && \
|
||||
./a.out | grep 'Hello World'
|
||||
|
||||
#include <iostream>
|
||||
|
@ -1,7 +1,21 @@
|
||||
# TODO REVIEW: better summary
|
||||
summary: ""
|
||||
test: ./test.sh
|
||||
adjust:
|
||||
- environment+:
|
||||
CXXLIBS: "libc++"
|
||||
require:
|
||||
- clang
|
||||
- libcxx-devel
|
||||
when: "distro == fedora"
|
||||
because: testing against libcxx package in Fedora
|
||||
- environment+:
|
||||
CXXLIBS: "libstdc++"
|
||||
require:
|
||||
- clang
|
||||
- libstdc++
|
||||
when: "distro == rhel"
|
||||
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.
|
||||
require:
|
||||
- clang
|
||||
require: []
|
||||
|
@ -2,6 +2,12 @@
|
||||
|
||||
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"
|
||||
;;
|
||||
@ -54,7 +63,7 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user