From 2a0fe6198243b7eeddae1785dc0c2bf265b940a9 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 16 May 2023 13:44:15 +0900 Subject: Add unittest [ 23s] + ./crc32fast [ 23s] [ 23s] running 4 tests [ 23s] test baseline::test::slow ... ok [ 23s] test baseline::test::fast_16_is_the_same_as_slow ... ok [ 23s] test test::combine ... ok [ 23s] test test::combine_from_len ... ok [ 23s] [ 23s] test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s --- packaging/rust-crc32fast.spec | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packaging/rust-crc32fast.spec b/packaging/rust-crc32fast.spec index 155bb6d..660548e 100644 --- a/packaging/rust-crc32fast.spec +++ b/packaging/rust-crc32fast.spec @@ -27,9 +27,11 @@ Requires: rust-cfg-if # ========================================================== # dev-dependencies # ========================================================== +%if 0%{?run_tests} +BuildRequires: rust-quickcheck # BuildRequires: rust-bencher -# BuildRequires: rust-quickcheck # BuildRequires: rust-rand +%endif %description @@ -58,6 +60,18 @@ cp %{SOURCE1} . install -d -m 0755 %{buildroot}%{_rust_dylibdir} install -m 0644 lib%{real_crate_name}.so %{buildroot}/%{_rust_dylibdir}/lib%{real_crate_name}.so +%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"' \ + --extern cfg_if=%{_rust_dylibdir}/libcfg_if.so \ + ./src/lib.rs + +./%{real_crate_name} +%endif + %clean %post -p /sbin/ldconfig -- cgit v1.2.3