summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/rust-async-trait.spec22
1 files changed, 19 insertions, 3 deletions
diff --git a/packaging/rust-async-trait.spec b/packaging/rust-async-trait.spec
index d22c8cf..f385c7d 100644
--- a/packaging/rust-async-trait.spec
+++ b/packaging/rust-async-trait.spec
@@ -32,11 +32,13 @@ Requires: rust-syn
# ==========================================================
# dev-dependencies
# ==========================================================
-# BuildRequires: rust-futures
-# BuildRequires: rust-rustversion
-# BuildRequires: rust-tracing
+%if 0%{?run_tests}
+BuildRequires: rust-tracing
+BuildRequires: rust-rustversion
+BuildRequires: rust-futures
# BuildRequires: rust-tracing-attributes
# BuildRequires: rust-trybuild
+%endif
%description
@@ -64,6 +66,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-name=%{real_crate_name} \
+ %{?rustc_edition:--edition=%{rustc_edition}} \
+ --extern %{real_crate_name}=lib%{real_crate_name}.so \
+ %rust_dylib_extern tracing \
+ %rust_dylib_extern rustversion \
+ %rust_dylib_extern futures \
+ ./tests/test.rs
+
+./%{real_crate_name}
+%endif
+
%clean
%post -p /sbin/ldconfig