Add unittest accepted/tizen_9.0_unified accepted/tizen_rust accepted/tizen_unified accepted/tizen_unified_dev accepted/tizen_unified_x tizen tizen_9.0 accepted/tizen/9.0/unified/20241030.234614 accepted/tizen/rust/20231016.020939 accepted/tizen/unified/20240328.121717 accepted/tizen/unified/dev/20240620.001137 accepted/tizen/unified/x/20240328.130543 tizen_9.0_m2_release
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 2 May 2023 05:24:10 +0000 (14:24 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 2 May 2023 05:24:10 +0000 (14:24 +0900)
[   41s] + ./eval
[   41s]
[   41s] running 7 tests
[   41s] test features ... ok
[   41s] test complex ... ok
[   41s] test target_family ... ok
[   41s] test tiny ... ok
[   41s] test unstable_target_abi ... ok
[   41s] test wasm_family ... ok
[   41s] test very_specific ... ok
[   41s]
[   41s] test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
[   41s]
[   41s] + for unit_test in '${unit_test_list}'
[   41s] + ./lexer
[   41s]
[   41s] running 6 tests
[   41s] test handle_cfg_keywords ... ok
[   41s] test handle_empty_value ... ok
[   41s] test handle_key_value ... ok
[   41s] test handle_short_key ... ok
[   41s] test handles_raw ... ok
[   41s] test strips_attribute ... ok
[   41s]
[   41s] test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
[   41s]
[   41s] + for unit_test in '${unit_test_list}'
[   41s] + ./parser
[   41s]
[   41s] running 8 tests
[   41s] test fails_empty ... ok
[   41s] test ensures_not_has_one_predicate ... ok
[   41s] test fails_invalid_funcs ... ok
[   41s] test fails_malformed ... ok
[   41s] test fails_unbalanced_parens ... ok
[   41s] test fails_unbalanced_quotes ... ok
[   41s] test handles_simple_funcs ... ok
[   41s] test handles_single_predicate ... ok
[   41s]
[   41s] test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

packaging/rust-cfg-expr.spec

index d22e503..76c3a0b 100644 (file)
@@ -27,7 +27,9 @@ BuildRequires:  rust-target-lexicon
 # ==========================================================
 # dev-dependencies
 # ==========================================================
-# BuildRequires:  rust-similar-asserts 
+%if 0%{?run_tests}
+BuildRequires:  rust-similar-asserts 
+%endif
 
 
 %description
@@ -55,6 +57,26 @@ 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}
+export unit_test_list="eval lexer parser"
+for unit_test in ${unit_test_list}
+do
+%{rustc_std_build} --test --crate-type=dylib \
+        --crate-name=${unit_test} \
+        %{?rustc_edition:--edition=%{rustc_edition}} \
+        %rust_dylib_extern smallvec \
+        %rust_dylib_extern similar_asserts \
+        --extern %{real_crate_name}=./lib%{real_crate_name}.so \
+        ./tests/${unit_test}.rs
+done
+
+for unit_test in ${unit_test_list}
+do
+./${unit_test}
+done
+%endif
+
 %clean
 
 %post -p /sbin/ldconfig