Add unittest
authorRoy7Kim <myoungwoon.kim@samsung.com>
Mon, 15 May 2023 00:51:47 +0000 (09:51 +0900)
committerRoy7Kim <myoungwoon.kim@samsung.com>
Mon, 15 May 2023 00:51:56 +0000 (09:51 +0900)
[   18s] + ./send_wrapper
[   18s]
[   18s] running 11 tests
[   18s] test tests::test_clone ... ok
[   18s] test tests::test_debug ... ok
[   18s] test tests::test_clone_panic ... ok
[   18s] test tests::test_take ... ok
[   18s] test tests::test_deref ... ok
[   18s] test tests::test_deref_panic ... ok
[   18s] test tests::test_debug_panic ... ok
[   18s] test tests::test_drop_panic ... ok
[   18s] test tests::test_sync ... ok
[   18s] test tests::test_valid ... ok
[   18s] test tests::test_take_panic ... ok
[   18s]
[   18s] test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

packaging/rust-send_wrapper.spec

index f09d1b32d89976378bdd1dd73d07c7489cd95828..d1fd2fd9b80b575d9e6d87a064757b28fa4aafec 100644 (file)
@@ -59,6 +59,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