Add unittest accepted/tizen_rust tizen accepted/tizen/rust/20231016.020948
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 4 May 2023 00:16:13 +0000 (09:16 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 4 May 2023 00:16:13 +0000 (09:16 +0900)
[   14s] + ./ciborium_ll
[   14s]
[   14s] running 2 tests
[   14s] test tests::node ... ok
[   14s] test tests::leaf ... ok
[   14s]
[   14s] test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

packaging/rust-ciborium-ll.spec

index 4fb9a6bbaf525a5dff19a00b6f529d5a3678cdf3..e99ddcab1f9610c455d6badcad43bb26111eaca9 100644 (file)
@@ -30,7 +30,9 @@ Requires:       rust-half
 # ==========================================================
 # dev-dependencies
 # ==========================================================
-# BuildRequires:  rust-hex 
+%if 0%{?run_tests}
+BuildRequires:  rust-hex 
+%endif
 
 
 %description
@@ -62,6 +64,21 @@ cp %{SOURCE2} .
 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}} \
+        %rust_dylib_extern ciborium_io \
+        %rust_dylib_extern half \
+        %rust_dylib_extern hex \
+        --cfg='feature="std"' \
+        --cfg='feature="alloc"' \
+        ./src/lib.rs
+
+./%{real_crate_name}
+%endif
+
 %clean
 
 %post -p /sbin/ldconfig