Add unittest
authorRoy7Kim <myoungwoon.kim@samsung.com>
Wed, 31 May 2023 11:13:02 +0000 (20:13 +0900)
committerRoy7Kim <myoungwoon.kim@samsung.com>
Wed, 31 May 2023 11:13:14 +0000 (20:13 +0900)
[   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

index bfde0df69e1f4b0fd77368f3e4ee2ecf62146bc1..4d03276c53f005e30040bd857cff588483d17745 100644 (file)
@@ -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