diff options
author | Michał Górny <mgorny@gentoo.org> | 2016-12-23 11:51:42 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2016-12-23 11:53:16 +0100 |
commit | 9b547d968af83cc57f4712dd1a134ede3abc4fd7 (patch) | |
tree | 5932588cad4af76a96e5e9396a8bf904bd60010f /sys-libs/compiler-rt | |
parent | sys-apps/darwin-miscutils: hexdump moved to shell_cmds (diff) | |
download | gentoo-9b547d968af83cc57f4712dd1a134ede3abc4fd7.tar.gz gentoo-9b547d968af83cc57f4712dd1a134ede3abc4fd7.tar.bz2 gentoo-9b547d968af83cc57f4712dd1a134ede3abc4fd7.zip |
sys-libs/compiler-rt: Support running built-in tests
Diffstat (limited to 'sys-libs/compiler-rt')
-rw-r--r-- | sys-libs/compiler-rt/compiler-rt-9999.ebuild | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/sys-libs/compiler-rt/compiler-rt-9999.ebuild b/sys-libs/compiler-rt/compiler-rt-9999.ebuild index 75abf2dd6d22..a48b4738680e 100644 --- a/sys-libs/compiler-rt/compiler-rt-9999.ebuild +++ b/sys-libs/compiler-rt/compiler-rt-9999.ebuild @@ -20,12 +20,13 @@ EGIT_REPO_URI="http://llvm.org/git/compiler-rt.git LICENSE="|| ( UoI-NCSA MIT )" SLOT="0/${PV%.*}" KEYWORDS="" -IUSE="" +IUSE="test" RDEPEND=" !<sys-devel/llvm-4.0" DEPEND="${RDEPEND} ~sys-devel/llvm-${PV} + test? ( ~sys-devel/clang-${PV} ) ${PYTHON_DEPS}" test_compiler() { @@ -64,6 +65,54 @@ src_configure() { cmake-utils_src_configure } +src_test() { + # prepare a test compiler + local clang_version=4.0.0 + local sys_dir=( "${EPREFIX}/usr/lib/clang/${clang_version}/lib"/* ) + [[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}" + [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[@]}" + + # copy clang over since resource_dir is located relatively to binary + # therefore, we can put our new libraries in it + mkdir -p "${BUILD_DIR}"/{bin,$(get_libdir),lib/clang/"${clang_version}"/include} || die + cp "${EPREFIX}/usr/bin/clang" "${EPREFIX}/usr/bin/clang++" \ + "${BUILD_DIR}"/bin/ || die + cp "${EPREFIX}/usr/lib/clang/${clang_version}/include"/*.h \ + "${BUILD_DIR}/lib/clang/${clang_version}/include/" || die + + # builtins are not converted to lit yet, so run them manually + local tests=() f + cd "${S}"/test/builtins/Unit || die + while read -r -d '' f; do + # ppc subdir is unmaintained and lacks proper guards + # (and ppc builtins do not seem to be used anyway) + [[ ${f} == ./ppc/* ]] && continue + # these are special + [[ ${f} == ./cpu_model_test.c ]] && continue + [[ ${f} == ./gcc_personality_test.c ]] && continue + # unsupported + [[ ${f} == ./trampoline_setup_test.c ]] && continue + tests+=( "${f%.c}" ) + done < <(find -name '*.c' -print0) + + { + echo "check: ${tests[*]/#/check-}" && + echo ".PHONY: check ${tests[*]/#/check-}" && + for f in "${tests[@]}"; do + echo "check-${f}: ${f}" && + echo " ${f}" + done + } > Makefile || die + + # use -k to run all tests even if some fail + emake -k \ + CC="${BUILD_DIR}/bin/clang" \ + CFLAGS='' \ + CPPFLAGS='-I../../../lib/builtins' \ + LDFLAGS='-rtlib=compiler-rt' \ + LDLIBS='-lm' +} + src_install() { cmake-utils_src_install |