From 24d87e8f8ebe5c812eae18f296062cc1dc10eefd Mon Sep 17 00:00:00 2001 From: Roy7Kim Date: Wed, 24 May 2023 16:19:54 +0900 Subject: [PATCH] Add unittest [ 39s] + ./miniz_oxide [ 39s] [ 39s] running 22 tests [ 39s] test deflate::core::test::compress_output ... ok [ 39s] test deflate::core::test::u16_to_slice ... ok [ 39s] test deflate::core::test::u16_from_slice ... ok [ 39s] test deflate::core::test::compress_fast ... ok [ 39s] test deflate::core::zlib::test::test_header ... ok [ 39s] test deflate::core::zlib::test::zlib ... ok [ 39s] test deflate::stream::test::test_state ... ok [ 39s] test deflate::test::compress_huff_only ... ok [ 39s] test deflate::test::compress_raw ... ok [ 39s] test deflate::test::compress_small ... ok [ 39s] test deflate::test::short ... ok [ 39s] test inflate::core::test::bogus_input ... ok [ 39s] test inflate::core::test::empty_output_buffer_non_wrapping ... ok [ 39s] test inflate::core::test::fixed_table_lookup ... ok [ 39s] test inflate::core::test::empty_output_buffer_wrapping ... ok [ 39s] test inflate::core::test::decompress_zlib ... ok [ 39s] test inflate::core::test::raw_block ... ok [ 39s] test inflate::stream::test::test_state ... ok [ 39s] test inflate::test::decompress_vec ... ok [ 39s] test inflate::test::decompress_vec_with_high_limit ... ok [ 39s] test inflate::test::fail_to_decompress_with_limit ... ok [ 39s] test inflate::test::test_decompress_slice_iter_to_slice ... ok [ 39s] [ 39s] test result: ok. 22 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s --- packaging/rust-miniz_oxide.spec | 36 ++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/packaging/rust-miniz_oxide.spec b/packaging/rust-miniz_oxide.spec index 1462687..ecdccff 100644 --- a/packaging/rust-miniz_oxide.spec +++ b/packaging/rust-miniz_oxide.spec @@ -39,19 +39,31 @@ cp %{SOURCE1} . # crate-type : dylib, proc-macro, cdylib, bin, etc. # ========================================================== %build - %{rustc_std_build} --crate-type=dylib \ - --crate-name=%{real_crate_name} \ - %{?rustc_edition:--edition=%{rustc_edition}} \ - --cfg='feature="with-alloc"' \ - %rust_dylib_extern adler \ - ./src/lib.rs +%{rustc_std_build} --crate-type=dylib \ + --crate-name=%{real_crate_name} \ + %{?rustc_edition:--edition=%{rustc_edition}} \ + --cfg='feature="with-alloc"' \ + %rust_dylib_extern adler \ + ./src/lib.rs # ========================================================== # install section # ========================================================== %install - install -d -m 0755 %{buildroot}%{_rust_dylibdir} - install -m 0644 lib%{real_crate_name}.so %{buildroot}/%{_rust_dylibdir}/lib%{real_crate_name}.so +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="with-alloc"' \ + %rust_dylib_extern adler \ + ./src/lib.rs + +./%{real_crate_name} +%endif %clean @@ -64,7 +76,7 @@ cp %{SOURCE1} . # ========================================================== %files %manifest %{name}.manifest - %license LICENSE-APACHE.md - %license LICENSE-MIT.md - %license LICENSE-ZLIB.md - %{_rust_dylibdir}/lib%{real_crate_name}.so +%license LICENSE-APACHE.md +%license LICENSE-MIT.md +%license LICENSE-ZLIB.md +%{_rust_dylibdir}/lib%{real_crate_name}.so -- 2.34.1