From d9e5db0a6c643e1df1437ade4819a4c9bbce325c Mon Sep 17 00:00:00 2001 From: Young-Flash Date: Fri, 25 Oct 2024 14:20:33 +0800 Subject: [PATCH] internal: passing wb & bb test flag to moonc --- crates/moonbuild/src/gen/gen_check.rs | 10 ++++++++++ crates/moonbuild/src/gen/gen_runtest.rs | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/crates/moonbuild/src/gen/gen_check.rs b/crates/moonbuild/src/gen/gen_check.rs index 8c4f19f5..1193b591 100644 --- a/crates/moonbuild/src/gen/gen_check.rs +++ b/crates/moonbuild/src/gen/gen_check.rs @@ -39,6 +39,8 @@ pub struct CheckDepItem { pub package_full_name: String, pub package_source_dir: String, pub is_main: bool, + pub is_whitebox_test: bool, + pub is_blackbox_test: bool, } #[derive(Debug)] @@ -97,6 +99,8 @@ fn pkg_to_check_item( package_full_name, package_source_dir, is_main: pkg.is_main, + is_whitebox_test: false, + is_blackbox_test: false, }) } @@ -161,6 +165,8 @@ fn pkg_with_wbtest_to_check_item( package_full_name, package_source_dir, is_main: pkg.is_main, + is_whitebox_test: true, + is_blackbox_test: false, }) } @@ -246,6 +252,8 @@ fn pkg_with_test_to_check_item( package_full_name, package_source_dir, is_main: pkg.is_main, + is_whitebox_test: false, + is_blackbox_test: true, }) } @@ -364,6 +372,8 @@ pub fn gen_check_command( &item.package_full_name, &item.package_source_dir )) .args(["-target", moonc_opt.build_opt.target_backend.to_flag()]) + .arg_with_cond(item.is_whitebox_test, "-whitebox-test") + .arg_with_cond(item.is_blackbox_test, "-blackbox-test") .build(); log::debug!("Command: {}", command); build.cmdline = Some(command); diff --git a/crates/moonbuild/src/gen/gen_runtest.rs b/crates/moonbuild/src/gen/gen_runtest.rs index bea80506..b82b28c0 100644 --- a/crates/moonbuild/src/gen/gen_runtest.rs +++ b/crates/moonbuild/src/gen/gen_runtest.rs @@ -47,6 +47,8 @@ pub struct RuntestDepItem { pub package_source_dir: String, pub is_main: bool, pub is_third_party: bool, + pub is_whitebox_test: bool, + pub is_blackbox_test: bool, } #[derive(Debug)] @@ -181,6 +183,8 @@ pub fn gen_package_core( package_source_dir, is_main: false, is_third_party: pkg.is_third_party, + is_whitebox_test: false, + is_blackbox_test: false, }) } @@ -248,6 +252,8 @@ pub fn gen_package_internal_test( package_source_dir, is_main: true, is_third_party: pkg.is_third_party, + is_whitebox_test: false, + is_blackbox_test: false, }) } @@ -323,6 +329,8 @@ pub fn gen_package_whitebox_test( package_source_dir, is_main: true, is_third_party: pkg.is_third_party, + is_whitebox_test: true, + is_blackbox_test: false, }) } @@ -420,6 +428,8 @@ pub fn gen_package_blackbox_test( package_source_dir, is_main: true, is_third_party: pkg.is_third_party, + is_whitebox_test: false, + is_blackbox_test: true, }) } @@ -812,6 +822,8 @@ pub fn gen_runtest_build_command( // Coverage arg .args(coverage_args.iter()) .args(moonc_opt.extra_build_opt.iter()) + .arg_with_cond(item.is_whitebox_test, "-whitebox-test") + .arg_with_cond(item.is_blackbox_test, "-blackbox-test") .build(); log::debug!("Command: {}", command); build.cmdline = Some(command);