Add unittest accepted/tizen_rust tizen accepted/tizen/rust/20231016.021739
authorWoohyun Jung <wh0705.jung@samsung.com>
Thu, 4 May 2023 05:59:44 +0000 (14:59 +0900)
committerWoohyun Jung <wh0705.jung@samsung.com>
Thu, 4 May 2023 05:59:44 +0000 (14:59 +0900)
[   15s] + ./mcg128xsl64
[   15s]
[   15s] running 3 tests
[   15s] test test_mcg128xsl64_advancing ... ok
[   15s] test test_mcg128xsl64_construction ... ok
[   15s] test test_mcg128xsl64_true_values ... ok
[   15s]
[   15s] test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
[   15s]
[   15s] + for unit_test in '${unit_test_list}'
[   15s] + ./lcg64xsh32
[   15s]
[   15s] running 3 tests
[   15s] test test_lcg64xsh32_advancing ... ok
[   15s] test test_lcg64xsh32_construction ... ok
[   15s] test test_lcg64xsh32_true_values ... ok
[   15s]
[   15s] test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
[   15s]
[   15s] + for unit_test in '${unit_test_list}'
[   15s] + ./lcg128xsl64
[   15s]
[   15s] running 3 tests
[   15s] test test_lcg128xsl64_advancing ... ok
[   15s] test test_lcg128xsl64_construction ... ok
[   15s] test test_lcg128xsl64_true_values ... ok
[   15s]
[   15s] test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

packaging/rust-rand_pcg.spec

index 306748f3e3c2e3cbbda0852a0eb4ec63e1c59643..d1d43505e65a01ac054f596de7e5177094559187 100644 (file)
@@ -42,12 +42,31 @@ 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}} \
-         %rust_dylib_extern rand_core \
-         ./src/lib.rs
+%{rustc_std_build} --crate-type=dylib \
+        --crate-name=%{real_crate_name} \
+        %{?rustc_edition:--edition=%{rustc_edition}} \
+        %rust_dylib_extern rand_core \
+        ./src/lib.rs
 
+%check
+%if 0%{?run_tests}
+export unit_test_list="mcg128xsl64 lcg64xsh32 lcg128xsl64"
+
+for unit_test in ${unit_test_list}
+do
+%{rustc_std_build} --test --crate-type=dylib \
+        --crate-name=${unit_test} \
+        %{?rustc_edition:--edition=%{rustc_edition}} \
+        %rust_dylib_extern rand_core \
+        --extern %{real_crate_name}=./lib%{real_crate_name}.so \
+        ./tests/${unit_test}.rs
+done
+
+for unit_test in ${unit_test_list}
+do
+./${unit_test}
+done
+%endif
 # ==========================================================
 # install section
 # ==========================================================