Add lld-test sub-package
This commit is contained in:
parent
8f684e0ba8
commit
974761449c
12
lit.lld-test.cfg.py
Normal file
12
lit.lld-test.cfg.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#Clear lld_tools_dir so we don't accidently pick up tools from somewhere else
|
||||||
|
config.lld_tools_dir = ""
|
||||||
|
|
||||||
|
if hasattr(config, 'have_zlib'):
|
||||||
|
# Regression tests write output to this directory, so we need to be able to specify
|
||||||
|
# a temp directory when invoking lit. e.g. lit -Dlld_obj_root=/tmp/lit
|
||||||
|
config.lld_obj_root = "%(lld_obj_root)s" % lit_config.params
|
||||||
|
lit_config.load_config(config, '%(lld_test_root)s/lit.cfg.py' % lit_config.params)
|
||||||
|
else:
|
||||||
|
# For unit tests, llvm_obj_root is used to find the unit test binaries.
|
||||||
|
config.lld_obj_root = '%(lld_unittest_bindir)s' % lit_config.params
|
||||||
|
lit_config.load_config(config, '%(lld_test_root)s/Unit/lit.cfg.py' % lit_config.params)
|
63
lld.spec
63
lld.spec
@ -1,15 +1,22 @@
|
|||||||
#%%global rc_ver 3
|
#%%global rc_ver 3
|
||||||
%global baserelease 2
|
%global baserelease 3
|
||||||
%global lld_srcdir lld-%{version}%{?rc_ver:rc%{rc_ver}}.src
|
%global lld_srcdir lld-%{version}%{?rc_ver:rc%{rc_ver}}.src
|
||||||
|
%global maj_ver 9
|
||||||
|
|
||||||
|
# Don't include unittests in automatic generation of provides or requires.
|
||||||
|
%global __provides_exclude_from ^%{_libdir}/lld/.*$
|
||||||
|
%global __requires_exclude ^libgtest.*$
|
||||||
|
|
||||||
Name: lld
|
Name: lld
|
||||||
Version: 9.0.0
|
Version: %{maj_ver}.0.0
|
||||||
Release: %{baserelease}%{?rc_ver:.rc%{rc_ver}}%{?dist}
|
Release: %{baserelease}%{?rc_ver:.rc%{rc_ver}}%{?dist}
|
||||||
Summary: The LLVM Linker
|
Summary: The LLVM Linker
|
||||||
|
|
||||||
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}}/%{lld_srcdir}.tar.xz
|
Source0: http://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/%{lld_srcdir}.tar.xz
|
||||||
|
Source1: run-lit-tests
|
||||||
|
Source2: lit.lld-test.cfg.py
|
||||||
|
|
||||||
Patch0: 0001-CMake-Check-for-gtest-headers-even-if-lit.py-is-not-.patch
|
Patch0: 0001-CMake-Check-for-gtest-headers-even-if-lit.py-is-not-.patch
|
||||||
|
|
||||||
@ -49,6 +56,15 @@ Summary: LLD shared libraries
|
|||||||
%description libs
|
%description libs
|
||||||
Shared libraries for LLD.
|
Shared libraries for LLD.
|
||||||
|
|
||||||
|
%package test
|
||||||
|
Summary: LLD regression tests
|
||||||
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||||
|
Requires: python3-lit
|
||||||
|
Requires: llvm-test(major) = %{maj_ver}
|
||||||
|
|
||||||
|
%description test
|
||||||
|
LLVM regression tests.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{name}-%{version}%{?rc_ver:rc%{rc_ver}}.src -p1
|
%autosetup -n %{name}-%{version}%{?rc_ver:rc%{rc_ver}}.src -p1
|
||||||
|
|
||||||
@ -74,7 +90,41 @@ cd %{_target_platform}
|
|||||||
|
|
||||||
%make_build
|
%make_build
|
||||||
|
|
||||||
|
# Build the unittests so we can install them.
|
||||||
|
%make_build lld-test-depends
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
|
||||||
|
%global lit_cfg test/%{_arch}.site.cfg.py
|
||||||
|
%global lit_unit_cfg test/Unit/%{_arch}.site.cfg.py
|
||||||
|
%global lit_lld_test_cfg_install_path %{_datadir}/lld/lit.lld-test.cfg.py
|
||||||
|
|
||||||
|
# Generate lit config files. Strip off the last line that initiates the
|
||||||
|
# test run, so we can customize the configuration.
|
||||||
|
head -n -1 %{_target_platform}/test/lit.site.cfg.py >> %{lit_cfg}
|
||||||
|
head -n -1 %{_target_platform}/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg}
|
||||||
|
|
||||||
|
# Patch lit config files to load custom config:
|
||||||
|
for f in %{lit_cfg} %{lit_unit_cfg}; do
|
||||||
|
echo "lit_config.load_config(config, '%{lit_lld_test_cfg_install_path}')" >> $f
|
||||||
|
done
|
||||||
|
|
||||||
|
# Install test files
|
||||||
|
install -d %{buildroot}%{_datadir}/lld/src
|
||||||
|
cp %{SOURCE2} %{buildroot}%{_datadir}/lld/
|
||||||
|
|
||||||
|
tar -czf %{buildroot}%{_datadir}/lld/src/test.tar.gz test/
|
||||||
|
install -d %{buildroot}%{_libexecdir}/tests/lld
|
||||||
|
cp %{SOURCE1} %{buildroot}%{_libexecdir}/tests/lld
|
||||||
|
|
||||||
|
# Install unit test binaries
|
||||||
|
install -d %{buildroot}%{_libdir}/lld/
|
||||||
|
cp -R %{_target_platform}/unittests %{buildroot}%{_libdir}/lld/
|
||||||
|
|
||||||
|
# Install gtest libraries
|
||||||
|
cp %{_target_platform}/%{_lib}/libgtest*so* %{buildroot}%{_libdir}/lld/
|
||||||
|
|
||||||
|
# Install libraries and binaries
|
||||||
cd %{_target_platform}
|
cd %{_target_platform}
|
||||||
%make_install
|
%make_install
|
||||||
|
|
||||||
@ -117,7 +167,16 @@ make -C %{_target_platform} %{?_smp_mflags} check-lld
|
|||||||
%files libs
|
%files libs
|
||||||
%{_libdir}/liblld*.so.*
|
%{_libdir}/liblld*.so.*
|
||||||
|
|
||||||
|
%files test
|
||||||
|
%{_libexecdir}/tests/lld/
|
||||||
|
%{_libdir}/lld/
|
||||||
|
%{_datadir}/lld/src/test.tar.gz
|
||||||
|
%{_datadir}/lld/lit.lld-test.cfg.py
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Dec 05 2019 Tom Stellard <tstellar@redhat.com> - 9.0.0-3
|
||||||
|
- Add lld-test package
|
||||||
|
|
||||||
* Thu Nov 14 2019 Tom Stellard <tstellar@redhat.com> - 9.0.0-2
|
* Thu Nov 14 2019 Tom Stellard <tstellar@redhat.com> - 9.0.0-2
|
||||||
- Add explicit lld-libs requires to fix rpmdiff errors
|
- Add explicit lld-libs requires to fix rpmdiff errors
|
||||||
|
|
||||||
|
66
run-lit-tests
Executable file
66
run-lit-tests
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat << EOF
|
||||||
|
usage: `basename $0` [OPTIONS]
|
||||||
|
--threads NUM The number of threads to use for running tests.
|
||||||
|
--multilib-arch ARCH Use this option to test 32-bit libs/binaries on
|
||||||
|
64-bit hosts.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
threads_arg=''
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case $1 in
|
||||||
|
--threads)
|
||||||
|
shift
|
||||||
|
threads_arg="--threads $1"
|
||||||
|
;;
|
||||||
|
--multilib-arch)
|
||||||
|
shift
|
||||||
|
ARCH=$1
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
echo "unknown option: $1"
|
||||||
|
echo ""
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ `whoami` = "root" ]; then
|
||||||
|
echo "error: lld tests do not support running as root."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -xe
|
||||||
|
|
||||||
|
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/lld/src/test.tar.gz
|
||||||
|
ln -s $ARCH.site.cfg.py test/lit.site.cfg.py
|
||||||
|
ln -s $ARCH.site.cfg.py test/Unit/lit.site.cfg.py
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH=$LIB_DIR/lld:$LD_LIBRARY_PATH \
|
||||||
|
lit -v -s $threads_arg test \
|
||||||
|
-Dlld_obj_root=`pwd` \
|
||||||
|
-Dlld_test_root=`pwd`/test \
|
||||||
|
-Dlld_unittest_bindir=$LIB_DIR/lld
|
6
tests/lit-tests/runtest.sh
Normal file
6
tests/lit-tests/runtest.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
if ! `id -u lld`; then
|
||||||
|
useradd lld
|
||||||
|
fi
|
||||||
|
|
||||||
|
su lld -c /usr/libexec/tests/lld/run-lit-tests
|
@ -7,6 +7,7 @@
|
|||||||
- lld
|
- lld
|
||||||
- clang
|
- clang
|
||||||
- gcc
|
- gcc
|
||||||
|
- lld-test
|
||||||
tests:
|
tests:
|
||||||
- basic:
|
- basic:
|
||||||
dir: ./
|
dir: ./
|
||||||
@ -14,3 +15,4 @@
|
|||||||
- gcc-compat-basic:
|
- gcc-compat-basic:
|
||||||
dir: ./
|
dir: ./
|
||||||
run: echo "int main(){ return 0; }" | gcc -x c -fuse-ld=lld -
|
run: echo "int main(){ return 0; }" | gcc -x c -fuse-ld=lld -
|
||||||
|
- lit-tests
|
||||||
|
Loading…
Reference in New Issue
Block a user