summaryrefslogtreecommitdiff
path: root/packaging/rust-serde_bytes.spec
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/rust-serde_bytes.spec')
-rw-r--r--packaging/rust-serde_bytes.spec32
1 files changed, 29 insertions, 3 deletions
diff --git a/packaging/rust-serde_bytes.spec b/packaging/rust-serde_bytes.spec
index 4993321..f32dfb0 100644
--- a/packaging/rust-serde_bytes.spec
+++ b/packaging/rust-serde_bytes.spec
@@ -26,10 +26,11 @@ BuildRequires: rust-serde
# ==========================================================
# dev-dependencies
# ==========================================================
+%if 0%{?run_tests}
# BuildRequires: rust-bincode
-# BuildRequires: rust-serde_derive
-# BuildRequires: rust-serde_test
-
+BuildRequires: rust-serde_derive
+BuildRequires: rust-serde_test
+%endif
%description
Optimized handling of `&[u8]` and `Vec<u8>` for Serde.
@@ -57,6 +58,31 @@ 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}
+
+export unit_test_list="test_derive test_partialeq test_serde"
+for unit_test in ${unit_test_list}
+do
+%{rustc_std_build} --test --crate-type=dylib \
+ --crate-name=${unit_test} \
+ %{?rustc_edition:--edition=%{rustc_edition}} \
+ --extern %{real_crate_name}=./lib%{real_crate_name}.so \
+ %rust_dylib_extern serde \
+ %rust_dylib_extern serde_derive \
+ %rust_dylib_extern serde_test \
+ --cfg='feature="std"' \
+ ./tests/${unit_test}.rs
+done
+
+for unit_test in ${unit_test_list}
+do
+./${unit_test}
+done
+
+%endif
+
+
%clean
%post -p /sbin/ldconfig