Add unitest
authorRoy7Kim <myoungwoon.kim@samsung.com>
Tue, 25 Apr 2023 08:25:44 +0000 (17:25 +0900)
committerRoy7Kim <myoungwoon.kim@samsung.com>
Tue, 25 Apr 2023 08:26:23 +0000 (17:26 +0900)
[   12s] + ./zeroize
[   12s]
[   12s] running 13 tests
[   12s] test asref ... ok
[   12s] test non_zero ... ok
[   12s] test zeroize_box ... ok
[   12s] test zeroize_byte_arrays ... ok
[   12s] test zeroize_check_tuple ... ok
[   12s] test zeroize_check_zerosize_types ... ok
[   12s] test zeroize_on_drop_byte_arrays ... ok
[   12s] test zeroize_maybeuninit_byte_arrays ... ok
[   12s] test zeroize_on_drop_check_tuple ... ok
[   12s] test zeroize_string_entire_capacity ... ok
[   12s] test zeroize_vec ... ok
[   12s] test zeroize_vec_entire_capacity ... ok
[   12s] test zeroize_string ... ok
[   12s]
[   12s] test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

packaging/rust-zeroize.spec

index 1281da0f262dc1075607c73826f68cb6adb469f3..0c9cf390d764baf465047c9d325ff6d7cbb6e769 100644 (file)
@@ -44,6 +44,7 @@ cp %{SOURCE1} .
 %{rustc_std_build} --crate-type=dylib \
         --crate-name=%{real_crate_name} \
         %{?rustc_edition:--edition=%{rustc_edition}} \
+        --cfg='feature="alloc"' \
         ./src/lib.rs
 
 # ==========================================================
@@ -53,6 +54,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="alloc"' \
+        --extern %{real_crate_name}=./lib%{real_crate_name}.so \
+        ./tests/zeroize.rs
+./%{real_crate_name}
+%endif
+
 %clean
 
 %post -p /sbin/ldconfig