summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-08-17 12:00:06 +0200
committerMichał Górny <mgorny@gentoo.org>2019-09-25 19:27:02 +0200
commit07502a84076fd04b1fbc16d9be04edd1bd270b27 (patch)
tree1912b02461ee95c4a14e97b1af8ca1712ab6c43e /sys-libs
parentsys-libs/netbsd-csu: Force testing with sys-devel/clang (diff)
downloadgentoo-07502a84076fd04b1fbc16d9be04edd1bd270b27.tar.gz
gentoo-07502a84076fd04b1fbc16d9be04edd1bd270b27.tar.bz2
gentoo-07502a84076fd04b1fbc16d9be04edd1bd270b27.zip
sys-libs/netbsd-csu: Provide more complete test suite
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'sys-libs')
-rw-r--r--sys-libs/netbsd-csu/Manifest1
-rw-r--r--sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild66
2 files changed, 35 insertions, 32 deletions
diff --git a/sys-libs/netbsd-csu/Manifest b/sys-libs/netbsd-csu/Manifest
index ae2aca3085d4..16f23ab3c5de 100644
--- a/sys-libs/netbsd-csu/Manifest
+++ b/sys-libs/netbsd-csu/Manifest
@@ -1 +1,2 @@
+DIST netbsd-csu-7.1-tests.tar.bz2 579 BLAKE2B 6d042b3b549ce6ffe0bd0ce908d042e4501a95c21958710078f587d9f52316a52f4bcc219f694ee60066a427a84c027c34906b76c7b8ca151766e5b476152708 SHA512 f2aa7d2340e2545a99cb88e104aaca77b64fd5bfea42bbe5e34d790ae120a749245099a550728f3b7ca2ca5a29fd1f426ddd2e8d5a7bc1a44921c308f1cb12db
DIST netbsd-csu-7.1.tar.xz 993460 BLAKE2B 013dd56eb5c49289f68518bee3f72afb42b264f7be869c7dda69f12c98ff782246fcee22c84a51719ab7ed45258cf5c06b43ee9d9da31879187bc0025b8e8c02 SHA512 834524a3ada2a4c02e7eb17d8be09cf023b91e64627f3b2abc32d4f3302e982dcf0939406dc8d6c0ec7ca5e641d2d1845885bb22a165b3d6a1979c2945e2aaad
diff --git a/sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild b/sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild
index c3b117bb5771..dae26e9e001f 100644
--- a/sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild
+++ b/sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild
@@ -7,7 +7,8 @@ inherit bsdmk multilib-minimal toolchain-funcs
DESCRIPTION="crtbegin.o/crtend.o from NetBSD CSU for GCC-free toolchain"
HOMEPAGE="http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/csu/"
-SRC_URI="https://dev.gentoo.org/~mgorny/dist/${P}.tar.xz"
+SRC_URI="https://dev.gentoo.org/~mgorny/dist/${P}.tar.xz
+ test? ( https://dev.gentoo.org/~mgorny/dist/${P}-tests.tar.bz2 )"
LICENSE="BSD-2"
SLOT="0"
@@ -59,9 +60,14 @@ multilib_src_compile() {
opts+=( crtbegin.o crtbeginS.o crtend.o )
bsdmk_src_compile "${opts[@]}"
+
+ ln -s crtbegin.o crtbeginT.o || die
+ ln -s crtend.o crtendS.o || die
}
multilib_src_test() {
+ cd "${WORKDIR}"/*-tests || die
+
# TODO: fix gcc support
local -x CC=${CHOST}-clang
local -x CXX=${CHOST}-clang++
@@ -97,37 +103,33 @@ multilib_src_test() {
die "Compiler uses wrong crtend: ${crtend}"
fi
- cat > hello.c <<-EOF || die
- #include <stdio.h>
-
- __attribute__((constructor))
- static void ctor_test()
- {
- fputs("ctor:", stdout);
- }
-
- __attribute__((destructor))
- static void dtor_test()
- {
- fputs(":dtor", stdout);
- }
-
- int main()
- {
- fputs("main", stdout);
- return 0;
- }
- EOF
-
- emake -f /dev/null CC="${cc[*]}" hello
-
- local out=$(./hello) || die
- if [[ ${out} != ctor:main:dtor ]]; then
- eerror "Invalid output from the test case."
- eerror " Expected: ctor:main:dtor"
- eerror " Output : ${out}"
- die "Test failed for ${ABI:-${ARCH}}"
- fi
+ # 3. build and run the tests
+ emake CC="${cc[*]}"
+
+ local p out exp
+ for p in ./hello{,-static,-dyn}; do
+ if [[ ${p} == ./hello-dyn && ${ABI} == x32 ]]; then
+ einfo "Skipping ${p} on x32 -- known to crash"
+ continue
+ fi
+
+ ebegin "Testing ${p}"
+ exp='ctor:main:dtor'
+ [[ ${p} == ./hello-dyn ]] && exp=libctor:${exp}:libdtor
+ if ! out=$("${p}"); then
+ eend 1
+ die "Test ${p} crashed for ${ABI:-${ARCH}}"
+ fi
+
+ [[ ${out} == ${exp} ]]
+ if ! eend "${?}"; then
+ eerror " Expected: ${exp}"
+ eerror " Output : ${out}"
+ die "Test ${p} failed for ${ABI:-${ARCH}}"
+ fi
+ done
+
+ emake clean
}
multilib_src_install() {