summaryrefslogtreecommitdiff
path: root/packaging/rust-base64.spec
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/rust-base64.spec')
-rw-r--r--packaging/rust-base64.spec22
1 files changed, 19 insertions, 3 deletions
diff --git a/packaging/rust-base64.spec b/packaging/rust-base64.spec
index 53040c7..c45d948 100644
--- a/packaging/rust-base64.spec
+++ b/packaging/rust-base64.spec
@@ -25,11 +25,13 @@ BuildRequires: rust
# ==========================================================
# dev-dependencies
# ==========================================================
+%if 0%{?run_tests}
+BuildRequires: rust-rand
+BuildRequires: rust-rstest
+BuildRequires: rust-rstest_reuse
# BuildRequires: rust-criterion
-# BuildRequires: rust-rand
-# BuildRequires: rust-rstest
-# BuildRequires: rust-rstest_reuse
# BuildRequires: rust-structopt
+%endif
%description
@@ -57,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"' \
+ %rust_dylib_extern rand \
+ %rust_dylib_extern rstest \
+ %rust_dylib_extern rstest_reuse \
+ ./src/lib.rs
+
+./%{real_crate_name}
+%endif
+
%clean
%post -p /sbin/ldconfig