Add unittest accepted/tizen_rust tizen accepted/tizen/rust/20231016.021743
authorWoohyun Jung <wh0705.jung@samsung.com>
Thu, 4 May 2023 06:25:18 +0000 (15:25 +0900)
committerWoohyun Jung <wh0705.jung@samsung.com>
Thu, 4 May 2023 06:25:18 +0000 (15:25 +0900)
[    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

packaging/rust-random-fast-rng.spec

index b72152e77674be44442d69fb7311ba472a0a5ebb..92625deef093c86aeb16c1a871d69c992e3aeb81 100644 (file)
@@ -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