summaryrefslogtreecommitdiff
path: root/packaging/rust-sha2.spec
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/rust-sha2.spec')
-rw-r--r--packaging/rust-sha2.spec28
1 files 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