Enable unit tests

This commit is contained in:
Tom Stellard 2018-03-19 16:27:23 +00:00
parent ad3b6d908d
commit f7f57849e2
2 changed files with 51 additions and 2 deletions

42
0001-gtest-reorg.patch Normal file
View File

@ -0,0 +1,42 @@
From 3b2afecc227d652f84f883d4018d43971de6a311 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Wed, 21 Mar 2018 07:17:00 -0700
Subject: [PATCH] gtest reorg
---
CMakeLists.txt | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2eee8e6..01d290f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -142,12 +142,6 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
set(LLVM_UTILS_PROVIDED ON)
set(CLANG_TEST_DEPS FileCheck count not)
endif()
- set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
- add_subdirectory(${UNITTEST_DIR} utils/unittest)
- endif()
else()
# Seek installed Lit.
find_program(LLVM_LIT
@@ -477,7 +471,11 @@ endif()
if( CLANG_INCLUDE_TESTS )
- if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h)
+ set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
+ if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
+ AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
+ AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
+ add_subdirectory(${UNITTEST_DIR} utils/unittest)
add_subdirectory(unittests)
list(APPEND CLANG_TEST_DEPS ClangUnitTests)
list(APPEND CLANG_TEST_PARAMS
--
1.8.3.1

View File

@ -59,7 +59,7 @@
Name: %pkg_name
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 0.4.rc%{rc_ver}%{?dist}
Release: 0.5.rc%{rc_ver}%{?dist}
Summary: A C language family front-end for LLVM
License: NCSA
@ -84,6 +84,7 @@ Patch1: 0001-GCC-compatibility-Ignore-fstack-clash-protection.patch
Patch2: 0001-Driver-Prefer-vendor-supplied-gcc-toolchain.patch
# This was merged into the release_70 branch after 7.0.0-rc1
Patch3: 0001-Merging-r338627.patch
Patch4: 0001-gtest-reorg.patch
# Test suite Patches
Patch100: 0001-Fix-CLAMR-build-with-newer-libstdc.patch
@ -100,6 +101,7 @@ BuildRequires: llvm-devel = %{version}
# llvm-static is required, because clang-tablegen needs libLLVMTableGen, which
# is not included in libLLVM.so.
BuildRequires: llvm-static = %{version}
BuildRequires: llvm-googletest = %{version}
%endif
BuildRequires: libxml2-devel
@ -239,6 +241,7 @@ suite can be run with any compiler, not just clang.
%patch1 -p1 -b .fstack-clash-protection
%patch2 -p1 -b .vendor-gcc
%patch3 -p1 -b .hmap-path-fix
%patch4 -p1 -b .gtest
mv ../%{clang_tools_srcdir} tools/extra
%endif
@ -270,6 +273,7 @@ cd _build
-DLLVM_CONFIG:FILEPATH=/usr/bin/llvm-config-%{__isa_bits} \
-DCLANG_INCLUDE_TESTS:BOOL=ON \
-DLLVM_EXTERNAL_LIT=%{python2_sitelib}/lit/main.py \
-DLLVM_MAIN_SRC_DIR=%{_datadir}/llvm/src \
%if 0%{?__isa_bits} == 64
-DLLVM_LIBDIR_SUFFIX=64 \
%else
@ -355,7 +359,7 @@ cp -R %{_builddir}/%{test_suite_srcdir}/* %{buildroot}%{_datadir}/llvm-test-suit
# requires lit.py from LLVM utilities
cd _build
# FIXME: Fix failing ARM tests
PATH=%{_libdir}/llvm:$PATH make check-clang || \
PATH=%{_libdir}/llvm:$PATH make %{?_smp_mflags} check-clang || \
%ifarch %{arm}
:
%else
@ -433,6 +437,9 @@ false
%endif
%changelog
* Tue Aug 28 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.5.rc1
- Enable unit tests
* Fri Aug 17 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.4.rc1
- Move llvm-test-suite into a sub-package