llvm-test-suite: Move script to this repository

Move a script from https://src.fedoraproject.org/rpms/llvm-test-suite to
here. With this change, network access and git are not required.
Adds cmake to the list of required package as this was missing before.
This commit is contained in:
Tulio Magno Quites Machado Filho 2025-08-06 16:46:53 -03:00
commit 8309550db6
2 changed files with 117 additions and 6 deletions

View file

@ -13,8 +13,8 @@ adjust+:
when: compat is defined
require+:
- git
- clang
- cmake
- ninja-build
- llvm-test-suite
duration: 1h

View file

@ -1,7 +1,118 @@
#!/bin/sh -eux
#!/bin/bash
# TODO: tmt does not support a remote git repo as a requirement, one has to clone it "manually".
usage() {
echo "usage `basename $0` [OPTIONS]"
echo " --threads NUM The number of threads to use for running tests."
echo " --testsuite-dir DIR Directory containing the test-suite source."
echo " --compiler [gcc|clang] The compiler to test."
}
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
cc="clang"
cxx="clang++"
testsuite_dir="/usr/share/llvm-test-suite/"
thread_args=""
while [ $# -gt 0 ]; do
case $1 in
--threads)
shift
threads="$1"
;;
--testsuite-dir)
shift
testsuire_dir="$1"
;;
--compiler)
shift
compiler="$1"
case $compiler in
clang)
cc="clang"
cxx="clang++"
;;
gcc)
cc="gcc"
cxx="g++"
;;
*)
echo "unknown compiler: $1"
exit 1
;;
esac
;;
* )
echo "unknown option: $1"
echo ""
usage
exit 1
;;
esac
shift
done
if [ -n "$threads" ]; then
thread_args_ninja="-j$threads"
thread_args_lit="j$threads"
fi
set -xe
# This test consumes almost 2GiB. This space may not be available on /tmp on
# all servers. We need to guarantee that physical disk is used in order to
# avoid spurious failures.
tmpdir=$(mktemp -d -p /var/tmp llvm-test-suite.XXXXXXXXXX)
pushd $tmpdir
cmake -G Ninja $testsuite_dir \
-DCMAKE_C_COMPILER=$cc \
-DCMAKE_CXX_COMPILER=$cxx \
-DTEST_SUITE_LIT_FLAGS="-sv$thread_args_lit"
if ! ninja $thread_args_ninja check ; then
# The following code helps with troubleshooting an issue with miniFE.
# Collect more information about the OS and server that reproduced the
# issue.
# https://github.com/fedora-llvm-team/llvm-snapshots/issues/874
mdir=$tmpdir/MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE
if [[ ! -e $mdir/miniFE ]]; then
# If this executable does not exist, assume the test failed due to another
# reason.
exit 1
fi
uname -a
lscpu
ldd $mdir/miniFE
readelf -hSlW $mdir/miniFE
readelf -Ws --demangle \
$mdir/miniFE \
| grep -E 'Symbol table|Ndx Name|cg_solve'
objdump --disassemble=_ZN6miniFE8cg_solveINS_9CSRMatrixIdiiEENS_6VectorIdiiEENS_14matvec_overlapIS2_S4_EEEEvRT_RKT0_RS9_T1_NS7_16LocalOrdinalTypeERNS_10TypeTraitsINS7_10ScalarTypeEE14magnitude_typeERSE_SJ_Pd \
$mdir/miniFE
objdump --disassemble=_ZN6miniFE8cg_solveINS_9CSRMatrixIdiiEENS_6VectorIdiiEENS_10matvec_stdIS2_S4_EEEEvRT_RKT0_RS9_T1_NS7_16LocalOrdinalTypeERNS_10TypeTraitsINS7_10ScalarTypeEE14magnitude_typeERSE_SJ_Pd \
$mdir/miniFE
$tmpdir/tools/timeit-target --timeout 7200 --limit-core 0 --limit-cpu 7200 \
--limit-file-size 209715200 --limit-rss-size 838860800 \
--append-exitstatus \
--redirect-output $mdir/Output/miniFE.test.out \
--redirect-input /dev/null \
--chdir $mdir \
--summary $mdir/Output/miniFE.test.time \
$mdir/miniFE \
-nx 64 -ny 64 -nz 64
$tmpdir/tools/fpcmp-target \
$mdir/Output/miniFE.test.out \
$mdir/miniFE.reference_output
exit 1
fi
popd
# Remove temporary files in case of success.
rm -rf $tmpdir