From 691b4494de7a3e285bc190be089280198a435775 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Thu, 13 Apr 2023 15:34:23 +0900 Subject: [PATCH] Add unittest [ 21s] running 1 test [ 21s] test tests::zeroize_works ... ok [ 21s] [ 21s] test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s --- packaging/rust-aes.spec | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packaging/rust-aes.spec b/packaging/rust-aes.spec index 9d17c47..469dfdd 100644 --- a/packaging/rust-aes.spec +++ b/packaging/rust-aes.spec @@ -33,7 +33,7 @@ Requires: rust-cpufeatures # ========================================================== # dev-dependencies # ========================================================== -# BuildRequires: rust-cipher +BuildRequires: rust-cipher # BuildRequires: rust-hex-literal @@ -68,6 +68,22 @@ export _RUSTC_EXTERN_PACKAGES_="--extern cpufeatures=%{_rust_dylibdir}/libcpufea 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="hazmat"' \ + --cfg='feature="zeroize"' \ + %rust_dylib_extern cfg_if \ + %rust_dylib_extern cipher \ + %rust_dylib_extern zeroize \ + $_RUSTC_EXTERN_PACKAGES_ \ + ./src/lib.rs + +./%{real_crate_name} +%endif + %clean %post -p /sbin/ldconfig -- 2.7.4