mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
add suppress warning flag, remove test test_roc_app_slim
This commit is contained in:
parent
64cc816e51
commit
9ecb209f73
4 changed files with 398 additions and 303 deletions
|
@ -70,6 +70,7 @@ pub const FLAG_TIME: &str = "time";
|
||||||
pub const FLAG_VERBOSE: &str = "verbose";
|
pub const FLAG_VERBOSE: &str = "verbose";
|
||||||
pub const FLAG_LINKER: &str = "linker";
|
pub const FLAG_LINKER: &str = "linker";
|
||||||
pub const FLAG_BUILD_HOST: &str = "build-host";
|
pub const FLAG_BUILD_HOST: &str = "build-host";
|
||||||
|
pub const FLAG_SUPPRESS_BUILD_HOST_WARNING: &str = "suppress-build-host-warning";
|
||||||
pub const FLAG_CHECK: &str = "check";
|
pub const FLAG_CHECK: &str = "check";
|
||||||
pub const FLAG_STDIN: &str = "stdin";
|
pub const FLAG_STDIN: &str = "stdin";
|
||||||
pub const FLAG_STDOUT: &str = "stdout";
|
pub const FLAG_STDOUT: &str = "stdout";
|
||||||
|
@ -139,12 +140,18 @@ pub fn build_app() -> Command {
|
||||||
.value_parser(["surgical", "legacy"])
|
.value_parser(["surgical", "legacy"])
|
||||||
.required(false);
|
.required(false);
|
||||||
|
|
||||||
let flag_prebuilt = Arg::new(FLAG_BUILD_HOST)
|
let flag_build_host = Arg::new(FLAG_BUILD_HOST)
|
||||||
.long(FLAG_BUILD_HOST)
|
.long(FLAG_BUILD_HOST)
|
||||||
.help("WARNING: platforms are responsible for building hosts, this flag will be removed when internal test platforms have a build script")
|
.help("WARNING: platforms are responsible for building hosts, this flag will be removed when internal test platforms have a build script")
|
||||||
.action(ArgAction::SetTrue)
|
.action(ArgAction::SetTrue)
|
||||||
.required(false);
|
.required(false);
|
||||||
|
|
||||||
|
let flag_supress_build_host_warning = Arg::new(FLAG_SUPPRESS_BUILD_HOST_WARNING)
|
||||||
|
.long(FLAG_SUPPRESS_BUILD_HOST_WARNING)
|
||||||
|
.help("WARNING: platforms are responsible for building hosts, this flag will be removed when internal test platforms have a build script")
|
||||||
|
.action(ArgAction::SetTrue)
|
||||||
|
.required(false);
|
||||||
|
|
||||||
let flag_wasm_stack_size_kb = Arg::new(FLAG_WASM_STACK_SIZE_KB)
|
let flag_wasm_stack_size_kb = Arg::new(FLAG_WASM_STACK_SIZE_KB)
|
||||||
.long(FLAG_WASM_STACK_SIZE_KB)
|
.long(FLAG_WASM_STACK_SIZE_KB)
|
||||||
.help("Stack size in kilobytes for wasm32 target\n(This only applies when --dev also provided.)")
|
.help("Stack size in kilobytes for wasm32 target\n(This only applies when --dev also provided.)")
|
||||||
|
@ -198,7 +205,8 @@ pub fn build_app() -> Command {
|
||||||
.arg(flag_profiling.clone())
|
.arg(flag_profiling.clone())
|
||||||
.arg(flag_time.clone())
|
.arg(flag_time.clone())
|
||||||
.arg(flag_linker.clone())
|
.arg(flag_linker.clone())
|
||||||
.arg(flag_prebuilt.clone())
|
.arg(flag_build_host.clone())
|
||||||
|
.arg(flag_supress_build_host_warning.clone())
|
||||||
.arg(flag_fuzz.clone())
|
.arg(flag_fuzz.clone())
|
||||||
.arg(flag_wasm_stack_size_kb)
|
.arg(flag_wasm_stack_size_kb)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -250,7 +258,8 @@ pub fn build_app() -> Command {
|
||||||
.arg(flag_profiling.clone())
|
.arg(flag_profiling.clone())
|
||||||
.arg(flag_time.clone())
|
.arg(flag_time.clone())
|
||||||
.arg(flag_linker.clone())
|
.arg(flag_linker.clone())
|
||||||
.arg(flag_prebuilt.clone())
|
.arg(flag_build_host.clone())
|
||||||
|
.arg(flag_supress_build_host_warning.clone())
|
||||||
.arg(flag_fuzz.clone())
|
.arg(flag_fuzz.clone())
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(FLAG_VERBOSE)
|
Arg::new(FLAG_VERBOSE)
|
||||||
|
@ -281,7 +290,8 @@ pub fn build_app() -> Command {
|
||||||
.arg(flag_profiling.clone())
|
.arg(flag_profiling.clone())
|
||||||
.arg(flag_time.clone())
|
.arg(flag_time.clone())
|
||||||
.arg(flag_linker.clone())
|
.arg(flag_linker.clone())
|
||||||
.arg(flag_prebuilt.clone())
|
.arg(flag_build_host.clone())
|
||||||
|
.arg(flag_supress_build_host_warning.clone())
|
||||||
.arg(flag_fuzz.clone())
|
.arg(flag_fuzz.clone())
|
||||||
.arg(roc_file_to_run.clone())
|
.arg(roc_file_to_run.clone())
|
||||||
.arg(args_for_app.clone().last(true))
|
.arg(args_for_app.clone().last(true))
|
||||||
|
@ -296,7 +306,8 @@ pub fn build_app() -> Command {
|
||||||
.arg(flag_profiling.clone())
|
.arg(flag_profiling.clone())
|
||||||
.arg(flag_time.clone())
|
.arg(flag_time.clone())
|
||||||
.arg(flag_linker.clone())
|
.arg(flag_linker.clone())
|
||||||
.arg(flag_prebuilt.clone())
|
.arg(flag_build_host.clone())
|
||||||
|
.arg(flag_supress_build_host_warning.clone())
|
||||||
.arg(flag_fuzz.clone())
|
.arg(flag_fuzz.clone())
|
||||||
.arg(roc_file_to_run.clone())
|
.arg(roc_file_to_run.clone())
|
||||||
.arg(args_for_app.clone().last(true))
|
.arg(args_for_app.clone().last(true))
|
||||||
|
@ -431,7 +442,8 @@ pub fn build_app() -> Command {
|
||||||
.arg(flag_profiling)
|
.arg(flag_profiling)
|
||||||
.arg(flag_time)
|
.arg(flag_time)
|
||||||
.arg(flag_linker)
|
.arg(flag_linker)
|
||||||
.arg(flag_prebuilt)
|
.arg(flag_build_host)
|
||||||
|
.arg(flag_supress_build_host_warning)
|
||||||
.arg(flag_fuzz)
|
.arg(flag_fuzz)
|
||||||
.arg(roc_file_to_run)
|
.arg(roc_file_to_run)
|
||||||
.arg(args_for_app.trailing_var_arg(true))
|
.arg(args_for_app.trailing_var_arg(true))
|
||||||
|
@ -697,7 +709,6 @@ pub fn build(
|
||||||
roc_cache_dir: RocCacheDir<'_>,
|
roc_cache_dir: RocCacheDir<'_>,
|
||||||
link_type: LinkType,
|
link_type: LinkType,
|
||||||
) -> io::Result<i32> {
|
) -> io::Result<i32> {
|
||||||
use roc_build::program::build_file;
|
|
||||||
use BuildConfig::*;
|
use BuildConfig::*;
|
||||||
|
|
||||||
let path = matches.get_one::<PathBuf>(ROC_FILE).unwrap();
|
let path = matches.get_one::<PathBuf>(ROC_FILE).unwrap();
|
||||||
|
@ -845,10 +856,10 @@ pub fn build(
|
||||||
LinkingStrategy::Surgical
|
LinkingStrategy::Surgical
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: remove once host rebuilding is no longer required
|
// All hosts should be prebuilt, this flag keeps the rebuilding behvaiour
|
||||||
// all hosts should be prebuilt, this flag keeps the rebuilding behvaiour
|
// as required for internal tests
|
||||||
// until no longer required for internal tests
|
let build_host = matches.get_flag(FLAG_BUILD_HOST);
|
||||||
let rebuild_host = matches.get_flag(FLAG_BUILD_HOST);
|
let supress_build_host_warning = matches.get_flag(FLAG_SUPPRESS_BUILD_HOST_WARNING);
|
||||||
|
|
||||||
let fuzz = matches.get_flag(FLAG_FUZZ);
|
let fuzz = matches.get_flag(FLAG_FUZZ);
|
||||||
if fuzz && !matches!(code_gen_backend, CodeGenBackend::Llvm(_)) {
|
if fuzz && !matches!(code_gen_backend, CodeGenBackend::Llvm(_)) {
|
||||||
|
@ -876,7 +887,7 @@ pub fn build(
|
||||||
|
|
||||||
let load_config = standard_load_config(target, build_ordering, threading);
|
let load_config = standard_load_config(target, build_ordering, threading);
|
||||||
|
|
||||||
let res_binary_path = build_file(
|
let res_binary_path = roc_build::program::build_file(
|
||||||
&arena,
|
&arena,
|
||||||
target,
|
target,
|
||||||
path.to_owned(),
|
path.to_owned(),
|
||||||
|
@ -884,7 +895,8 @@ pub fn build(
|
||||||
emit_timings,
|
emit_timings,
|
||||||
link_type,
|
link_type,
|
||||||
linking_strategy,
|
linking_strategy,
|
||||||
rebuild_host,
|
build_host,
|
||||||
|
supress_build_host_warning,
|
||||||
wasm_dev_stack_bytes,
|
wasm_dev_stack_bytes,
|
||||||
roc_cache_dir,
|
roc_cache_dir,
|
||||||
load_config,
|
load_config,
|
||||||
|
|
|
@ -59,6 +59,9 @@ mod cli_run {
|
||||||
|
|
||||||
const OPTIMIZE_FLAG: &str = concatcp!("--", roc_cli::FLAG_OPTIMIZE);
|
const OPTIMIZE_FLAG: &str = concatcp!("--", roc_cli::FLAG_OPTIMIZE);
|
||||||
const LINKER_FLAG: &str = concatcp!("--", roc_cli::FLAG_LINKER);
|
const LINKER_FLAG: &str = concatcp!("--", roc_cli::FLAG_LINKER);
|
||||||
|
const BUILD_HOST_FLAG: &str = concatcp!("--", roc_cli::FLAG_BUILD_HOST);
|
||||||
|
const SUPPRESS_BUILD_HOST_WARNING_FLAG: &str =
|
||||||
|
concatcp!("--", roc_cli::FLAG_SUPPRESS_BUILD_HOST_WARNING);
|
||||||
const CHECK_FLAG: &str = concatcp!("--", roc_cli::FLAG_CHECK);
|
const CHECK_FLAG: &str = concatcp!("--", roc_cli::FLAG_CHECK);
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
const TARGET_FLAG: &str = concatcp!("--", roc_cli::FLAG_TARGET);
|
const TARGET_FLAG: &str = concatcp!("--", roc_cli::FLAG_TARGET);
|
||||||
|
@ -116,230 +119,230 @@ mod cli_run {
|
||||||
assert_eq!(out.status.success(), expects_success_exit_code);
|
assert_eq!(out.status.success(), expects_success_exit_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
// #[allow(clippy::too_many_arguments)]
|
||||||
fn check_output_with_stdin(
|
// fn check_output_with_stdin(
|
||||||
file: &Path,
|
// file: &Path,
|
||||||
stdin: &[&str],
|
// stdin: &[&str],
|
||||||
flags: &[&str],
|
// flags: &[&str],
|
||||||
roc_app_args: &[String],
|
// roc_app_args: &[String],
|
||||||
extra_env: &[(&str, &str)],
|
// extra_env: &[(&str, &str)],
|
||||||
expected_ending: &str,
|
// expected_ending: &str,
|
||||||
use_valgrind: UseValgrind,
|
// use_valgrind: UseValgrind,
|
||||||
test_cli_commands: TestCliCommands,
|
// test_cli_commands: TestCliCommands,
|
||||||
) {
|
// ) {
|
||||||
todo!()
|
// todo!()
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
// #[allow(clippy::too_many_arguments)]
|
||||||
fn get_output_with_stdin(
|
// fn get_output_with_stdin(
|
||||||
file: &Path,
|
// file: &Path,
|
||||||
stdin: Vec<&'static str>,
|
// stdin: Vec<&'static str>,
|
||||||
flags: &[&str],
|
// flags: &[&str],
|
||||||
roc_app_args: &[String],
|
// roc_app_args: &[String],
|
||||||
extra_env: &[(&str, &str)],
|
// extra_env: &[(&str, &str)],
|
||||||
use_valgrind: UseValgrind,
|
// use_valgrind: UseValgrind,
|
||||||
test_cli_commands: TestCliCommands,
|
// test_cli_commands: TestCliCommands,
|
||||||
) -> Vec<(CliMode, Out)> {
|
// ) -> Vec<(CliMode, Out)> {
|
||||||
let mut output = Vec::new();
|
// let mut output = Vec::new();
|
||||||
// valgrind does not yet support avx512 instructions, see #1963.
|
// // valgrind does not yet support avx512 instructions, see #1963.
|
||||||
// we can't enable this only when testing with valgrind because of host re-use between tests
|
// // we can't enable this only when testing with valgrind because of host re-use between tests
|
||||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||||
if is_x86_feature_detected!("avx512f") {
|
// if is_x86_feature_detected!("avx512f") {
|
||||||
std::env::set_var("NO_AVX512", "1");
|
// std::env::set_var("NO_AVX512", "1");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// TODO: expects don't currently work on windows
|
// // TODO: expects don't currently work on windows
|
||||||
let cli_commands = if cfg!(windows) {
|
// let cli_commands = if cfg!(windows) {
|
||||||
match test_cli_commands {
|
// match test_cli_commands {
|
||||||
TestCliCommands::Many => vec![CliMode::RocBuild, CliMode::RocRun],
|
// TestCliCommands::Many => vec![CliMode::RocBuild, CliMode::RocRun],
|
||||||
TestCliCommands::Run => vec![CliMode::RocRun],
|
// TestCliCommands::Run => vec![CliMode::RocRun],
|
||||||
TestCliCommands::Test => vec![],
|
// TestCliCommands::Test => vec![],
|
||||||
TestCliCommands::Dev => vec![],
|
// TestCliCommands::Dev => vec![],
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
match test_cli_commands {
|
// match test_cli_commands {
|
||||||
TestCliCommands::Many => vec![CliMode::RocBuild, CliMode::RocRun, CliMode::Roc],
|
// TestCliCommands::Many => vec![CliMode::RocBuild, CliMode::RocRun, CliMode::Roc],
|
||||||
TestCliCommands::Run => vec![CliMode::Roc],
|
// TestCliCommands::Run => vec![CliMode::Roc],
|
||||||
TestCliCommands::Test => vec![CliMode::RocTest],
|
// TestCliCommands::Test => vec![CliMode::RocTest],
|
||||||
TestCliCommands::Dev => vec![CliMode::RocDev],
|
// TestCliCommands::Dev => vec![CliMode::RocDev],
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
for cli_mode in cli_commands.into_iter() {
|
// for cli_mode in cli_commands.into_iter() {
|
||||||
let flags = {
|
// let flags = {
|
||||||
let mut vec = flags.to_vec();
|
// let mut vec = flags.to_vec();
|
||||||
|
|
||||||
vec.push("--build-host");
|
// vec.push("--build-host");
|
||||||
|
|
||||||
// max-threads segfaults on windows right now
|
// // max-threads segfaults on windows right now
|
||||||
if !cfg!(windows) {
|
// if !cfg!(windows) {
|
||||||
vec.push("--max-threads=1");
|
// vec.push("--max-threads=1");
|
||||||
}
|
// }
|
||||||
|
|
||||||
vec.into_iter()
|
// vec.into_iter()
|
||||||
};
|
// };
|
||||||
|
|
||||||
let cmd_output = match cli_mode {
|
// let cmd_output = match cli_mode {
|
||||||
CliMode::RocBuild => {
|
// CliMode::RocBuild => {
|
||||||
let runner = Run::new_roc()
|
// let runner = Run::new_roc()
|
||||||
.arg(file.to_str().unwrap())
|
// .arg(file.to_str().unwrap())
|
||||||
.arg(CMD_BUILD)
|
// .arg(CMD_BUILD)
|
||||||
.add_args(flags.clone());
|
// .add_args(flags.clone());
|
||||||
|
|
||||||
let out = runner.clone().run();
|
// let out = runner.clone().run();
|
||||||
|
|
||||||
out.assert_clean_success();
|
// out.assert_clean_success();
|
||||||
|
|
||||||
output.push((cli_mode, out));
|
// output.push((cli_mode, out));
|
||||||
|
|
||||||
let file_ext = if cfg!(windows) { "exe " } else { "" };
|
// let file_ext = if cfg!(windows) { "exe " } else { "" };
|
||||||
|
|
||||||
if matches!(use_valgrind, UseValgrind::Yes) && ALLOW_VALGRIND {
|
// if matches!(use_valgrind, UseValgrind::Yes) && ALLOW_VALGRIND {
|
||||||
let out = runner.run_with_valgrind();
|
// let out = runner.run_with_valgrind();
|
||||||
|
|
||||||
let mut raw_xml = String::new();
|
// let mut raw_xml = String::new();
|
||||||
|
|
||||||
out.valgrind_xml
|
// out.valgrind_xml
|
||||||
.as_ref()
|
// .as_ref()
|
||||||
.unwrap()
|
// .unwrap()
|
||||||
.read_to_string(&mut raw_xml)
|
// .read_to_string(&mut raw_xml)
|
||||||
.unwrap();
|
// .unwrap();
|
||||||
|
|
||||||
if out.status.success() {
|
// if out.status.success() {
|
||||||
let memory_errors = extract_valgrind_errors(&raw_xml).unwrap_or_else(|err| {
|
// let memory_errors = extract_valgrind_errors(&raw_xml).unwrap_or_else(|err| {
|
||||||
panic!("failed to parse the `valgrind` xml output:\n\n Error was:\n\n {:?}\n\n valgrind xml was:\n\n \"{}\"\n\n valgrind stdout was:\n\n \"{}\"\n\n valgrind stderr was:\n\n \"{}\"", err, raw_xml, out.stdout, out.stderr);
|
// panic!("failed to parse the `valgrind` xml output:\n\n Error was:\n\n {:?}\n\n valgrind xml was:\n\n \"{}\"\n\n valgrind stdout was:\n\n \"{}\"\n\n valgrind stderr was:\n\n \"{}\"", err, raw_xml, out.stdout, out.stderr);
|
||||||
});
|
// });
|
||||||
|
|
||||||
if !memory_errors.is_empty() {
|
// if !memory_errors.is_empty() {
|
||||||
for error in memory_errors {
|
// for error in memory_errors {
|
||||||
let ValgrindError {
|
// let ValgrindError {
|
||||||
kind,
|
// kind,
|
||||||
what: _,
|
// what: _,
|
||||||
xwhat,
|
// xwhat,
|
||||||
} = error;
|
// } = error;
|
||||||
println!("Valgrind Error: {kind}\n");
|
// println!("Valgrind Error: {kind}\n");
|
||||||
|
|
||||||
if let Some(ValgrindErrorXWhat {
|
// if let Some(ValgrindErrorXWhat {
|
||||||
text,
|
// text,
|
||||||
leakedbytes: _,
|
// leakedbytes: _,
|
||||||
leakedblocks: _,
|
// leakedblocks: _,
|
||||||
}) = xwhat
|
// }) = xwhat
|
||||||
{
|
// {
|
||||||
println!(" {text}");
|
// println!(" {text}");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
panic!("Valgrind reported memory errors");
|
// panic!("Valgrind reported memory errors");
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
let exit_code = match out.status.code() {
|
// let exit_code = match out.status.code() {
|
||||||
Some(code) => format!("exit code {code}"),
|
// Some(code) => format!("exit code {code}"),
|
||||||
None => "no exit code".to_string(),
|
// None => "no exit code".to_string(),
|
||||||
};
|
// };
|
||||||
|
|
||||||
panic!("`valgrind` exited with {}. valgrind stdout was: \"{}\"\n\nvalgrind stderr was: \"{}\"", exit_code, out.stdout, out.stderr);
|
// panic!("`valgrind` exited with {}. valgrind stdout was: \"{}\"\n\nvalgrind stderr was: \"{}\"", exit_code, out.stdout, out.stderr);
|
||||||
}
|
// }
|
||||||
|
|
||||||
output.push((cli_mode, out));
|
// output.push((cli_mode, out));
|
||||||
} else {
|
// } else {
|
||||||
let mut runner = Run::new_roc()
|
// let mut runner = Run::new_roc()
|
||||||
.arg(file.with_extension(file_ext).to_str().unwrap())
|
// .arg(file.with_extension(file_ext).to_str().unwrap())
|
||||||
.add_args(roc_app_args)
|
// .add_args(roc_app_args)
|
||||||
.with_stdin_vals(stdin.clone());
|
// .with_stdin_vals(stdin.clone());
|
||||||
|
|
||||||
for env in extra_env {
|
// for env in extra_env {
|
||||||
// this is funky, fix me
|
// // this is funky, fix me
|
||||||
runner.with_env([*env]);
|
// runner.with_env([*env]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
let out = runner.run();
|
// let out = runner.run();
|
||||||
|
|
||||||
out.assert_clean_success();
|
// out.assert_clean_success();
|
||||||
|
|
||||||
output.push((cli_mode, out));
|
// output.push((cli_mode, out));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
CliMode::Roc => {
|
// CliMode::Roc => {
|
||||||
let mut runner = Run::new_roc()
|
// let mut runner = Run::new_roc()
|
||||||
.arg(file)
|
// .arg(file)
|
||||||
.add_args(flags.clone())
|
// .add_args(flags.clone())
|
||||||
.add_args(roc_app_args)
|
// .add_args(roc_app_args)
|
||||||
.with_stdin_vals(stdin.clone());
|
// .with_stdin_vals(stdin.clone());
|
||||||
|
|
||||||
for env in extra_env {
|
// for env in extra_env {
|
||||||
// this is funky, fix me
|
// // this is funky, fix me
|
||||||
runner.with_env([*env]);
|
// runner.with_env([*env]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
let out = runner.run();
|
// let out = runner.run();
|
||||||
|
|
||||||
out.assert_clean_success();
|
// out.assert_clean_success();
|
||||||
|
|
||||||
output.push((cli_mode, out));
|
// output.push((cli_mode, out));
|
||||||
}
|
// }
|
||||||
CliMode::RocRun => {
|
// CliMode::RocRun => {
|
||||||
let mut runner = Run::new_roc()
|
// let mut runner = Run::new_roc()
|
||||||
.arg(CMD_RUN)
|
// .arg(CMD_RUN)
|
||||||
.add_args(flags.clone())
|
// .add_args(flags.clone())
|
||||||
.add_args(roc_app_args)
|
// .add_args(roc_app_args)
|
||||||
.arg(file)
|
// .arg(file)
|
||||||
.with_stdin_vals(stdin.clone());
|
// .with_stdin_vals(stdin.clone());
|
||||||
|
|
||||||
for env in extra_env {
|
// for env in extra_env {
|
||||||
// this is funky, fix me
|
// // this is funky, fix me
|
||||||
runner.with_env([*env]);
|
// runner.with_env([*env]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
let out = runner.run();
|
// let out = runner.run();
|
||||||
|
|
||||||
out.assert_clean_success();
|
// out.assert_clean_success();
|
||||||
|
|
||||||
output.push((cli_mode, out));
|
// output.push((cli_mode, out));
|
||||||
}
|
// }
|
||||||
CliMode::RocTest => {
|
// CliMode::RocTest => {
|
||||||
// here failure is what we expect
|
// // here failure is what we expect
|
||||||
|
|
||||||
let mut runner = Run::new_roc()
|
// let mut runner = Run::new_roc()
|
||||||
.arg(CMD_TEST)
|
// .arg(CMD_TEST)
|
||||||
.add_args(flags.clone())
|
// .add_args(flags.clone())
|
||||||
.add_args(roc_app_args)
|
// .add_args(roc_app_args)
|
||||||
.arg(file)
|
// .arg(file)
|
||||||
.with_stdin_vals(stdin.clone());
|
// .with_stdin_vals(stdin.clone());
|
||||||
|
|
||||||
for env in extra_env {
|
// for env in extra_env {
|
||||||
// this is funky, fix me
|
// // this is funky, fix me
|
||||||
runner.with_env([*env]);
|
// runner.with_env([*env]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
let out = runner.run();
|
// let out = runner.run();
|
||||||
|
|
||||||
out.assert_clean_success();
|
// out.assert_clean_success();
|
||||||
|
|
||||||
output.push((cli_mode, out));
|
// output.push((cli_mode, out));
|
||||||
}
|
// }
|
||||||
CliMode::RocDev => {
|
// CliMode::RocDev => {
|
||||||
// here failure is what we expect
|
// // here failure is what we expect
|
||||||
|
|
||||||
let mut runner = Run::new_roc()
|
// let mut runner = Run::new_roc()
|
||||||
.arg(file)
|
// .arg(file)
|
||||||
.add_args(iter::once(CMD_DEV).chain(flags.clone()))
|
// .add_args(iter::once(CMD_DEV).chain(flags.clone()))
|
||||||
.add_args(roc_app_args)
|
// .add_args(roc_app_args)
|
||||||
.with_stdin_vals(stdin.clone());
|
// .with_stdin_vals(stdin.clone());
|
||||||
|
|
||||||
for env in extra_env {
|
// for env in extra_env {
|
||||||
// this is funky, fix me
|
// // this is funky, fix me
|
||||||
runner.with_env([*env]);
|
// runner.with_env([*env]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
let out = runner.run();
|
// let out = runner.run();
|
||||||
|
|
||||||
out.assert_clean_success();
|
// out.assert_clean_success();
|
||||||
|
|
||||||
output.push((cli_mode, out));
|
// output.push((cli_mode, out));
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
output
|
// output
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// Run `roc test` to execute `expect`s, perhaps on a library rather than an application
|
/// Run `roc test` to execute `expect`s, perhaps on a library rather than an application
|
||||||
/// will use valgrind if it's supported
|
/// will use valgrind if it's supported
|
||||||
|
@ -357,28 +360,6 @@ mod cli_run {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when you don't need args, stdin or extra_env pizzazz.
|
|
||||||
fn test_roc_app_slim(
|
|
||||||
dir_name: &str,
|
|
||||||
roc_filename: &str,
|
|
||||||
expected_ending: &str,
|
|
||||||
use_valgrind: UseValgrind,
|
|
||||||
) {
|
|
||||||
let runner = Run::new_roc()
|
|
||||||
.arg(CMD_RUN)
|
|
||||||
.arg(file_path_from_root(dir_name, roc_filename).as_path());
|
|
||||||
|
|
||||||
if use_valgrind.and_is_supported() {
|
|
||||||
let out = runner.run_with_valgrind();
|
|
||||||
out.assert_clean_success();
|
|
||||||
out.assert_stdout_ends_with(expected_ending);
|
|
||||||
} else {
|
|
||||||
let out = runner.run();
|
|
||||||
out.assert_clean_success();
|
|
||||||
out.assert_stdout_ends_with(expected_ending);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn test_roc_app(
|
fn test_roc_app(
|
||||||
file_path: &Path,
|
file_path: &Path,
|
||||||
|
@ -391,6 +372,7 @@ mod cli_run {
|
||||||
) {
|
) {
|
||||||
let runner = Run::new_roc()
|
let runner = Run::new_roc()
|
||||||
.arg(CMD_RUN)
|
.arg(CMD_RUN)
|
||||||
|
.arg(BUILD_HOST_FLAG)
|
||||||
.arg(file_path)
|
.arg(file_path)
|
||||||
.add_args(args)
|
.add_args(args)
|
||||||
// TODO we should pipe this in here... just need to fix lifetimes
|
// TODO we should pipe this in here... just need to fix lifetimes
|
||||||
|
@ -412,12 +394,22 @@ mod cli_run {
|
||||||
#[serial(zig_platform_parser_package_basic_cli_url)]
|
#[serial(zig_platform_parser_package_basic_cli_url)]
|
||||||
#[cfg_attr(windows, ignore)]
|
#[cfg_attr(windows, ignore)]
|
||||||
fn hello_world() {
|
fn hello_world() {
|
||||||
test_roc_app_slim(
|
let expected_ending = "Hello, World!\n";
|
||||||
"examples",
|
let runner = Run::new_roc()
|
||||||
"helloWorld.roc",
|
.arg(CMD_RUN)
|
||||||
"Hello, World!\n",
|
.arg(BUILD_HOST_FLAG)
|
||||||
UseValgrind::Yes,
|
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||||
)
|
.arg(file_path_from_root("examples", "helloWorld.roc").as_path());
|
||||||
|
|
||||||
|
if ALLOW_VALGRIND {
|
||||||
|
let out = runner.run_with_valgrind();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
} else {
|
||||||
|
let out = runner.run();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
@ -429,12 +421,22 @@ mod cli_run {
|
||||||
#[cfg_attr(windows, ignore)]
|
#[cfg_attr(windows, ignore)]
|
||||||
// uses C platform
|
// uses C platform
|
||||||
fn platform_switching_main() {
|
fn platform_switching_main() {
|
||||||
test_roc_app_slim(
|
let expected_ending = &("Which platform am I running on now?".to_string() + LINE_ENDING);
|
||||||
"examples/platform-switching",
|
let runner = Run::new_roc()
|
||||||
"main.roc",
|
.arg(CMD_RUN)
|
||||||
&("Which platform am I running on now?".to_string() + LINE_ENDING),
|
.arg(BUILD_HOST_FLAG)
|
||||||
UseValgrind::Yes,
|
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||||
)
|
.arg(file_path_from_root("examples/platform-switching", "main.roc").as_path());
|
||||||
|
|
||||||
|
if ALLOW_VALGRIND {
|
||||||
|
let out = runner.run_with_valgrind();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
} else {
|
||||||
|
let out = runner.run();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We exclude the C platforming switching example
|
// We exclude the C platforming switching example
|
||||||
|
@ -444,12 +446,22 @@ mod cli_run {
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(windows, ignore)]
|
#[cfg_attr(windows, ignore)]
|
||||||
fn platform_switching_rust() {
|
fn platform_switching_rust() {
|
||||||
test_roc_app_slim(
|
let expected_ending = "Roc <3 Rust!\n";
|
||||||
"examples/platform-switching",
|
let runner = Run::new_roc()
|
||||||
"rocLovesRust.roc",
|
.arg(CMD_RUN)
|
||||||
"Roc <3 Rust!\n",
|
.arg(BUILD_HOST_FLAG)
|
||||||
UseValgrind::Yes,
|
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||||
)
|
.arg(file_path_from_root("examples/platform-switching", "rocLovesRust.roc").as_path());
|
||||||
|
|
||||||
|
if ALLOW_VALGRIND {
|
||||||
|
let out = runner.run_with_valgrind();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
} else {
|
||||||
|
let out = runner.run();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// zig_platform_parser_package_basic_cli_url use to be split up but then things could get stuck
|
// zig_platform_parser_package_basic_cli_url use to be split up but then things could get stuck
|
||||||
|
@ -457,12 +469,22 @@ mod cli_run {
|
||||||
#[serial(zig_platform_parser_package_basic_cli_url)]
|
#[serial(zig_platform_parser_package_basic_cli_url)]
|
||||||
#[cfg_attr(windows, ignore)]
|
#[cfg_attr(windows, ignore)]
|
||||||
fn platform_switching_zig() {
|
fn platform_switching_zig() {
|
||||||
test_roc_app_slim(
|
let expected_ending = "Roc <3 Zig!\n";
|
||||||
"examples/platform-switching",
|
let runner = Run::new_roc()
|
||||||
"rocLovesZig.roc",
|
.arg(CMD_RUN)
|
||||||
"Roc <3 Zig!\n",
|
.arg(BUILD_HOST_FLAG)
|
||||||
UseValgrind::Yes,
|
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||||
)
|
.arg(file_path_from_root("examples/platform-switching", "rocLovesZig.roc").as_path());
|
||||||
|
|
||||||
|
if ALLOW_VALGRIND {
|
||||||
|
let out = runner.run_with_valgrind();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
} else {
|
||||||
|
let out = runner.run();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -649,12 +671,18 @@ mod cli_run {
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(windows, ignore)]
|
#[cfg_attr(windows, ignore)]
|
||||||
fn platform_requires_pkg() {
|
fn platform_requires_pkg() {
|
||||||
test_roc_app_slim(
|
let expected_ending = "from app from package";
|
||||||
"crates/cli/tests/platform_requires_pkg",
|
let runner = Run::new_roc()
|
||||||
"app.roc",
|
.arg(CMD_RUN)
|
||||||
"from app from package",
|
.arg(BUILD_HOST_FLAG)
|
||||||
UseValgrind::No,
|
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||||
)
|
.arg(
|
||||||
|
file_path_from_root("crates/cli/tests/platform_requires_pkg", "app.roc").as_path(),
|
||||||
|
);
|
||||||
|
|
||||||
|
let out = runner.run();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -697,24 +725,44 @@ mod cli_run {
|
||||||
ignore = "Flaky failure: Roc command failed with status ExitStatus(ExitStatus(3221225477))"
|
ignore = "Flaky failure: Roc command failed with status ExitStatus(ExitStatus(3221225477))"
|
||||||
)]
|
)]
|
||||||
fn fibonacci() {
|
fn fibonacci() {
|
||||||
test_roc_app_slim(
|
let expected_ending = "";
|
||||||
"crates/cli/tests/algorithms",
|
let runner = Run::new_roc()
|
||||||
"fibonacci.roc",
|
.arg(CMD_RUN)
|
||||||
"",
|
.arg(BUILD_HOST_FLAG)
|
||||||
UseValgrind::Yes,
|
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||||
)
|
.arg(file_path_from_root("crates/cli/tests/algorithms", "fibonacci.roc").as_path());
|
||||||
|
|
||||||
|
if ALLOW_VALGRIND {
|
||||||
|
let out = runner.run_with_valgrind();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
} else {
|
||||||
|
let out = runner.run();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[ignore = "TODO move this to roc-lang/examples repository"]
|
#[ignore = "TODO move this to roc-lang/examples repository"]
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(windows, ignore)]
|
#[cfg_attr(windows, ignore)]
|
||||||
fn quicksort() {
|
fn quicksort() {
|
||||||
test_roc_app_slim(
|
let expected_ending = "[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2]\n";
|
||||||
"crates/cli/tests/algorithms",
|
let runner = Run::new_roc()
|
||||||
"quicksort.roc",
|
.arg(CMD_RUN)
|
||||||
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2]\n",
|
.arg(BUILD_HOST_FLAG)
|
||||||
UseValgrind::Yes,
|
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||||
)
|
.arg(file_path_from_root("crates/cli/tests/algorithms", "quicksort.roc").as_path());
|
||||||
|
|
||||||
|
if ALLOW_VALGRIND {
|
||||||
|
let out = runner.run_with_valgrind();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
} else {
|
||||||
|
let out = runner.run();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: write a new test once mono bugs are resolved in investigation
|
// TODO: write a new test once mono bugs are resolved in investigation
|
||||||
|
@ -978,36 +1026,54 @@ mod cli_run {
|
||||||
#[serial(zig_platform_parser_package_basic_cli_url)]
|
#[serial(zig_platform_parser_package_basic_cli_url)]
|
||||||
#[cfg_attr(windows, ignore)]
|
#[cfg_attr(windows, ignore)]
|
||||||
fn parse_movies_csv() {
|
fn parse_movies_csv() {
|
||||||
test_roc_app_slim(
|
let expected_ending = "2 movies were found:\n\nThe movie 'Airplane!' was released in 1980 and stars Robert Hays and Julie Hagerty\nThe movie 'Caddyshack' was released in 1980 and stars Chevy Chase, Rodney Dangerfield, Ted Knight, Michael O'Keefe and Bill Murray\n\nParse success!\n\n";
|
||||||
"crates/cli/tests/cli",
|
let runner = Run::new_roc()
|
||||||
"parser-movies-csv.roc",
|
.arg(CMD_RUN)
|
||||||
"2 movies were found:\n\nThe movie 'Airplane!' was released in 1980 and stars Robert Hays and Julie Hagerty\nThe movie 'Caddyshack' was released in 1980 and stars Chevy Chase, Rodney Dangerfield, Ted Knight, Michael O'Keefe and Bill Murray\n\nParse success!\n\n",
|
.arg(BUILD_HOST_FLAG)
|
||||||
UseValgrind::No,
|
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||||
)
|
.arg(file_path_from_root("crates/cli/tests/cli", "parser-movies-csv.roc").as_path());
|
||||||
|
|
||||||
|
let out = runner.run();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[serial(zig_platform_parser_package_basic_cli_url)]
|
#[serial(zig_platform_parser_package_basic_cli_url)]
|
||||||
#[cfg_attr(windows, ignore)]
|
#[cfg_attr(windows, ignore)]
|
||||||
fn parse_letter_counts() {
|
fn parse_letter_counts() {
|
||||||
test_roc_app_slim(
|
let expected_ending = "I counted 7 letter A's!\n";
|
||||||
"crates/cli/tests/cli",
|
let runner = Run::new_roc()
|
||||||
"parser-letter-counts.roc",
|
.arg(CMD_RUN)
|
||||||
"I counted 7 letter A's!\n",
|
.arg(BUILD_HOST_FLAG)
|
||||||
UseValgrind::No,
|
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||||
)
|
.arg(file_path_from_root("crates/cli/tests/cli", "parser-letter-counts.roc").as_path());
|
||||||
|
|
||||||
|
let out = runner.run();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(windows, ignore)]
|
#[cfg_attr(windows, ignore)]
|
||||||
fn inspect_logging() {
|
fn inspect_logging() {
|
||||||
test_roc_app_slim(
|
let expected_ending = r#"(@Community {friends: [{2}, {2}, {0, 1}], people: [(@Person {age: 27, favoriteColor: Blue, firstName: "John", hasBeard: Bool.true, lastName: "Smith"}), (@Person {age: 47, favoriteColor: Green, firstName: "Debby", hasBeard: Bool.false, lastName: "Johnson"}), (@Person {age: 33, favoriteColor: (RGB (255, 255, 0)), firstName: "Jane", hasBeard: Bool.false, lastName: "Doe"})]})
|
||||||
"examples",
|
"#;
|
||||||
"inspect-logging.roc",
|
let runner = Run::new_roc()
|
||||||
r#"(@Community {friends: [{2}, {2}, {0, 1}], people: [(@Person {age: 27, favoriteColor: Blue, firstName: "John", hasBeard: Bool.true, lastName: "Smith"}), (@Person {age: 47, favoriteColor: Green, firstName: "Debby", hasBeard: Bool.false, lastName: "Johnson"}), (@Person {age: 33, favoriteColor: (RGB (255, 255, 0)), firstName: "Jane", hasBeard: Bool.false, lastName: "Doe"})]})
|
.arg(CMD_RUN)
|
||||||
"#,
|
.arg(BUILD_HOST_FLAG)
|
||||||
UseValgrind::Yes,
|
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
|
||||||
)
|
.arg(file_path_from_root("examples", "inspect-logging.roc").as_path());
|
||||||
|
|
||||||
|
if ALLOW_VALGRIND {
|
||||||
|
let out = runner.run_with_valgrind();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
} else {
|
||||||
|
let out = runner.run();
|
||||||
|
out.assert_clean_success();
|
||||||
|
out.assert_stdout_ends_with(expected_ending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO not sure if this cfg should still be here: #[cfg(not(debug_assertions))]
|
// TODO not sure if this cfg should still be here: #[cfg(not(debug_assertions))]
|
||||||
|
@ -1021,7 +1087,7 @@ mod cli_run {
|
||||||
use roc_cli::CMD_BUILD;
|
use roc_cli::CMD_BUILD;
|
||||||
|
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use super::{check_output_with_stdin, OPTIMIZE_FLAG};
|
use super::OPTIMIZE_FLAG;
|
||||||
|
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use std::{path::Path, sync::Once};
|
use std::{path::Path, sync::Once};
|
||||||
|
@ -1100,28 +1166,28 @@ mod cli_run {
|
||||||
|
|
||||||
if !ran_without_optimizations {
|
if !ran_without_optimizations {
|
||||||
// Check with and without optimizations
|
// Check with and without optimizations
|
||||||
check_output_with_stdin(
|
// check_output_with_stdin(
|
||||||
file_name,
|
// file_name,
|
||||||
stdin,
|
// stdin,
|
||||||
&[],
|
// &[],
|
||||||
&[],
|
// &[],
|
||||||
&[],
|
// &[],
|
||||||
expected_ending,
|
// expected_ending,
|
||||||
use_valgrind,
|
// use_valgrind,
|
||||||
TestCliCommands::Run,
|
// TestCliCommands::Run,
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
check_output_with_stdin(
|
// check_output_with_stdin(
|
||||||
file_name,
|
// file_name,
|
||||||
stdin,
|
// stdin,
|
||||||
&[OPTIMIZE_FLAG],
|
// &[FLAG_OPTIMIZE],
|
||||||
&[],
|
// &[],
|
||||||
&[],
|
// &[],
|
||||||
expected_ending,
|
// expected_ending,
|
||||||
use_valgrind,
|
// use_valgrind,
|
||||||
TestCliCommands::Run,
|
// TestCliCommands::Run,
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "wasm32-cli-run")]
|
#[cfg(feature = "wasm32-cli-run")]
|
||||||
|
|
|
@ -714,6 +714,7 @@ pub fn build_file<'a>(
|
||||||
link_type: LinkType,
|
link_type: LinkType,
|
||||||
linking_strategy: LinkingStrategy,
|
linking_strategy: LinkingStrategy,
|
||||||
build_host: bool,
|
build_host: bool,
|
||||||
|
supress_build_host_warning: bool,
|
||||||
wasm_dev_stack_bytes: Option<u32>,
|
wasm_dev_stack_bytes: Option<u32>,
|
||||||
roc_cache_dir: RocCacheDir<'_>,
|
roc_cache_dir: RocCacheDir<'_>,
|
||||||
load_config: LoadConfig,
|
load_config: LoadConfig,
|
||||||
|
@ -739,6 +740,7 @@ pub fn build_file<'a>(
|
||||||
link_type,
|
link_type,
|
||||||
linking_strategy,
|
linking_strategy,
|
||||||
build_host,
|
build_host,
|
||||||
|
supress_build_host_warning,
|
||||||
wasm_dev_stack_bytes,
|
wasm_dev_stack_bytes,
|
||||||
loaded,
|
loaded,
|
||||||
compilation_start,
|
compilation_start,
|
||||||
|
@ -811,6 +813,7 @@ fn build_loaded_file<'a>(
|
||||||
link_type: LinkType,
|
link_type: LinkType,
|
||||||
linking_strategy: LinkingStrategy,
|
linking_strategy: LinkingStrategy,
|
||||||
build_host_requested: bool,
|
build_host_requested: bool,
|
||||||
|
supress_build_host_warning: bool,
|
||||||
wasm_dev_stack_bytes: Option<u32>,
|
wasm_dev_stack_bytes: Option<u32>,
|
||||||
loaded: roc_load::MonomorphizedModule<'a>,
|
loaded: roc_load::MonomorphizedModule<'a>,
|
||||||
compilation_start: Instant,
|
compilation_start: Instant,
|
||||||
|
@ -856,7 +859,9 @@ fn build_loaded_file<'a>(
|
||||||
// The following 3 cases we currently support for host rebuilding. Emit a deprecation
|
// The following 3 cases we currently support for host rebuilding. Emit a deprecation
|
||||||
// warning and rebuild the host.
|
// warning and rebuild the host.
|
||||||
(Ok(existing_legacy_host), _, true, LinkType::Executable) => {
|
(Ok(existing_legacy_host), _, true, LinkType::Executable) => {
|
||||||
|
if !supress_build_host_warning {
|
||||||
report_rebuilding_existing_host(&existing_legacy_host.to_string_lossy());
|
report_rebuilding_existing_host(&existing_legacy_host.to_string_lossy());
|
||||||
|
}
|
||||||
build_and_preprocess_host(
|
build_and_preprocess_host(
|
||||||
code_gen_options,
|
code_gen_options,
|
||||||
dll_stub_symbols,
|
dll_stub_symbols,
|
||||||
|
@ -875,7 +880,9 @@ fn build_loaded_file<'a>(
|
||||||
true,
|
true,
|
||||||
LinkType::Executable,
|
LinkType::Executable,
|
||||||
) => {
|
) => {
|
||||||
|
if !supress_build_host_warning {
|
||||||
report_rebuilding_existing_host(&preprocessed_host.to_string_lossy());
|
report_rebuilding_existing_host(&preprocessed_host.to_string_lossy());
|
||||||
|
}
|
||||||
build_and_preprocess_host(
|
build_and_preprocess_host(
|
||||||
code_gen_options,
|
code_gen_options,
|
||||||
dll_stub_symbols,
|
dll_stub_symbols,
|
||||||
|
@ -1425,6 +1432,9 @@ pub fn build_str_test<'a>(
|
||||||
)
|
)
|
||||||
.map_err(|e| BuildFileError::from_mono_error(e, compilation_start))?;
|
.map_err(|e| BuildFileError::from_mono_error(e, compilation_start))?;
|
||||||
|
|
||||||
|
// we are in a test, so we don't need to provide a warning about rebuilding the host
|
||||||
|
let supress_build_host_warning = true;
|
||||||
|
|
||||||
build_loaded_file(
|
build_loaded_file(
|
||||||
arena,
|
arena,
|
||||||
target,
|
target,
|
||||||
|
@ -1434,6 +1444,7 @@ pub fn build_str_test<'a>(
|
||||||
link_type,
|
link_type,
|
||||||
linking_strategy,
|
linking_strategy,
|
||||||
build_host_requested,
|
build_host_requested,
|
||||||
|
supress_build_host_warning,
|
||||||
wasm_dev_stack_bytes,
|
wasm_dev_stack_bytes,
|
||||||
loaded,
|
loaded,
|
||||||
compilation_start,
|
compilation_start,
|
||||||
|
|
|
@ -77,6 +77,11 @@ pub fn generate(
|
||||||
|
|
||||||
let tempdir_res = tempfile::tempdir();
|
let tempdir_res = tempfile::tempdir();
|
||||||
|
|
||||||
|
// TODO confirm these are the correct parameters to pass down.
|
||||||
|
// are we building a host here in glue generation?
|
||||||
|
let build_host = true;
|
||||||
|
let supress_build_host_warning = true;
|
||||||
|
|
||||||
let res_binary_path = match tempdir_res {
|
let res_binary_path = match tempdir_res {
|
||||||
Ok(dylib_dir) => build_file(
|
Ok(dylib_dir) => build_file(
|
||||||
&arena,
|
&arena,
|
||||||
|
@ -86,7 +91,8 @@ pub fn generate(
|
||||||
false,
|
false,
|
||||||
link_type,
|
link_type,
|
||||||
linking_strategy,
|
linking_strategy,
|
||||||
true,
|
build_host,
|
||||||
|
supress_build_host_warning,
|
||||||
None,
|
None,
|
||||||
RocCacheDir::Persistent(cache::roc_cache_dir().as_path()),
|
RocCacheDir::Persistent(cache::roc_cache_dir().as_path()),
|
||||||
load_config,
|
load_config,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue