From 53e642938c85bd9f698f7f59a2cc33f3778f4608 Mon Sep 17 00:00:00 2001 From: Roy7Kim Date: Fri, 12 May 2023 12:12:05 +0900 Subject: [PATCH] Add unittest [ 24s] + ./sha2 [ 24s] [ 24s] running 8 tests [ 24s] test sha224_main ... ok [ 24s] test sha256_main ... ok [ 24s] test sha512_224_main ... ok [ 24s] test sha384_main ... ok [ 24s] test sha512_256_main ... ok [ 24s] test sha512_main ... ok [ 25s] test sha256_rand ... ok [ 25s] test sha512_rand ... ok [ 25s] [ 25s] test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.33s --- packaging/rust-sha2.spec | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/packaging/rust-sha2.spec b/packaging/rust-sha2.spec index a77fc3a..2a8cc20 100644 --- a/packaging/rust-sha2.spec +++ b/packaging/rust-sha2.spec @@ -31,8 +31,11 @@ Requires: rust-digest # ========================================================== # dev-dependencies # ========================================================== -# BuildRequires: rust-digest -# BuildRequires: rust-hex-literal +%if 0%{?run_tests} +BuildRequires: rust-digest +BuildRequires: rust-hex-literal +BuildRequires: rust-blobby +%endif %description @@ -66,6 +69,27 @@ 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} +%ifarch %{ix86} aarch64 x86_64 +export _RUSTC_EXTERN_PACKAGES_="--extern cpufeatures=%{_rust_dylibdir}/libcpufeatures.so" +%endif +%{rustc_std_build} --test --crate-type=dylib \ + --crate-name=%{real_crate_name} \ + %{?rustc_edition:--edition=%{rustc_edition}} \ + --extern %{real_crate_name}=lib%{real_crate_name}.so \ + %rust_dylib_extern cfg_if \ + %rust_dylib_extern digest \ + %rust_dylib_extern hex_literal\ + %rust_dylib_extern blobby \ + $_RUSTC_EXTERN_PACKAGES_ \ + ./tests/mod.rs + +./%{real_crate_name} + +%endif + + %clean %post -p /sbin/ldconfig -- 2.7.4