stuck on Only 64bit little endian elf currently...

This commit is contained in:
Anton-4 2024-10-12 19:47:16 +02:00
parent 0659abdc40
commit 7dfa469ea8
No known key found for this signature in database
GPG key ID: 0971D718C0A9B937
7 changed files with 320 additions and 316 deletions

View file

@ -32,7 +32,7 @@ mod cli_tests {
}
const OPTIMIZE_FLAG: &str = concatcp!("--", roc_cli::FLAG_OPTIMIZE);
const LINKER_FLAG: &str = concatcp!("--", roc_cli::FLAG_LINKER, "=", "legacy");
const LEGACY_LINKER_FLAG: &str = concatcp!("--", roc_cli::FLAG_LINKER, "=", "legacy");
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);
@ -168,13 +168,14 @@ mod cli_tests {
cli_build.full_check_build_and_run(expected_output, TEST_LEGACY_LINKER, ALLOW_VALGRIND, Some("foo\n"), None);
}
// TODO re-enable before merging
// TODO check this out, there's more that's going wrong than a segfault
#[test]
//#[test]
/*#[cfg_attr(
any(target_os = "windows", target_os = "linux", target_os = "macos"),
ignore = "Segfault, likely broken because of alias analysis: https://github.com/roc-lang/roc/issues/6544"
)]*/
/*
fn false_interpreter() {
let cli_build = ExecCli::new(
CMD_BUILD,
@ -192,7 +193,7 @@ mod cli_tests {
.unwrap()];
cli_build.full_check_build_and_run("1414", TEST_LEGACY_LINKER, ALLOW_VALGRIND, None, Some(&app_args));
}
}*/
#[test]
#[cfg_attr(windows, ignore)]
@ -259,6 +260,315 @@ mod cli_tests {
let cli_test_out = cli_test.run();
insta::assert_snapshot!(cli_test_out.normalize_stdout_and_stderr());
}
mod test_platform_simple_zig {
use super::*;
use roc_cli::{CMD_BUILD, CMD_DEV, CMD_RUN, CMD_TEST};
static BUILD_PLATFORM_HOST: std::sync::Once = std::sync::Once::new();
/// Build the platform host once for all tests in this module
fn build_platform_host() {
BUILD_PLATFORM_HOST.call_once(|| {
let cli_build = ExecCli::new(
CMD_BUILD,
file_from_root("crates/cli/tests/test-projects/test-platform-simple-zig", "app.roc")
)
.arg(BUILD_HOST_FLAG)
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
.arg(OPTIMIZE_FLAG);
let cli_build_out = cli_build.run();
cli_build_out.assert_clean_success();
if TEST_LEGACY_LINKER {
let cli_build_legacy = cli_build.arg(LEGACY_LINKER_FLAG);
let cli_build_legacy_out = cli_build_legacy.run();
cli_build_legacy_out.assert_clean_success();
}
});
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_multi_dep_str_unoptimized() {
build_platform_host();
let cli_build = ExecCli::new(
CMD_BUILD,
file_from_root("crates/cli/tests/test-projects/fixtures/multi-dep-str", "main.roc")
);
let expected_output = "I am Dep2.str2\n";
cli_build.full_check_build_and_run(expected_output, TEST_LEGACY_LINKER, ALLOW_VALGRIND, None, None);
}
/*
#[test]
#[cfg_attr(windows, ignore)]
fn run_multi_dep_str_optimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.arg(OPTIMIZE_FLAG)
.add_arg_if(LEGACY_LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(
file_from_root("crates/cli/tests/fixtures/multi-dep-str", "Main.roc").as_path(),
);
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_multi_dep_thunk_unoptimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.add_arg_if(LEGACY_LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(
file_from_root("crates/cli/tests/fixtures/multi-dep-thunk", "Main.roc")
.as_path(),
);
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(
windows,
ignore = "Flaky failure: Roc command failed with status ExitStatus(ExitStatus(3221225477))"
)]
fn run_multi_dep_thunk_optimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.arg(OPTIMIZE_FLAG)
.add_arg_if(LEGACY_LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(
file_from_root("crates/cli/tests/fixtures/multi-dep-thunk", "Main.roc")
.as_path(),
);
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_packages_unoptimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.add_arg_if(LEGACY_LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_from_root("crates/cli/tests/fixtures/packages", "app.roc").as_path());
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_packages_optimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.arg(OPTIMIZE_FLAG)
.add_arg_if(LEGACY_LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_from_root("crates/cli/tests/fixtures/packages", "app.roc").as_path());
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_transitive_deps_app() {
build_platform_host();
let file_path = file_from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-one.roc",
);
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.add_arg_if(LEGACY_LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_path.as_path());
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_transitive_and_direct_dep_app() {
build_platform_host();
let file_path = file_from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-one-and-two.roc",
);
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.add_arg_if(LEGACY_LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_path.as_path());
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_double_transitive_dep_app() {
build_platform_host();
let file_path = file_from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-zero.roc",
);
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.add_arg_if(LEGACY_LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_path.as_path());
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
fn expects_dev() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_DEV)
.add_arg_if(LEGACY_LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_from_root("crates/cli/tests/expects", "expects.roc").as_path());
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
fn expects_test() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_TEST)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_from_root("crates/cli/tests/expects", "expects.roc").as_path());
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn module_params() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.arg(file_from_root("crates/cli/tests/module_params", "app.roc").as_path());
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn module_params_arity_mismatch() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc().arg(CMD_DEV).arg(
file_from_root("crates/cli/tests/module_params", "arity_mismatch.roc").as_path(),
);
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn module_params_bad_ann() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_DEV)
.arg(file_from_root("crates/cli/tests/module_params", "bad_ann.roc").as_path());
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn module_params_multiline_pattern() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc().arg(CMD_DEV).arg(
file_from_root("crates/cli/tests/module_params", "multiline_params.roc").as_path(),
);
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn module_params_unexpected_fn() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc().arg(CMD_DEV).arg(
file_from_root("crates/cli/tests/module_params", "unexpected_fn.roc").as_path(),
);
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}*/
}
/*
#[test]
#[cfg_attr(windows, ignore)]
@ -386,315 +696,6 @@ mod cli_tests {
}
}
mod test_platform_simple_zig {
use super::*;
use cli_test_utils::helpers::{file_from_root, ExecCli};
use roc_cli::{CMD_BUILD, CMD_DEV, CMD_RUN, CMD_TEST};
static BUILD_PLATFORM_HOST: std::sync::Once = std::sync::Once::new();
/// Build the platform host once for all tests in this module
fn build_platform_host() {
BUILD_PLATFORM_HOST.call_once(|| {
let out = ExecCli::new_roc()
.arg(CMD_BUILD)
.arg(BUILD_HOST_FLAG)
.arg(OPTIMIZE_FLAG)
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.arg(
file_from_root("crates/cli/tests/test-platform-simple-zig", "app.roc")
.as_path(),
)
.run();
out.assert_clean_success();
});
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_multi_dep_str_unoptimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(roc_cli::CMD_RUN)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(
file_from_root("crates/cli/tests/fixtures/multi-dep-str", "Main.roc").as_path(),
);
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_multi_dep_str_optimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.arg(OPTIMIZE_FLAG)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(
file_from_root("crates/cli/tests/fixtures/multi-dep-str", "Main.roc").as_path(),
);
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_multi_dep_thunk_unoptimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(
file_from_root("crates/cli/tests/fixtures/multi-dep-thunk", "Main.roc")
.as_path(),
);
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(
windows,
ignore = "Flaky failure: Roc command failed with status ExitStatus(ExitStatus(3221225477))"
)]
fn run_multi_dep_thunk_optimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.arg(OPTIMIZE_FLAG)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(
file_from_root("crates/cli/tests/fixtures/multi-dep-thunk", "Main.roc")
.as_path(),
);
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_packages_unoptimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_from_root("crates/cli/tests/fixtures/packages", "app.roc").as_path());
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_packages_optimized() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.arg(OPTIMIZE_FLAG)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_from_root("crates/cli/tests/fixtures/packages", "app.roc").as_path());
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_transitive_deps_app() {
build_platform_host();
let file_path = file_from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-one.roc",
);
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_path.as_path());
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_transitive_and_direct_dep_app() {
build_platform_host();
let file_path = file_from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-one-and-two.roc",
);
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_path.as_path());
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_double_transitive_dep_app() {
build_platform_host();
let file_path = file_from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-zero.roc",
);
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_path.as_path());
let out = runner.run();
out.assert_clean_success();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
fn expects_dev() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_DEV)
.add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_from_root("crates/cli/tests/expects", "expects.roc").as_path());
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
fn expects_test() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_TEST)
.with_valgrind(ALLOW_VALGRIND)
.arg(file_from_root("crates/cli/tests/expects", "expects.roc").as_path());
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn module_params() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_RUN)
.arg(file_from_root("crates/cli/tests/module_params", "app.roc").as_path());
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn module_params_arity_mismatch() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc().arg(CMD_DEV).arg(
file_from_root("crates/cli/tests/module_params", "arity_mismatch.roc").as_path(),
);
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn module_params_bad_ann() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc()
.arg(CMD_DEV)
.arg(file_from_root("crates/cli/tests/module_params", "bad_ann.roc").as_path());
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn module_params_multiline_pattern() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc().arg(CMD_DEV).arg(
file_from_root("crates/cli/tests/module_params", "multiline_params.roc").as_path(),
);
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
#[test]
#[cfg_attr(windows, ignore)]
fn module_params_unexpected_fn() {
build_platform_host();
let runner = cli_test_utils::helpers::ExecCli::new_roc().arg(CMD_DEV).arg(
file_from_root("crates/cli/tests/module_params", "unexpected_fn.roc").as_path(),
);
let out = runner.run();
insta::assert_snapshot!(out.normalize_stdout_and_stderr());
}
}
// TODO not sure if this cfg should still be here: #[cfg(not(debug_assertions))]
// this is for testing the benchmarks, to perform proper benchmarks see crates/cli/benches/README.md
mod test_benchmarks {

View file

@ -1459,6 +1459,7 @@ pub fn load<'a>(
Many(usize),
}
/*
let threads = {
if cfg!(target_family = "wasm") {
// When compiling to wasm, we cannot spawn extra threads
@ -1476,7 +1477,9 @@ pub fn load<'a>(
},
}
}
};
};*/
// TODO temp for debugging
let threads = Threads::Single;
match threads {
Threads::Single => load_single_threaded(

View file

@ -12,9 +12,9 @@
# - update nightly-OLD_DATE in .github/workflows/windows_release_build.yml
# - update nightly-OLD_DATE in crates/compiler/build/src/link.rs
channel = "1.77.2" # check ^^^ when changing this
#channel = "1.77.2" # check ^^^ when changing this
#
# channel = "nightly-2024-02-03" # 1.77.0 nightly to be able to use unstable features
channel = "nightly-2024-02-03" # 1.77.0 nightly to be able to use unstable features
profile = "default"
components = [
# for usages of rust-analyzer or similar tools inside `nix develop`