cli_run test fixes

This commit is contained in:
Anton-4 2022-09-24 20:14:59 +02:00
parent 076190a217
commit 1d9a751606
No known key found for this signature in database
GPG key ID: A13F4A6E21141925
4 changed files with 19 additions and 4 deletions

View file

@ -10,7 +10,7 @@ extern crate roc_module;
#[cfg(test)]
mod cli_run {
use cli_utils::helpers::{
example_file, examples_dir, extract_valgrind_errors, fixture_file, fixtures_dir,
example_file, examples_dir, cli_testing_dir, extract_valgrind_errors, fixture_file, fixtures_dir,
known_bad_file, run_cmd, run_roc, run_with_valgrind, strip_colors, Out, ValgrindError,
ValgrindErrorXWhat,
};
@ -115,6 +115,7 @@ mod cli_run {
stdin: &[&str],
app_args: &[String],
) -> Out {
dbg!(file);
let compile_out = run_roc(
// converting these all to String avoids lifetime issues
args.into_iter()
@ -584,7 +585,7 @@ mod cli_run {
// expected_ending: "successfully wrote to file\n",
// use_valgrind: true,
// },
false_interpreter:"false-interpreter" => {
false_interpreter:"cli/false-interpreter" => {
Example {
filename: "False.roc",
executable_filename: "false",
@ -623,7 +624,7 @@ mod cli_run {
#[cfg(all(not(feature = "wasm32-cli-run"), not(feature = "i386-cli-run")))]
fn $test_name() {
let benchmark = $benchmark;
let file_name = examples_dir("benchmarks").join(benchmark.filename);
let file_name = cli_testing_dir("benchmarks").join(benchmark.filename);
// TODO fix QuicksortApp and then remove this!
match benchmark.filename {

View file

@ -359,6 +359,19 @@ pub fn root_dir() -> PathBuf {
path
}
// start the dir with crates/cli_testing_examples
#[allow(dead_code)]
pub fn cli_testing_dir(dir_name: &str) -> PathBuf {
let mut path = root_dir();
// Descend into examples/{dir_name}
path.push("crates");
path.push("cli_testing_examples");
path.extend(dir_name.split("/")); // Make slashes cross-target
path
}
#[allow(dead_code)]
pub fn examples_dir(dir_name: &str) -> PathBuf {
let mut path = root_dir();

View file

@ -635,6 +635,7 @@ pub fn rebuild_host(
} else if cargo_host_src.exists() {
// Compile and link Cargo.toml, if it exists
let cargo_dir = host_input_path.parent().unwrap();
let cargo_out_dir = cargo_dir.join("target").join(
if matches!(opt_level, OptLevel::Optimize | OptLevel::Size) {
"release"

View file

@ -17,7 +17,7 @@ name = "host"
path = "src/main.rs"
[dependencies]
roc_std = { path = "../../../crates/roc_std" }
roc_std = { path = "../../../../crates/roc_std" }
libc = "0.2"
[workspace]