Run fedora-flags test on all architectures
This commit is contained in:
parent
545fd2466b
commit
bd66e3d65a
@ -1,20 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -ex pipefail
|
set -x
|
||||||
|
|
||||||
cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`
|
status=0
|
||||||
cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`
|
|
||||||
ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`
|
|
||||||
|
|
||||||
|
# arhmfp not tested due to rhbz#1918924.
|
||||||
|
arches="s390x ppc64le x86_64 i386 aarch64"
|
||||||
|
|
||||||
# Test a c program
|
for arch in $arches; do
|
||||||
clang $cflags -c hello.c -o hello.o
|
root="fedora-rawhide-$arch"
|
||||||
clang $cflags -c main.c -o main.o
|
mock -r $root --install clang
|
||||||
clang $ldflags -o hello main.o hello.o
|
mock -r $root --copyin main.c main.cpp hello.c hello.cpp test-clang.sh .
|
||||||
./hello | grep "Hello World"
|
if mock -r $root --shell bash test-clang.sh; then
|
||||||
|
echo "$arch: PASS"
|
||||||
|
else
|
||||||
|
echo "$arch: FAIL"
|
||||||
|
status=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Test a cxx program
|
exit $status
|
||||||
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"
|
|
||||||
|
30
tests/fedora-flags/test-clang.sh
Normal file
30
tests/fedora-flags/test-clang.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex pipefail
|
||||||
|
|
||||||
|
function check_flags {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "FAIL: failed to get rpm flags"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`
|
||||||
|
cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`
|
||||||
|
ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`
|
||||||
|
|
||||||
|
check_flags "$cflags"
|
||||||
|
check_flags "$cxxflags"
|
||||||
|
check_flags "$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"
|
@ -22,6 +22,8 @@
|
|||||||
- glibc-static
|
- glibc-static
|
||||||
- gcc
|
- gcc
|
||||||
# Required for fedora-flags:
|
# Required for fedora-flags:
|
||||||
|
- mock
|
||||||
|
- qemu-user-static
|
||||||
- annobin
|
- annobin
|
||||||
- redhat-rpm-config
|
- redhat-rpm-config
|
||||||
# Required for clang-format-diff
|
# Required for clang-format-diff
|
||||||
|
Loading…
Reference in New Issue
Block a user