From: Woohyun Jung Date: Thu, 4 May 2023 06:25:18 +0000 (+0900) Subject: Add unittest X-Git-Tag: accepted/tizen/rust/20231016.021743^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_rust;p=platform%2Fupstream%2Frust-random-fast-rng.git Add unittest [ 9s] + ./random_fast_rng [ 9s] [ 9s] running 2 tests [ 9s] test tests::test_float ... ok [ 9s] test tests::test_local ... ok [ 9s] [ 9s] test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s --- diff --git a/packaging/rust-random-fast-rng.spec b/packaging/rust-random-fast-rng.spec index b72152e..92625de 100644 --- a/packaging/rust-random-fast-rng.spec +++ b/packaging/rust-random-fast-rng.spec @@ -39,10 +39,22 @@ cp %{SOURCE1} . # crate-type : dylib, proc-macro, cdylib, bin, etc. # ========================================================== %build - %{rustc_std_build} --crate-type=dylib \ - --crate-name=%{real_crate_name} \ - %{?rustc_edition:--edition=%{rustc_edition}} \ - ./src/lib.rs +%{rustc_std_build} --crate-type=dylib \ + --crate-name=%{real_crate_name} \ + %{?rustc_edition:--edition=%{rustc_edition}} \ + --cfg='feature="std"' \ + ./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}} \ + --cfg='feature="std"' \ + ./src/lib.rs + +./%{real_crate_name} +%endif # ========================================================== # install section