From: Woohyun Jung Date: Thu, 4 May 2023 06:06:30 +0000 (+0900) Subject: Add unittest X-Git-Tag: accepted/tizen/rust/20231016.021741^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=633949f3f0503b13f8c0186637cc68f505185a5e;p=platform%2Fupstream%2Frust-rand_xorshift.git 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 --- 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 # ==========================================================