Add unittest accepted/tizen_rust tizen accepted/tizen/rust/20231016.020845
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 26 Apr 2023 06:31:34 +0000 (15:31 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 26 Apr 2023 06:31:34 +0000 (15:31 +0900)
[  155s] + ./bincode
[  155s]
[  155s] running 42 tests
[  155s] test bytes ... ok
[  155s] test char_serialization ... ok
[  155s] test deserializing_errors ... ok
[  155s] test encode_box ... ok
[  155s] test endian_difference ... ok
[  155s] test not_human_readable ... ok
[  155s] test path_buf ... ok
[  155s] test serde_bytes ... ok
[  155s] test test_basic_struct ... ok
[  155s] test test_big_endian_deserialize_from_seed ... ok
[  155s] test test_big_endian_deserialize_seed ... ok
[  155s] test test_bool ... ok
[  155s] test test_byte_vec_struct ... ok
[  155s] test test_default_deserialize_from_seed ... ok
[  155s] test test_default_deserialize_seed ... ok
[  155s] test test_cow_serialize ... ok
[  155s] test test_enum ... ok
[  155s] test test_multi_strings_serialize ... ok
[  155s] test test_fixed_size_array ... ok
[  155s] test test_map ... ok
[  155s] test test_strbox_serialize ... ok
[  155s] test test_oom_protection ... ok
[  155s] test test_nested_struct ... ok
[  155s] test test_serialized_size ... ok
[  155s] test test_struct_newtype ... ok
[  155s] test test_slicebox_serialize ... ok
[  155s] test test_numbers_128bit ... ok
[  155s] test test_serialized_size_bounded ... ok
[  155s] test test_varint_length_prefixes ... ok
[  155s] test test_string ... ok
[  155s] test test_numbers ... ok
[  155s] test test_zero_copy_parse_deserialize_into ... ok
[  155s] test test_unicode ... ok
[  155s] test test_zero_copy_parse ... ok
[  155s] test too_big_char_deserialize ... ok
[  155s] test test_option ... ok
[  155s] test too_big_deserialize ... ok
[  155s] test test_vec ... ok
[  155s] test test_struct_tuple ... ok
[  155s] test too_big_serialize ... ok
[  155s] test test_tuple ... ok
[  155s] test trailing_bytes ... ok
[  155s]
[  155s] test result: ok. 42 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s

packaging/rust-bincode.spec

index 4f0bf35..96399fa 100644 (file)
@@ -26,8 +26,10 @@ BuildRequires:  rust-serde
 # ==========================================================
 # dev-dependencies
 # ==========================================================
-# BuildRequires:  rust-serde_bytes 
+%if 0%{?run_tests}
+BuildRequires:  rust-serde_bytes 
 # BuildRequires:  rust-serde_derive 
+%endif
 
 
 %description
@@ -55,6 +57,17 @@ 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}} \
+        --extern %{real_crate_name}=lib%{real_crate_name}.so \
+        ./tests/test.rs
+
+./%{real_crate_name}
+%endif
+
 %clean
 
 %post -p /sbin/ldconfig