From d905a023a1885301eb06db209358a70aee171487 Mon Sep 17 00:00:00 2001 From: Roy7Kim Date: Tue, 30 May 2023 15:48:06 +0900 Subject: [PATCH] Add unittest [ 10s] + ./kstring [ 10s] [ 10s] running 4 tests [ 10s] test string::test::test_size ... ok [ 10s] test string_cow::test::test_size ... ok [ 10s] test string_ref::test::test_size ... ok [ 10s] test test::test_size ... ok [ 10s] [ 10s] test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s --- packaging/rust-kstring.spec | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packaging/rust-kstring.spec b/packaging/rust-kstring.spec index 5f927d2..957f19c 100644 --- a/packaging/rust-kstring.spec +++ b/packaging/rust-kstring.spec @@ -59,6 +59,20 @@ 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"' \ + --cfg='feature="unsafe"' \ + %rust_dylib_extern static_assertions \ + ./src/lib.rs + +./%{real_crate_name} +%endif + + %clean %post -p /sbin/ldconfig -- 2.34.1