Just some food for thought atm:
src_test() {
einfo "Building default test suite"
ecargo build --tests --lib || die "building default test suite failed"
einfo "Running default test suite"
ecargo test --tests || die "ecargo test --tests failed"
einfo "Running doc tests"
ecargo test --doc || die "ecargo test --doc failed"
for i in i128 $(usev rand) $(usev serde); do
einfo "Building test suite with --features ${i}"
ecargo build --features "${i}" --tests --lib || die "Building test suite with --features ${i} failed"
einfo "Testing with --features ${i}"
ecargo test --features "${i}" --tests || die "Running test suite with --features ${i} failed"
einfo "Running doc tests with --features ${i}"
ecargo test --features "${i}" --doc || die "Running doc tests with --features ${i} failed"
done
}
This is just a prototype pattern for something which I'd like to see native eclass support for.
Maybe have a bash array like:
ECARGO_TEST_TARGETS=(
"default/test,doc"
"i128/test,doc"
"rand/test,doc,if_use"
"serde/test,doc,if_use"
)
Where:
And params are something like:
test : do cargo test --tests
doc: do cargo test --doc
if_use: only do testing on this feature if the feature is both in IUSE and USE ( and warning if not in IUSE )
build_only: do `cargo build --lib` with the features needed, but don't compile (or run) tests.
Values without "/" are interpreted as:
"foo" -> "foo/test" # when "foo" is *not* in IUSE
"foo" -> "foo/test,if_use" # when "foo" *is* in IUSE
And the default value for the array is:
ECARGO_TEST_TARGETS=(
"default/test"
)
We could special case "default" to never pass --features, but given --features default works just fine, and you need to have a feature named 'default' in order to have defaulted features ... it seems YAGNI, yet.
Just some food for thought atm:
This is just a prototype pattern for something which I'd like to see native eclass support for.
Maybe have a bash array like:
Where:
"feature/params"And params are something like:
Values without "/" are interpreted as:
And the default value for the array is:
ECARGO_TEST_TARGETS=( "default/test" )We could special case "default" to never pass
--features, but given--features defaultworks just fine, and you need to have a feature named 'default' in order to have defaulted features ... it seems YAGNI, yet.