llvm-test fixes

Try to simply lit config file generation by adding standalone fedora specific
config file.  In the future, when we need to customize the lit config
for the llvm-test package, we can just update lit.fedora.cfg.py rather
than trying to patch the default config from the spec file.

This patch also makes the run-lit-tests script identical on all arches,
so it will no longer cause multi-lib conflicts.
This commit is contained in:
Tom Stellard 2019-03-26 13:06:13 +00:00
parent f059677e37
commit dd29ab70a3
3 changed files with 77 additions and 24 deletions

17
lit.fedora.cfg.py Normal file
View file

@ -0,0 +1,17 @@
config.llvm_tools_dir = '/usr/bin'
config.llvm_shlib_dir = '%(llvm_shlib_dir)s' % lit_config.params
if hasattr(config, 'host_triple'):
# This means we are running lit regression tests
# Regression tests write output to this directory, so we need to be able to specify
# a temp directory when invoking lit. e.g. lit -Dllvm_obj_root=/tmp/lit
config.llvm_obj_root = "%(llvm_obj_root)s" % lit_config.params
lit_config.load_config(config, '%(llvm_test_root)s/lit.cfg.py' % lit_config.params)
else:
# This means we are running lit unit tests
# For unit tests, llvm_obj_root is used to find the unit test binaries.
config.llvm_obj_root = '%(llvm_unittest_bindir)s' % lit_config.params
lit_config.load_config(config, '%(llvm_test_root)s/Unit/lit.cfg.py' % lit_config.params)

View file

@ -40,13 +40,14 @@
Name: %{pkg_name} Name: %{pkg_name}
Version: %{maj_ver}.%{min_ver}.%{patch_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 1%{?rc_ver:.rc%{rc_ver}}%{?dist} Release: 2%{?rc_ver:.rc%{rc_ver}}%{?dist}
Summary: The Low Level Virtual Machine Summary: The Low Level Virtual Machine
License: NCSA License: NCSA
URL: http://llvm.org URL: http://llvm.org
Source0: http://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src.tar.xz Source0: http://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src.tar.xz
Source1: run-lit-tests Source1: run-lit-tests
Source2: lit.fedora.cfg.py
Patch5: 0001-PATCH-llvm-config.patch Patch5: 0001-PATCH-llvm-config.patch
Patch7: 0001-PATCH-Filter-out-cxxflags-not-supported-by-clang.patch Patch7: 0001-PATCH-Filter-out-cxxflags-not-supported-by-clang.patch
@ -148,8 +149,6 @@ pathfix.py -i %{__python3} -pn \
test/BugPoint/compile-custom.ll.py \ test/BugPoint/compile-custom.ll.py \
tools/opt-viewer/*.py tools/opt-viewer/*.py
sed -i 's~@TOOLS_DIR@~%{_bindir}~' %{SOURCE1}
%build %build
mkdir -p _build mkdir -p _build
cd _build cd _build
@ -258,25 +257,27 @@ done
install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{_libdir} install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{_libdir}
%global install_srcdir %{buildroot}%{_datadir}/llvm/src %global install_srcdir %{buildroot}%{_datadir}/llvm/src
%global lit_cfg test/lit.site.cfg.py %global lit_cfg test/%{_arch}.site.cfg.py
%global lit_unit_cfg test/Unit/lit.site.cfg.py %global lit_unit_cfg test/Unit/%{_arch}.site.cfg.py
%global lit_fedora_cfg %{_datadir}/llvm/lit.fedora.cfg.py
# Install gtest sources so clang can use them for gtest # Install gtest sources so clang can use them for gtest
install -d %{install_srcdir} install -d %{install_srcdir}
install -d %{install_srcdir}/utils/ install -d %{install_srcdir}/utils/
cp -R utils/unittest %{install_srcdir}/utils/ cp -R utils/unittest %{install_srcdir}/utils/
# Generate lit config files. # Generate lit config files. Strip off the last line that initiates the
cat _build/test/lit.site.cfg.py >> %{lit_cfg} # test run, so we can customize the configuration.
head -n -1 _build/test/lit.site.cfg.py >> %{lit_cfg}
head -n -1 _build/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg}
# Unit tests write output to this directory, so it can't be in /usr. # Install custom fedora config file
sed -i 's~\(config.llvm_obj_root = \)"[^"]\+"~\1"."~' %{lit_cfg} cp %{SOURCE2} %{buildroot}%{lit_fedora_cfg}
cat _build/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg} # Patch lit config files to load custom fedora config:
sed -i -e s~`pwd`/_build~%{_prefix}~g -e s~`pwd`~.~g %{lit_cfg} %{lit_cfg} %{lit_unit_cfg} for f in %{lit_cfg} %{lit_unit_cfg}; do
echo "lit_config.load_config(config, '%{lit_fedora_cfg}')" >> $f
# obj_root needs to be set to the directory containing the unit test binaries. done
sed -i 's~\(config.llvm_obj_root = \)"[^"]\+"~\1"%{_bindir}"~' %{lit_unit_cfg}
install -d %{buildroot}%{_libexecdir}/tests/llvm install -d %{buildroot}%{_libexecdir}/tests/llvm
install -m 0755 %{SOURCE1} %{buildroot}%{_libexecdir}/tests/llvm install -m 0755 %{SOURCE1} %{buildroot}%{_libexecdir}/tests/llvm
@ -291,6 +292,15 @@ mkdir -p %{build_llvm_libdir}
cp -R _build/unittests %{build_llvm_libdir}/ cp -R _build/unittests %{build_llvm_libdir}/
rm -rf `find %{build_llvm_libdir} -iname 'cmake*'` rm -rf `find %{build_llvm_libdir} -iname 'cmake*'`
# Install libraries used for testing
install -m 0755 %{build_libdir}/BugpointPasses.so %{buildroot}%{_libdir}
install -m 0755 %{build_libdir}/LLVMHello.so %{buildroot}%{_libdir}
# Install test inputs for PDB tests
echo "%{_datadir}/llvm/src/unittests/DebugInfo/PDB" > %{build_llvm_libdir}/unittests/DebugInfo/PDB/llvm.srcdir.txt
mkdir -p %{buildroot}%{_datadir}/llvm/src/unittests/DebugInfo/PDB/
cp -R unittests/DebugInfo/PDB/Inputs %{buildroot}%{_datadir}/llvm/src/unittests/DebugInfo/PDB/
%else %else
# Add version suffix to binaries # Add version suffix to binaries
@ -422,13 +432,17 @@ fi
%files test %files test
%{_libexecdir}/tests/llvm/ %{_libexecdir}/tests/llvm/
%{llvm_libdir}/unittests/ %{llvm_libdir}/unittests/
%{_datadir}/llvm/src/unittests
%{_datadir}/llvm/src/test.tar.gz %{_datadir}/llvm/src/test.tar.gz
%{_datadir}/llvm/lit.fedora.cfg.py
%{_bindir}/not %{_bindir}/not
%{_bindir}/count %{_bindir}/count
%{_bindir}/yaml-bench %{_bindir}/yaml-bench
%{_bindir}/lli-child-target %{_bindir}/lli-child-target
%{_bindir}/llvm-isel-fuzzer %{_bindir}/llvm-isel-fuzzer
%{_bindir}/llvm-opt-fuzzer %{_bindir}/llvm-opt-fuzzer
%{_libdir}/BugpointPasses.so
%{_libdir}/LLVMHello.so
%files googletest %files googletest
%{_datadir}/llvm/src/utils %{_datadir}/llvm/src/utils
@ -437,6 +451,9 @@ fi
%endif %endif
%changelog %changelog
* Fri Mar 22 2019 Tom Stellard <tstellar@redhat.com> - 8.0.0-2
- llvm-test fixes
* Wed Mar 20 2019 sguelton@redhat.com - 8.0.0-1 * Wed Mar 20 2019 sguelton@redhat.com - 8.0.0-1
- 8.0.0 final - 8.0.0 final

View file

@ -2,7 +2,9 @@
usage() { usage() {
echo "usage: `basename $0` [OPTIONS]" echo "usage: `basename $0` [OPTIONS]"
echo " --threads NUM The number of threads to use for running tests." echo " --threads NUM The number of threads to use for running tests."
echo " --multilib-arch ARCH Use this option to test 32-bit libs/binaries on"
echo " 64-bit hosts."
} }
threads_arg='' threads_arg=''
@ -13,6 +15,10 @@ while [ $# -gt 0 ]; do
shift shift
threads_arg="--threads $1" threads_arg="--threads $1"
;; ;;
--multilib-arch)
shift
ARCH=$1
;;
* ) * )
echo "unknown option: $1" echo "unknown option: $1"
echo "" echo ""
@ -25,15 +31,28 @@ done
set -xe set -xe
TOOLS_DIR=@TOOLS_DIR@ if [ -z "$ARCH" ]; then
ARCH=`rpm --eval '%_arch'`
fi
case $ARCH in
arm)
;&
i686)
LIB_DIR="/usr/lib/"
;;
*)
LIB_DIR="/usr/lib64/"
;;
esac
cd $(mktemp -d) cd $(mktemp -d)
ln -s /usr/include include ln -s /usr/include include
tar -xzf /usr/share/llvm/src/test.tar.gz tar -xzf /usr/share/llvm/src/test.tar.gz
PATH=$PATH:$TOOLS_DIR lit -v -s $threads_arg test \ ln -s $ARCH.site.cfg.py test/lit.site.cfg.py
-DFileCheck=$TOOLS_DIR/FileCheck \ ln -s $ARCH.site.cfg.py test/Unit/lit.site.cfg.py
-Dcount=$TOOLS_DIR/count \ lit -v -s $threads_arg test \
-Dnot=$TOOLS_DIR/not \ -Dllvm_obj_root=`pwd` \
-Dlli-child-target=$TOOLS_DIR/lli-child-target \ -Dllvm_test_root=`pwd`/test \
-Dllvm-isel-fuzzer=$TOOLS_DIR/llvm-isel-fuzzer \ -Dllvm_unittest_bindir=$LIB_DIR/llvm \
-Dllvm-opt-fuzzer=$TOOLS_DIR/llvm-opt-fuzzer \ -Dllvm_shlib_dir=$LIB_DIR
-Dyaml-bench=$TOOLS_DIR/yaml-bench