From: Woohyun Jung Date: Thu, 4 May 2023 05:44:24 +0000 (+0900) Subject: Add unittest X-Git-Tag: accepted/tizen/rust/20231016.021732^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_rust;p=platform%2Fupstream%2Frust-radium.git Add unittest [ 8s] + ./radium [ 8s] [ 8s] running 5 tests [ 8s] test tests::absent_traits ... ok [ 8s] test tests::always_alias ... ok [ 8s] test tests::maybe_atom ... ok [ 8s] test tests::always_cell ... ok [ 8s] test tests::present_traits ... ok [ 8s] [ 8s] test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s --- diff --git a/packaging/rust-radium.spec b/packaging/rust-radium.spec index c40adb2..c5c5488 100644 --- a/packaging/rust-radium.spec +++ b/packaging/rust-radium.spec @@ -26,7 +26,9 @@ BuildRequires: rust # ========================================================== # dev-dependencies # ========================================================== -# BuildRequires: rust-static_assertions +%if 0%{?run_tests} +BuildRequires: rust-static_assertions +%endif %description @@ -55,6 +57,24 @@ export RUSTC_TARGET_HAS_ATOMIC=64 --cfg="target_has_atomic=\"$RUSTC_TARGET_HAS_ATOMIC\"" \ ./src/lib.rs +%check +%if 0%{?run_tests} +%ifarch %{ix86} armv7l armv7hl +export RUSTC_TARGET_HAS_ATOMIC=32 +%endif +%ifarch x86_64 aarch64 +export RUSTC_TARGET_HAS_ATOMIC=64 +%endif +%{rustc_std_build} --test --crate-type=dylib \ + --crate-name=%{real_crate_name} \ + %{?rustc_edition:--edition=%{rustc_edition}} \ + --cfg='feature="atomic"' \ + --cfg="target_has_atomic=\"$RUSTC_TARGET_HAS_ATOMIC\"" \ + %rust_dylib_extern static_assertions \ + ./src/lib.rs + +./%{real_crate_name} +%endif # ========================================================== # install section # ==========================================================