1 |
commit: 49e7e58000978a0b3a78248c6f5095a79b63fd7a |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 29 14:33:29 2017 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Apr 26 08:14:11 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49e7e580 |
7 |
|
8 |
sys-libs/compiler-rt: Switch builtin tests to lit |
9 |
|
10 |
Replace the custom builtin test logic with lit, now that upstream |
11 |
supports running builtin tests using it. |
12 |
|
13 |
sys-libs/compiler-rt/compiler-rt-9999.ebuild | 78 ++++++---------------------- |
14 |
1 file changed, 16 insertions(+), 62 deletions(-) |
15 |
|
16 |
diff --git a/sys-libs/compiler-rt/compiler-rt-9999.ebuild b/sys-libs/compiler-rt/compiler-rt-9999.ebuild |
17 |
index 7431230cf57..1f6cc5955c3 100644 |
18 |
--- a/sys-libs/compiler-rt/compiler-rt-9999.ebuild |
19 |
+++ b/sys-libs/compiler-rt/compiler-rt-9999.ebuild |
20 |
@@ -8,7 +8,6 @@ EAPI=6 |
21 |
CMAKE_MIN_VERSION=3.7.0-r1 |
22 |
PYTHON_COMPAT=( python2_7 ) |
23 |
|
24 |
-# TODO: fix unnecessary dep on Python upstream |
25 |
inherit cmake-utils flag-o-matic git-r3 llvm python-any-r1 toolchain-funcs |
26 |
|
27 |
DESCRIPTION="Compiler runtime library for clang (built-in part)" |
28 |
@@ -28,7 +27,9 @@ LLVM_SLOT=${SLOT%%.*} |
29 |
DEPEND=" |
30 |
>=sys-devel/llvm-4 |
31 |
clang? ( sys-devel/clang ) |
32 |
- test? ( =sys-devel/clang-${PV%_*}*:${LLVM_SLOT} ) |
33 |
+ test? ( |
34 |
+ $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]") |
35 |
+ =sys-devel/clang-${PV%_*}*:${LLVM_SLOT} ) |
36 |
${PYTHON_DEPS}" |
37 |
|
38 |
# least intrusive of all |
39 |
@@ -64,74 +65,27 @@ src_configure() { |
40 |
|
41 |
local mycmakeargs=( |
42 |
-DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}" |
43 |
- # use a build dir structure consistent with install |
44 |
- # this makes it possible to easily deploy test-friendly clang |
45 |
- -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${SLOT}" |
46 |
|
47 |
- # currently lit covers only sanitizer tests |
48 |
- -DCOMPILER_RT_INCLUDE_TESTS=OFF |
49 |
+ -DCOMPILER_RT_INCLUDE_TESTS=$(usex test) |
50 |
-DCOMPILER_RT_BUILD_SANITIZERS=OFF |
51 |
-DCOMPILER_RT_BUILD_XRAY=OFF |
52 |
) |
53 |
|
54 |
+ if use test; then |
55 |
+ mycmakeargs+=( |
56 |
+ -DLIT_COMMAND="${EPREFIX}/usr/bin/lit" |
57 |
+ |
58 |
+ -DCOMPILER_RT_TEST_COMPILER="${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/bin/clang" |
59 |
+ -DCOMPILER_RT_TEST_CXX_COMPILER="${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/bin/clang++" |
60 |
+ ) |
61 |
+ fi |
62 |
+ |
63 |
cmake-utils_src_configure |
64 |
} |
65 |
|
66 |
src_test() { |
67 |
- # prepare a test compiler |
68 |
- # copy clang over since resource_dir is located relatively to binary |
69 |
- # therefore, we can put our new libraries in it |
70 |
- mkdir -p "${BUILD_DIR}"/lib/{llvm/${LLVM_SLOT}{/bin,$(get_libdir)},clang/${SLOT}/include} || die |
71 |
- cp "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/bin/clang{,++} \ |
72 |
- "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/bin/ || die |
73 |
- cp "${EPREFIX}/usr/lib/clang/${SLOT}/include"/*.h \ |
74 |
- "${BUILD_DIR}/lib/clang/${SLOT}/include/" || die |
75 |
- |
76 |
- # builtins are not converted to lit yet, so run them manually |
77 |
- local tests=() f |
78 |
- cd "${S}"/test/builtins/Unit || die |
79 |
- while read -r -d '' f; do |
80 |
- # ppc subdir is unmaintained and lacks proper guards |
81 |
- # (and ppc builtins do not seem to be used anyway) |
82 |
- [[ ${f} == ./ppc/* ]] && continue |
83 |
- # these are special |
84 |
- [[ ${f} == ./cpu_model_test.c ]] && continue |
85 |
- [[ ${f} == ./gcc_personality_test.c ]] && continue |
86 |
- # unsupported |
87 |
- [[ ${f} == ./trampoline_setup_test.c ]] && continue |
88 |
- tests+=( "${f%.c}" ) |
89 |
- done < <(find -name '*.c' -print0) |
90 |
- |
91 |
- { |
92 |
- echo "check: ${tests[*]/#/check-}" && |
93 |
- echo ".PHONY: check ${tests[*]/#/check-}" && |
94 |
- for f in "${tests[@]}"; do |
95 |
- echo "check-${f}: ${f}" && |
96 |
- echo " ${f}" |
97 |
- done |
98 |
- } > Makefile || die |
99 |
- |
100 |
- local ABI |
101 |
- for ABI in $(get_all_abis); do |
102 |
- # not supported at all at the moment |
103 |
- [[ ${ABI} == x32 ]] && continue |
104 |
- |
105 |
- rm -f "${tests[@]}" || die |
106 |
- |
107 |
- einfo "Running tests for ABI=${ABI}" |
108 |
- # use -k to run all tests even if some fail |
109 |
- emake -k \ |
110 |
- CC="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang" \ |
111 |
- CFLAGS="$(get_abi_CFLAGS)" \ |
112 |
- CPPFLAGS='-I../../../lib/builtins' \ |
113 |
- LDFLAGS='-rtlib=compiler-rt' \ |
114 |
- LDLIBS='-lm' |
115 |
- done |
116 |
-} |
117 |
- |
118 |
-src_install() { |
119 |
- cmake-utils_src_install |
120 |
+ # respect TMPDIR! |
121 |
+ local -x LIT_PRESERVES_TMP=1 |
122 |
|
123 |
- # includes are mistakenly installed for all sanitizers and xray |
124 |
- rm -rf "${ED}"usr/lib/clang/*/include || die |
125 |
+ cmake-utils_src_make check-builtins |
126 |
} |