From 9d0e93a221d50829c394ede7be24b7c12117e7ca Mon Sep 17 00:00:00 2001 From: Roy7Kim Date: Wed, 31 May 2023 20:13:02 +0900 Subject: [PATCH] Add unittest [ 19s] + ./include_dir_macros [ 19s] [ 19s] running 6 tests [ 19s] test tests::invalid_variables ... ok [ 19s] test tests::dont_resolve_recursively ... ok [ 19s] test tests::parse_valid_identifiers ... ok [ 19s] test tests::resolve_path_with_no_environment_variables ... ok [ 19s] test tests::simple_environment_variable ... ok [ 19s] test tests::unknown_environment_variable ... ok [ 19s] [ 19s] test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s --- packaging/rust-include_dir_macros.spec | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packaging/rust-include_dir_macros.spec b/packaging/rust-include_dir_macros.spec index bfde0df..4d03276 100644 --- a/packaging/rust-include_dir_macros.spec +++ b/packaging/rust-include_dir_macros.spec @@ -54,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=proc-macro \ + --crate-name=%{real_crate_name} \ + %{?rustc_edition:--edition=%{rustc_edition}} \ + %rust_dylib_extern quote \ + %rust_dylib_extern proc_macro2 \ + ./src/lib.rs + +./%{real_crate_name} +%endif + %clean %post -p /sbin/ldconfig -- 2.34.1