cargo.eclass: add standard src_test
authorGeorgy Yakovlev <gyakovlev@gentoo.org>
Mon, 7 Jan 2019 03:43:46 +0000 (19:43 -0800)
committerGeorgy Yakovlev <gyakovlev@gentoo.org>
Tue, 8 Jan 2019 23:40:24 +0000 (15:40 -0800)
But not set IUSE=test by default

Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
eclass/cargo.eclass

index 06c85ce9de80e661573d428ff5131da7f7fe13ef..051d5c499a6e0c514c4880f42609ebc6fa6cee53 100644 (file)
@@ -23,7 +23,7 @@ esac
 
 inherit multiprocessing
 
-EXPORT_FUNCTIONS src_unpack src_compile src_install
+EXPORT_FUNCTIONS src_unpack src_compile src_install src_test
 
 IUSE="${IUSE} debug"
 
@@ -139,4 +139,14 @@ cargo_src_install() {
        [ -d "${S}/man" ] && doman "${S}/man" || return 0
 }
 
+# @FUNCTION: cargo_src_test
+# @DESCRIPTION:
+# Test the package using cargo test
+cargo_src_test() {
+       debug-print-function ${FUNCNAME} "$@"
+
+       cargo test -j $(makeopts_jobs) $(usex debug "" --release) "$@" \
+               || die "cargo test failed"
+}
+
 fi