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,7 +1,10 @@
|
|||||||
# TODO REVIEW: better summary
|
# TODO REVIEW: better summary
|
||||||
summary: ""
|
summary: ""
|
||||||
test: ./test.sh
|
test: ./test.sh
|
||||||
require:
|
adjust:
|
||||||
|
- environment+:
|
||||||
|
CXXLIB: "libc++"
|
||||||
|
require:
|
||||||
- clang
|
- clang
|
||||||
- lld
|
- lld
|
||||||
- compiler-rt
|
- compiler-rt
|
||||||
@ -10,3 +13,18 @@ require:
|
|||||||
- glibc-devel
|
- glibc-devel
|
||||||
- glibc-static
|
- glibc-static
|
||||||
- gcc
|
- 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
|
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.
|
# Test compile a C program.
|
||||||
cat << EOF | \
|
cat << EOF | \
|
||||||
clang -fuse-ld=lld -rtlib=compiler-rt -x c - && \
|
clang -fuse-ld=lld -rtlib=compiler-rt -x c - && \
|
||||||
@ -18,7 +24,7 @@ EOF
|
|||||||
|
|
||||||
# Test compile a C++ program.
|
# Test compile a C++ program.
|
||||||
cat << EOF | \
|
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'
|
./a.out | grep 'Hello World'
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -1,7 +1,21 @@
|
|||||||
# TODO REVIEW: better summary
|
# TODO REVIEW: better summary
|
||||||
summary: ""
|
summary: ""
|
||||||
test: ./test.sh
|
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
|
# 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.
|
# need more packages from LLVM family.
|
||||||
require:
|
require: []
|
||||||
- clang
|
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
set pipefail
|
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
|
status=0
|
||||||
|
|
||||||
test_toolchain() {
|
test_toolchain() {
|
||||||
@ -25,6 +31,9 @@ test_toolchain() {
|
|||||||
libc++)
|
libc++)
|
||||||
args="$args -stdlib=$1"
|
args="$args -stdlib=$1"
|
||||||
;;
|
;;
|
||||||
|
libstdc++)
|
||||||
|
args="$args -stdlib=$1"
|
||||||
|
;;
|
||||||
lld)
|
lld)
|
||||||
args="$args -fuse-ld=$1"
|
args="$args -fuse-ld=$1"
|
||||||
;;
|
;;
|
||||||
@ -54,7 +63,7 @@ echo ""
|
|||||||
for compiler in clang clang++; do
|
for compiler in clang clang++; do
|
||||||
for rtlib in "" compiler-rt; do
|
for rtlib in "" compiler-rt; do
|
||||||
for linker in "" lld; do
|
for linker in "" lld; do
|
||||||
for cxxlib in "" libc++; do
|
for cxxlib in "" $CXXLIBS; do
|
||||||
if [ "$compiler" = "clang" -a -n "$cxxlib" ]; then
|
if [ "$compiler" = "clang" -a -n "$cxxlib" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user