From bab8b9476f3e7ea5718bac18fd065496e7983c8e Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 10 Sep 2019 20:35:57 +0000 Subject: [PATCH] Split out test executables into their own export file --- ...-binary-exports-into-their-own-expor.patch | 65 +++++++++++++++++++ llvm.spec | 10 ++- tests/llvm-devel-cmake/CMakeLists.txt | 3 + tests/llvm-devel-cmake/runtest.sh | 16 +++++ tests/testsllvm-devel.yml | 28 ++++++++ 5 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 0001-CMake-Split-test-binary-exports-into-their-own-expor.patch create mode 100644 tests/llvm-devel-cmake/CMakeLists.txt create mode 100755 tests/llvm-devel-cmake/runtest.sh create mode 100644 tests/testsllvm-devel.yml diff --git a/0001-CMake-Split-test-binary-exports-into-their-own-expor.patch b/0001-CMake-Split-test-binary-exports-into-their-own-expor.patch new file mode 100644 index 0000000..a3801ff --- /dev/null +++ b/0001-CMake-Split-test-binary-exports-into-their-own-expor.patch @@ -0,0 +1,65 @@ +From 9d496e978f59e153bb76e92229d5a524d92dee04 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +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 + diff --git a/llvm.spec b/llvm.spec index 3781cb9..47976e8 100644 --- a/llvm.spec +++ b/llvm.spec @@ -14,7 +14,7 @@ %global min_ver 0 %global patch_ver 0 %global rc_ver 3 -%global baserelease 0.3 +%global baserelease 0.4 %if %{with compat_build} @@ -55,6 +55,7 @@ Patch0: 0001-Filter-out-cxxflags-not-supported-by-clang.patch # of gold. 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 +Patch3: 0001-CMake-Split-test-binary-exports-into-their-own-expor.patch BuildRequires: gcc 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 # 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} do @@ -422,6 +423,7 @@ fi %{_libdir}/libLLVM.so %{_libdir}/cmake/llvm %exclude %{_libdir}/cmake/llvm/LLVMStaticExports.cmake +%exclude %{_libdir}/cmake/llvm/LLVMTestExports.cmake %else %{_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{pkg_bindir}/llvm-config @@ -463,6 +465,7 @@ fi %{_bindir}/llvm-opt-fuzzer %{_libdir}/BugpointPasses.so %{_libdir}/LLVMHello.so +%{_libdir}/cmake/llvm/LLVMTestExports.cmake %files googletest %{_datadir}/llvm/src/utils @@ -471,6 +474,9 @@ fi %endif %changelog +* Tue Sep 10 2019 Tom Stellard - 9.0.0-0.4.rc3 +- Split out test executables into their own export file + * Fri Sep 06 2019 Tom Stellard - 9.0.0-0.3.rc3 - Fix patch for splitting out static library exports diff --git a/tests/llvm-devel-cmake/CMakeLists.txt b/tests/llvm-devel-cmake/CMakeLists.txt new file mode 100644 index 0000000..e08cd3a --- /dev/null +++ b/tests/llvm-devel-cmake/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.4.3) + +find_package(LLVM) diff --git a/tests/llvm-devel-cmake/runtest.sh b/tests/llvm-devel-cmake/runtest.sh new file mode 100755 index 0000000..42d42d3 --- /dev/null +++ b/tests/llvm-devel-cmake/runtest.sh @@ -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 . diff --git a/tests/testsllvm-devel.yml b/tests/testsllvm-devel.yml new file mode 100644 index 0000000..3109a8e --- /dev/null +++ b/tests/testsllvm-devel.yml @@ -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