2021-10-18 14:01:51 +00:00
|
|
|
#!/bin/sh -eux
|
2021-04-14 02:01:54 +00:00
|
|
|
|
|
|
|
set pipefail
|
|
|
|
|
2021-11-11 11:56:36 +00:00
|
|
|
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
|
|
|
|
|
2021-04-14 02:01:54 +00:00
|
|
|
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"
|
|
|
|
;;
|
2021-11-11 11:56:36 +00:00
|
|
|
libstdc++)
|
|
|
|
args="$args -stdlib=$1"
|
|
|
|
;;
|
2021-04-14 02:01:54 +00:00
|
|
|
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
|
|
|
|
dnf info installed clang | grep ^Source
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
for compiler in clang clang++; do
|
|
|
|
for rtlib in "" compiler-rt; do
|
|
|
|
for linker in "" lld; do
|
2021-11-11 11:56:36 +00:00
|
|
|
for cxxlib in "" $CXXLIBS; do
|
2021-04-14 02:01:54 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
test_toolchain $compiler $rtlib $linker $cxxlib $args
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
exit $status
|