From: DongHun Kwak Date: Thu, 8 Jun 2023 02:27:37 +0000 (+0900) Subject: Add unittest X-Git-Tag: accepted/tizen/rust/20231016.021718^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen;p=platform%2Fupstream%2Frust-ptr_meta.git Add unittest [ 16s] + ./ptr_meta [ 16s] [ 16s] running 4 tests [ 16s] test tests::last_field_dst ... ok [ 16s] test tests::sized_types ... ok [ 16s] test tests::trait_objects ... ok [ 16s] test tests::unsized_types ... ok [ 16s] [ 16s] test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s --- diff --git a/packaging/rust-ptr_meta.spec b/packaging/rust-ptr_meta.spec index a830c73..28a44d4 100644 --- a/packaging/rust-ptr_meta.spec +++ b/packaging/rust-ptr_meta.spec @@ -51,6 +51,18 @@ 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}} \ + --cfg='feature="std"' \ + %rust_dylib_extern ptr_meta_derive \ + ./src/lib.rs + +./%{real_crate_name} +%endif + %clean %post -p /sbin/ldconfig