Split out test executables into their own export file

This commit is contained in:
Tom Stellard 2019-09-10 20:35:57 +00:00
parent f07760fd8f
commit bab8b9476f
5 changed files with 120 additions and 2 deletions

View File

@ -0,0 +1,65 @@
From 9d496e978f59e153bb76e92229d5a524d92dee04 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Tue, 10 Sep 2019 13:33:48 -0700
Subject: [PATCH] CMake: Split test binary exports into their own export file
---
llvm/cmake/modules/AddLLVM.cmake | 7 ++++++-
llvm/cmake/modules/CMakeLists.txt | 3 +++
llvm/cmake/modules/LLVMConfig.cmake.in | 1 +
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 200fc45..9eec7a7 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -953,7 +953,12 @@ macro(add_llvm_utility name)
set(export_to_llvmexports)
if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
NOT LLVM_DISTRIBUTION_COMPONENTS)
- set(export_to_llvmexports EXPORT LLVMExports)
+ if (${name} STREQUAL "not" OR ${name} STREQUAL "count" OR
+ ${name} STREQUAL "yaml-bench" OR ${name} STREQUAL "lli-child-target")
+ set(export_to_llvmexports EXPORT LLVMTestExports)
+ else()
+ set(export_to_llvmexports EXPORT LLVMExports)
+ endif()
set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
endif()
diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt
index dc982d2..c861f45 100644
--- a/llvm/cmake/modules/CMakeLists.txt
+++ b/llvm/cmake/modules/CMakeLists.txt
@@ -106,6 +106,7 @@ set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
set(LLVM_CONFIG_STATIC_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake")
+set(LLVM_CONFIG_TEST_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMTestExports.cmake")
configure_file(
LLVMConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
@@ -124,6 +125,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
COMPONENT cmake-exports)
install(EXPORT LLVMStaticExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
COMPONENT cmake-exports)
+ install(EXPORT LLVMTestExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
+ COMPONENT cmake-exports)
endif()
install(FILES
diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in
index 6ef54a0..d81b09a 100644
--- a/llvm/cmake/modules/LLVMConfig.cmake.in
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in
@@ -91,6 +91,7 @@ if(NOT TARGET LLVMSupport)
@llvm_config_include_buildtree_only_exports@
include("@LLVM_CONFIG_STATIC_EXPORTS_FILE@" OPTIONAL)
+ include("@LLVM_CONFIG_TEST_EXPORTS_FILE@" OPTIONAL)
endif()
# By creating intrinsics_gen here, subprojects that depend on LLVM's
--
1.8.3.1

View File

@ -14,7 +14,7 @@
%global min_ver 0 %global min_ver 0
%global patch_ver 0 %global patch_ver 0
%global rc_ver 3 %global rc_ver 3
%global baserelease 0.3 %global baserelease 0.4
%if %{with compat_build} %if %{with compat_build}
@ -55,6 +55,7 @@ Patch0: 0001-Filter-out-cxxflags-not-supported-by-clang.patch
# of gold. # of gold.
Patch1: 0001-Pass-target-to-gold-linker-to-avoid-faliures-on-i686.patch Patch1: 0001-Pass-target-to-gold-linker-to-avoid-faliures-on-i686.patch
Patch2: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch Patch2: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch
Patch3: 0001-CMake-Split-test-binary-exports-into-their-own-expor.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -251,7 +252,7 @@ ln -s llvm-config.1 %{buildroot}%{_mandir}/man1/llvm-config-%{__isa_bits}.1
mv %{buildroot}%{_mandir}/man1/tblgen.1 %{buildroot}%{_mandir}/man1/llvm-tblgen.1 mv %{buildroot}%{_mandir}/man1/tblgen.1 %{buildroot}%{_mandir}/man1/llvm-tblgen.1
# Install binaries needed for lit tests # Install binaries needed for lit tests
%global test_binaries FileCheck count lli-child-target llvm-PerfectShuffle llvm-isel-fuzzer llvm-opt-fuzzer not yaml-bench %global test_binaries llvm-isel-fuzzer llvm-opt-fuzzer
for f in %{test_binaries} for f in %{test_binaries}
do do
@ -422,6 +423,7 @@ fi
%{_libdir}/libLLVM.so %{_libdir}/libLLVM.so
%{_libdir}/cmake/llvm %{_libdir}/cmake/llvm
%exclude %{_libdir}/cmake/llvm/LLVMStaticExports.cmake %exclude %{_libdir}/cmake/llvm/LLVMStaticExports.cmake
%exclude %{_libdir}/cmake/llvm/LLVMTestExports.cmake
%else %else
%{_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
%{pkg_bindir}/llvm-config %{pkg_bindir}/llvm-config
@ -463,6 +465,7 @@ fi
%{_bindir}/llvm-opt-fuzzer %{_bindir}/llvm-opt-fuzzer
%{_libdir}/BugpointPasses.so %{_libdir}/BugpointPasses.so
%{_libdir}/LLVMHello.so %{_libdir}/LLVMHello.so
%{_libdir}/cmake/llvm/LLVMTestExports.cmake
%files googletest %files googletest
%{_datadir}/llvm/src/utils %{_datadir}/llvm/src/utils
@ -471,6 +474,9 @@ fi
%endif %endif
%changelog %changelog
* Tue Sep 10 2019 Tom Stellard <tstellar@redhat.com> - 9.0.0-0.4.rc3
- Split out test executables into their own export file
* Fri Sep 06 2019 Tom Stellard <tstellar@redhat.com> - 9.0.0-0.3.rc3 * Fri Sep 06 2019 Tom Stellard <tstellar@redhat.com> - 9.0.0-0.3.rc3
- Fix patch for splitting out static library exports - Fix patch for splitting out static library exports

View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.4.3)
find_package(LLVM)

View File

@ -0,0 +1,16 @@
set -ex
# This test is meant to ensure that the cmake files in llvm-devel work
# when only the packages it depends on are installed.
ARCH=`rpm --eval '%_arch'`
llvm_devel_num_deps=`dnf repoquery --nvr --requires --resolve llvm-devel.$ARCH | grep '^llvm' | wc -l`
llvm_num_sub_packages_installed=`dnf list installed | grep '^llvm' | wc -l`
# Verify that only llvm-devel dependencies are installed.
test `expr $llvm_devel_num_deps + 1` -eq $llvm_num_sub_packages_installed
# Verify that cmake files can me used without errors.
cmake -G Ninja .

28
tests/testsllvm-devel.yml Normal file
View File

@ -0,0 +1,28 @@
- hosts: localhost
pre_tasks:
# Make sure we uninstall all sub-packages, so we can test that the cmake files
# in llvm-devel are useable when only llvm-devel is installed.
- name: Uninstall llvm sub-packages
package:
name: "{{ item }}"
state: absent
tags: classic
with_items:
- llvm
- llvm-devel
- llvm-doc
- llvm-googletest
- llvm-libs
- llvm-static
- llvm-test
roles:
- role: standard-test-basic
tags: classic
required_packages:
- llvm-devel
- cmake
- ninja-build
- gcc
- gcc-c++
tests:
- llvm-devel-cmake