diff options
author | 김명운/Tizen Platform Lab(SR)/삼성전자 <myoungwoon.kim@samsung.com> | 2023-05-12 16:45:10 +0900 |
---|---|---|
committer | GitHub Enterprise <noreply-CODE@samsung.com> | 2023-05-12 16:45:10 +0900 |
commit | 092585cf74ab37d341f72cd470c511dd7edf5c95 (patch) | |
tree | 61f89032dd27ea00ecaba297a67c7a79c19a5c5d /packaging/rust-serde_bytes.spec | |
parent | d32ab3565bc1074433f76cbeb75b199e86e418e5 (diff) | |
parent | 4a2dbdbd7e74882c3480235a048c3ab94d996424 (diff) | |
download | rust-serde_bytes-tizen.tar.gz rust-serde_bytes-tizen.tar.bz2 rust-serde_bytes-tizen.zip |
Merge pull request #1 from myoungwoon-kim/devaccepted/tizen/rust/20231016.021854tizenaccepted/tizen_rust
Add unittest
Diffstat (limited to 'packaging/rust-serde_bytes.spec')
-rw-r--r-- | packaging/rust-serde_bytes.spec | 32 |
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 |