From 633949f3f0503b13f8c0186637cc68f505185a5e Mon Sep 17 00:00:00 2001 From: Woohyun Jung Date: Thu, 4 May 2023 15:06:30 +0900 Subject: [PATCH] Add unittest [ 9s] + ./rand_xorshift [ 9s] [ 9s] running 4 tests [ 9s] test test_xorshift_clone ... ok [ 9s] test test_xorshift_construction ... ok [ 9s] test test_xorshift_true_values ... ok [ 9s] test test_xorshift_zero_seed ... ok [ 9s] [ 9s] test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s --- packaging/rust-rand_xorshift.spec | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packaging/rust-rand_xorshift.spec b/packaging/rust-rand_xorshift.spec index d009ddb..7088ca8 100644 --- a/packaging/rust-rand_xorshift.spec +++ b/packaging/rust-rand_xorshift.spec @@ -49,6 +49,18 @@ cp %{SOURCE1} . %rust_dylib_extern rand_core \ ./src/lib.rs +%check +%if 0%{?run_tests} +%{rustc_std_build} --test --crate-type=dylib \ + --crate-name=%{real_crate_name} \ + %{?rustc_edition:--edition=%{rustc_edition}} \ + %rust_dylib_extern rand_core \ + --extern %{real_crate_name}=lib%{real_crate_name}.so \ + ./tests/mod.rs + +./%{real_crate_name} +%endif + # ========================================================== # install section # ========================================================== -- 2.34.1