From b09c0a126e1153bdd0f0cb918f6aaf4378da1d35 Mon Sep 17 00:00:00 2001 From: Woohyun Jung Date: Thu, 4 May 2023 14:59:44 +0900 Subject: [PATCH] Add unittest [ 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 | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/packaging/rust-rand_pcg.spec b/packaging/rust-rand_pcg.spec index 306748f..d1d4350 100644 --- a/packaging/rust-rand_pcg.spec +++ b/packaging/rust-rand_pcg.spec @@ -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 # ========================================================== -- 2.34.1