Skip to content

Commit

Permalink
internal: passing wb & bb test flag to moonc
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash committed Oct 25, 2024
1 parent 138be9e commit d9e5db0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/moonbuild/src/gen/gen_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions crates/moonbuild/src/gen/gen_runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d9e5db0

Please sign in to comment.