mirror of
https://src.fedoraproject.org/rpms/llvm.git
synced 2024-11-28 02:34:52 +00:00
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:
parent
f059677e37
commit
dd29ab70a3
3 changed files with 77 additions and 24 deletions
17
lit.fedora.cfg.py
Normal file
17
lit.fedora.cfg.py
Normal 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)
|
45
llvm.spec
45
llvm.spec
|
@ -40,13 +40,14 @@
|
|||
|
||||
Name: %{pkg_name}
|
||||
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
|
||||
|
||||
License: NCSA
|
||||
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
|
||||
Source1: run-lit-tests
|
||||
Source2: lit.fedora.cfg.py
|
||||
|
||||
Patch5: 0001-PATCH-llvm-config.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 \
|
||||
tools/opt-viewer/*.py
|
||||
|
||||
sed -i 's~@TOOLS_DIR@~%{_bindir}~' %{SOURCE1}
|
||||
|
||||
%build
|
||||
mkdir -p _build
|
||||
cd _build
|
||||
|
@ -258,25 +257,27 @@ done
|
|||
install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{_libdir}
|
||||
|
||||
%global install_srcdir %{buildroot}%{_datadir}/llvm/src
|
||||
%global lit_cfg test/lit.site.cfg.py
|
||||
%global lit_unit_cfg test/Unit/lit.site.cfg.py
|
||||
%global lit_cfg test/%{_arch}.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 -d %{install_srcdir}
|
||||
install -d %{install_srcdir}/utils/
|
||||
cp -R utils/unittest %{install_srcdir}/utils/
|
||||
|
||||
# Generate lit config files.
|
||||
cat _build/test/lit.site.cfg.py >> %{lit_cfg}
|
||||
# Generate lit config files. Strip off the last line that initiates the
|
||||
# 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.
|
||||
sed -i 's~\(config.llvm_obj_root = \)"[^"]\+"~\1"."~' %{lit_cfg}
|
||||
# Install custom fedora config file
|
||||
cp %{SOURCE2} %{buildroot}%{lit_fedora_cfg}
|
||||
|
||||
cat _build/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg}
|
||||
sed -i -e s~`pwd`/_build~%{_prefix}~g -e s~`pwd`~.~g %{lit_cfg} %{lit_cfg} %{lit_unit_cfg}
|
||||
|
||||
# obj_root needs to be set to the directory containing the unit test binaries.
|
||||
sed -i 's~\(config.llvm_obj_root = \)"[^"]\+"~\1"%{_bindir}"~' %{lit_unit_cfg}
|
||||
# Patch lit config files to load custom fedora config:
|
||||
for f in %{lit_cfg} %{lit_unit_cfg}; do
|
||||
echo "lit_config.load_config(config, '%{lit_fedora_cfg}')" >> $f
|
||||
done
|
||||
|
||||
install -d %{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}/
|
||||
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
|
||||
|
||||
# Add version suffix to binaries
|
||||
|
@ -422,13 +432,17 @@ fi
|
|||
%files test
|
||||
%{_libexecdir}/tests/llvm/
|
||||
%{llvm_libdir}/unittests/
|
||||
%{_datadir}/llvm/src/unittests
|
||||
%{_datadir}/llvm/src/test.tar.gz
|
||||
%{_datadir}/llvm/lit.fedora.cfg.py
|
||||
%{_bindir}/not
|
||||
%{_bindir}/count
|
||||
%{_bindir}/yaml-bench
|
||||
%{_bindir}/lli-child-target
|
||||
%{_bindir}/llvm-isel-fuzzer
|
||||
%{_bindir}/llvm-opt-fuzzer
|
||||
%{_libdir}/BugpointPasses.so
|
||||
%{_libdir}/LLVMHello.so
|
||||
|
||||
%files googletest
|
||||
%{_datadir}/llvm/src/utils
|
||||
|
@ -437,6 +451,9 @@ fi
|
|||
%endif
|
||||
|
||||
%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
|
||||
- 8.0.0 final
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
usage() {
|
||||
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=''
|
||||
|
@ -13,6 +15,10 @@ while [ $# -gt 0 ]; do
|
|||
shift
|
||||
threads_arg="--threads $1"
|
||||
;;
|
||||
--multilib-arch)
|
||||
shift
|
||||
ARCH=$1
|
||||
;;
|
||||
* )
|
||||
echo "unknown option: $1"
|
||||
echo ""
|
||||
|
@ -25,15 +31,28 @@ done
|
|||
|
||||
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)
|
||||
ln -s /usr/include include
|
||||
tar -xzf /usr/share/llvm/src/test.tar.gz
|
||||
PATH=$PATH:$TOOLS_DIR lit -v -s $threads_arg test \
|
||||
-DFileCheck=$TOOLS_DIR/FileCheck \
|
||||
-Dcount=$TOOLS_DIR/count \
|
||||
-Dnot=$TOOLS_DIR/not \
|
||||
-Dlli-child-target=$TOOLS_DIR/lli-child-target \
|
||||
-Dllvm-isel-fuzzer=$TOOLS_DIR/llvm-isel-fuzzer \
|
||||
-Dllvm-opt-fuzzer=$TOOLS_DIR/llvm-opt-fuzzer \
|
||||
-Dyaml-bench=$TOOLS_DIR/yaml-bench
|
||||
ln -s $ARCH.site.cfg.py test/lit.site.cfg.py
|
||||
ln -s $ARCH.site.cfg.py test/Unit/lit.site.cfg.py
|
||||
lit -v -s $threads_arg test \
|
||||
-Dllvm_obj_root=`pwd` \
|
||||
-Dllvm_test_root=`pwd`/test \
|
||||
-Dllvm_unittest_bindir=$LIB_DIR/llvm \
|
||||
-Dllvm_shlib_dir=$LIB_DIR
|
||||
|
|
Loading…
Reference in a new issue