Add unittest
authorRoy7Kim <myoungwoon.kim@samsung.com>
Wed, 24 May 2023 07:19:54 +0000 (16:19 +0900)
committerRoy7Kim <myoungwoon.kim@samsung.com>
Wed, 24 May 2023 07:20:11 +0000 (16:20 +0900)
[   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

index 14626870335a0df6e8b093758bd0d8ee81fb6b57..ecdccff4f3378537ff1d1d419fe70baca0e6aef7 100644 (file)
@@ -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