From: Roy7Kim Date: Thu, 11 May 2023 04:49:08 +0000 (+0900) Subject: Add unittest X-Git-Tag: accepted/tizen/rust/20231016.021939^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=06b571b899ce6ff87ec0562234f2e2d1fc8d796b;p=platform%2Fupstream%2Frust-smawk.git Add unittest [ 20s] + ./smawk [ 20s] [ 20s] running 19 tests [ 20s] test monge::tests::is_monge_handles_overflow ... ok [ 20s] test monge::tests::monge_constant_cols ... ok [ 20s] test monge::tests::monge_constant_rows ... ok [ 20s] test monge::tests::monge_lower_left ... ok [ 20s] test monge::tests::monge_upper_right ... ok [ 20s] test tests::online_1x1 ... ok [ 20s] test tests::online_2x2 ... ok [ 20s] test tests::online_4x4 ... ok [ 20s] test tests::online_3x3 ... ok [ 20s] test tests::online_5x5 ... ok [ 20s] test tests::online_works_with_partial_ord ... ok [ 20s] test tests::smawk_2x2 ... ok [ 20s] test tests::smawk_1x2 ... ok [ 20s] test tests::smawk_1x1 ... ok [ 20s] test tests::smawk_3x3 ... ok [ 20s] test tests::smawk_2x1 ... ok [ 20s] test tests::smawk_4x4 ... ok [ 20s] test tests::smawk_5x5 ... ok [ 20s] test tests::smawk_works_with_partial_ord ... ok [ 20s] [ 20s] test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s --- diff --git a/packaging/rust-smawk.spec b/packaging/rust-smawk.spec index cfe757e..0c9acb6 100644 --- a/packaging/rust-smawk.spec +++ b/packaging/rust-smawk.spec @@ -56,6 +56,16 @@ 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}} \ + ./src/lib.rs + +./%{real_crate_name} +%endif + %clean %post -p /sbin/ldconfig