Package lit tests and googletest sources

This commit is contained in:
Tom Stellard 2018-03-19 16:26:08 +00:00
parent 1948d64c18
commit a47388f920
3 changed files with 107 additions and 1 deletions

View file

@ -1,3 +1,4 @@
%global debug_package %{nil}
# Components enabled if supported by target architecture: # Components enabled if supported by target architecture:
%ifarch %ix86 x86_64 %ifarch %ix86 x86_64
%bcond_without gold %bcond_without gold
@ -49,12 +50,13 @@
Name: %{pkg_name} Name: %{pkg_name}
Version: %{maj_ver}.%{min_ver}.%{patch_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 0.4.rc%{rc_ver}%{?dist} Release: 0.5.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
Patch3: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch Patch3: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch
Patch7: 0001-Filter-out-cxxflags-not-supported-by-clang.patch Patch7: 0001-Filter-out-cxxflags-not-supported-by-clang.patch
@ -125,6 +127,24 @@ Summary: LLVM static libraries
%description static %description static
Static libraries for the LLVM compiler infrastructure. Static libraries for the LLVM compiler infrastructure.
%if !0%{?compat_build}
%package test
Summary: LLVM regression tests.
%description test
LLVM regression tests.
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python3-lit
%package googletest
Summary: LLVM's modified googletest sources.
%description googletest
LLVM's modified googletest sources.
%endif
%prep %prep
%autosetup -n llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src -p1 %autosetup -n llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src -p1
@ -209,6 +229,44 @@ mv -v %{buildroot}%{_bindir}/llvm-config{,-%{__isa_bits}}
%multilib_fix_c_header --file %{_includedir}/llvm/Config/llvm-config.h %multilib_fix_c_header --file %{_includedir}/llvm/Config/llvm-config.h
# Install binaries needed for lit tests
%global test_binaries lli-child-target llvm-isel-fuzzer llvm-opt-fuzzer yaml-bench
for f in %{test_binaries}; do
install -m 0755 ./bin/$f %{buildroot}%{llvm_bindir}
done
%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
cd ..
# 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}
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"%{llvm_bindir}"~' %{lit_unit_cfg}
install -d %{buildroot}%{_libexecdir}/tests/llvm
install -m 0755 %{SOURCE1} %{buildroot}%{_libexecdir}/tests/llvm
# Install lit tests. We need to put these in a tarball otherwise rpm will complain
# about some of the test inputs having the wrong object file format.
install -d %{buildroot}%{_datadir}/llvm/
tar -czf %{install_srcdir}/test.tar.gz test/
# Install the unit test binaries
cp -R _build/unittests %{buildroot}%{llvm_bindir}/
# FIXME: Can't figure out how to make the find command succeed.
find %{buildroot}%{llvm_bindir} -ignore_readdir_race -iname 'cmake*' -exec rm -Rf '{}' ';' || true
%else %else
# Add version suffix to binaries # Add version suffix to binaries
@ -272,6 +330,7 @@ fi
%exclude %{_bindir}/llvm-config-%{__isa_bits} %exclude %{_bindir}/llvm-config-%{__isa_bits}
%exclude %{_mandir}/man1/llvm-config.1.* %exclude %{_mandir}/man1/llvm-config.1.*
%{_datadir}/opt-viewer %{_datadir}/opt-viewer
%exclude %{llvm_bindir}/unittests
%else %else
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf %config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf
%exclude %{pkg_bindir}/llvm-config %exclude %{pkg_bindir}/llvm-config
@ -332,7 +391,26 @@ fi
%{_libdir}/%{name}/lib/*.a %{_libdir}/%{name}/lib/*.a
%endif %endif
%if !0%{?compat_build}
%files test
%{_libexecdir}/tests/llvm/
%{llvm_bindir}/unittests/
%{_datadir}/llvm/src/test.tar.gz
%{llvm_bindir}/yaml-bench
%{llvm_bindir}/lli-child-target
%{llvm_bindir}/llvm-isel-fuzzer
%{llvm_bindir}/llvm-opt-fuzzer
%files googletest
%{_datadir}/llvm/src/utils
%endif
%changelog %changelog
* Thu Aug 23 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.5.rc1
- Package lit tests and googletest sources.
* Mon Aug 20 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.4.rc1 * Mon Aug 20 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.4.rc1
- Re-enable AMDGPU target on ARM rhbz#1618922 - Re-enable AMDGPU target on ARM rhbz#1618922

17
run-lit-tests Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
set -xe
#lit -v /usr/share/llvm/src/test
TOOLS_DIR=/usr/lib64/llvm
cd $(mktemp -d)
tar -xzf /usr/share/llvm/src/test.tar.gz
lit 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

11
tests/tests.yml Normal file
View file

@ -0,0 +1,11 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- llvm-test
tests:
- rhbz#482491:
dir: ./
run: /usr/libexec/tests/llvm/run-lit-tests