Skip to content

Commit

Permalink
dev-lang/rust: rework src_test
Browse files Browse the repository at this point in the history
Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Georgy Yakovlev <[email protected]>
  • Loading branch information
gyakovlev committed Oct 7, 2020
1 parent f814a90 commit 9e3b4eb
Showing 1 changed file with 53 additions and 16 deletions.
69 changes: 53 additions & 16 deletions dev-lang/rust/rust-1.46.0.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ QA_SONAME="
usr/lib.*/${P}/rustlib/.*/lib/lib.*.so.*
"

# tests need a bit more work, currently they are causing multiple
# re-compilations and somewhat fragile.
# still disabled, almost ready to enable
RESTRICT="test"

PATCHES=(
Expand Down Expand Up @@ -419,19 +418,57 @@ src_compile() {
}

src_test() {
env $(cat "${S}"/config.env) RUST_BACKTRACE=1\
"${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml -j$(makeopts_jobs) --no-doc --no-fail-fast \
src/test/codegen \
src/test/codegen-units \
src/test/compile-fail \
src/test/incremental \
src/test/mir-opt \
src/test/pretty \
src/test/run-fail \
src/test/run-make \
src/test/run-make-fulldeps \
src/test/ui \
src/test/ui-fulldeps || die
# https://rustc-dev-guide.rust-lang.org/tests/intro.html

# those are basic and codegen tests.
local tests=(
codegen
codegen-units
compile-fail
incremental
mir-opt
pretty
run-make
)

# known to fail with system-llvm sometimes
# system-llvm is stable-masked for time-being
# so only test internal one.
use system-llvm || tests+=( assembly )

# fragile/expensive/less important tests
# or tests that require extra build time
# TODO: instead of skipping, just make some nonfatal.
if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then
tests+=(
rustdoc
rustdoc-js
rustdoc-js-std
rustdoc-ui
run-make-fulldeps
ui
ui-fulldeps
)
fi

local i failed=()
einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}"
for i in "${tests[@]}"; do
local t="src/test/${i}"
einfo "rust_src_test: running ${t}"
if ! nonfatal env $(cat "${S}"/config.env) RUST_BACKTRACE=1 \
"${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \
-j$(makeopts_jobs) --no-doc --no-fail-fast "${t}"; then

failed+=( "${t}" )
eerror "rust_src_test: ${t} failed"
fi
done

if [[ ${#failed[@]} -ne 0 ]]; then
eerror "rust_src_test: failure summary: ${failed[@]}"
die "aborting due to test failures"
fi
}

src_install() {
Expand Down Expand Up @@ -478,7 +515,7 @@ src_install() {
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
mkdir -p "${ED}/usr/${abi_libdir}/${P}"
cp "${ED}/usr/$(get_libdir)/${P}/rustlib/${rust_target}/lib"/*.so \
"${ED}/usr/${abi_libdir}/${P}" || die
"${ED}/usr/${abi_libdir}/${P}" || die
done

# versioned libdir/mandir support
Expand Down

0 comments on commit 9e3b4eb

Please sign in to comment.