summaryrefslogtreecommitdiff
path: root/packaging/rust-ahash.spec
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/rust-ahash.spec')
-rw-r--r--packaging/rust-ahash.spec19
1 files changed, 19 insertions, 0 deletions
diff --git a/packaging/rust-ahash.spec b/packaging/rust-ahash.spec
index b68bbf8..a22a9b1 100644
--- a/packaging/rust-ahash.spec
+++ b/packaging/rust-ahash.spec
@@ -33,6 +33,10 @@ BuildRequires: rust-version_check
Requires: rust-getrandom
Requires: rust-once_cell
+%if 0%{?run_tests}
+BuildRequires: rust-hex
+%endif
+
%description
Non-cryptographic hash function using AES-NI for high performance.
@@ -62,6 +66,21 @@ 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="runtime-rng"' \
+ --cfg='feature="atomic-polyfill"' \
+ %rust_dylib_extern cfg_if \
+ %rust_dylib_extern hex \
+ ./src/lib.rs
+
+./%{real_crate_name}
+%endif
+
%clean
%post -p /sbin/ldconfig