mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
minor cleanup
This commit is contained in:
parent
9442a32a65
commit
9a3495cfae
3 changed files with 15 additions and 23 deletions
|
@ -202,7 +202,6 @@ mod cli_tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO re-enable before merging
|
|
||||||
// TODO check this out, there's more that's going wrong than a segfault
|
// TODO check this out, there's more that's going wrong than a segfault
|
||||||
//#[test]
|
//#[test]
|
||||||
/*#[cfg_attr(
|
/*#[cfg_attr(
|
||||||
|
@ -958,7 +957,7 @@ mod cli_tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is for testing the benchmarks, to perform proper benchmarks see crates/cli/benches/README.md
|
// this is for testing the benchmarks (on small inputs), to perform proper benchmarks see crates/cli/benches/README.md
|
||||||
mod test_benchmarks {
|
mod test_benchmarks {
|
||||||
use super::{
|
use super::{
|
||||||
UseValgrind, ALLOW_VALGRIND, BUILD_HOST_FLAG, OPTIMIZE_FLAG,
|
UseValgrind, ALLOW_VALGRIND, BUILD_HOST_FLAG, OPTIMIZE_FLAG,
|
||||||
|
@ -1034,8 +1033,6 @@ mod cli_tests {
|
||||||
expected_output: &'static str,
|
expected_output: &'static str,
|
||||||
stdin_opt: Option<&'static str>,
|
stdin_opt: Option<&'static str>,
|
||||||
) {
|
) {
|
||||||
dbg!("yo");
|
|
||||||
use super::{concatcp, TARGET_FLAG};
|
|
||||||
// Check with and without optimizations
|
// Check with and without optimizations
|
||||||
run_wasm_check_output_with_flags(
|
run_wasm_check_output_with_flags(
|
||||||
roc_file_path,
|
roc_file_path,
|
||||||
|
@ -1060,7 +1057,6 @@ mod cli_tests {
|
||||||
flags: &[&str],
|
flags: &[&str],
|
||||||
) {
|
) {
|
||||||
use super::{concatcp, TARGET_FLAG};
|
use super::{concatcp, TARGET_FLAG};
|
||||||
dbg!("hey");
|
|
||||||
|
|
||||||
let mut flags = flags.to_vec();
|
let mut flags = flags.to_vec();
|
||||||
flags.push(concatcp!(TARGET_FLAG, "=wasm32"));
|
flags.push(concatcp!(TARGET_FLAG, "=wasm32"));
|
||||||
|
@ -1069,7 +1065,6 @@ mod cli_tests {
|
||||||
|
|
||||||
let cli_build_out = cli_build.run();
|
let cli_build_out = cli_build.run();
|
||||||
cli_build_out.assert_clean_success();
|
cli_build_out.assert_clean_success();
|
||||||
dbg!("clean success");
|
|
||||||
|
|
||||||
// wasm can't take stdin, so we pass it as an arg
|
// wasm can't take stdin, so we pass it as an arg
|
||||||
let wasm_args = if let Some(stdin) = stdin_opt {
|
let wasm_args = if let Some(stdin) = stdin_opt {
|
||||||
|
@ -1078,16 +1073,11 @@ mod cli_tests {
|
||||||
vec![]
|
vec![]
|
||||||
};
|
};
|
||||||
|
|
||||||
dbg!("pre wasm_run_out");
|
|
||||||
|
|
||||||
let wasm_run_out = crate::run_wasm_for_cli_test(
|
let wasm_run_out = crate::run_wasm_for_cli_test(
|
||||||
&roc_file_path.with_extension("wasm"),
|
&roc_file_path.with_extension("wasm"),
|
||||||
wasm_args.clone(),
|
wasm_args.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
dbg!("post wasm_run_out");
|
|
||||||
|
|
||||||
dbg!(&wasm_run_out);
|
|
||||||
assert_eq!(wasm_run_out, expected_output);
|
assert_eq!(wasm_run_out, expected_output);
|
||||||
|
|
||||||
if TEST_LEGACY_LINKER {
|
if TEST_LEGACY_LINKER {
|
||||||
|
@ -1392,7 +1382,6 @@ mod cli_tests {
|
||||||
|
|
||||||
#[cfg(feature = "wasm32-cli-run")]
|
#[cfg(feature = "wasm32-cli-run")]
|
||||||
fn run_wasm_for_cli_test(wasm_path: &std::path::Path, stdin: Vec<&str>) -> String {
|
fn run_wasm_for_cli_test(wasm_path: &std::path::Path, stdin: Vec<&str>) -> String {
|
||||||
dbg!("in run_wasm222");
|
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use roc_wasm_interp::{DefaultImportDispatcher, Instance, Value, WasiFile};
|
use roc_wasm_interp::{DefaultImportDispatcher, Instance, Value, WasiFile};
|
||||||
|
|
||||||
|
@ -1403,10 +1392,17 @@ fn run_wasm_for_cli_test(wasm_path: &std::path::Path, stdin: Vec<&str>) -> Strin
|
||||||
let mut fake_stdin = vec![];
|
let mut fake_stdin = vec![];
|
||||||
let fake_stdout = vec![];
|
let fake_stdout = vec![];
|
||||||
let fake_stderr = vec![];
|
let fake_stderr = vec![];
|
||||||
|
|
||||||
|
let stdin_is_empty = stdin.is_empty();
|
||||||
for s in stdin {
|
for s in stdin {
|
||||||
fake_stdin.extend_from_slice(s.as_bytes())
|
fake_stdin.extend_from_slice(s.as_bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !stdin_is_empty {
|
||||||
|
// add newline to finish input
|
||||||
|
fake_stdin.extend_from_slice("\n".as_bytes());
|
||||||
|
}
|
||||||
|
|
||||||
let mut dispatcher = DefaultImportDispatcher::default();
|
let mut dispatcher = DefaultImportDispatcher::default();
|
||||||
dispatcher.wasi.files = vec![
|
dispatcher.wasi.files = vec![
|
||||||
WasiFile::ReadOnly(fake_stdin),
|
WasiFile::ReadOnly(fake_stdin),
|
||||||
|
@ -1417,12 +1413,8 @@ fn run_wasm_for_cli_test(wasm_path: &std::path::Path, stdin: Vec<&str>) -> Strin
|
||||||
Instance::from_bytes(&arena, &wasm_bytes, dispatcher, false).unwrap()
|
Instance::from_bytes(&arena, &wasm_bytes, dispatcher, false).unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
dbg!("pre call");
|
|
||||||
|
|
||||||
let result = instance.call_export("_start", []);
|
let result = instance.call_export("_start", []);
|
||||||
|
|
||||||
dbg!("post call");
|
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(Some(Value::I32(0))) => match &instance.import_dispatcher.wasi.files[1] {
|
Ok(Some(Value::I32(0))) => match &instance.import_dispatcher.wasi.files[1] {
|
||||||
WasiFile::WriteOnly(fake_stdout) => String::from_utf8(fake_stdout.clone())
|
WasiFile::WriteOnly(fake_stdout) => String::from_utf8(fake_stdout.clone())
|
||||||
|
|
|
@ -454,14 +454,14 @@ fn gen_from_mono_module_dev<'a>(
|
||||||
|
|
||||||
#[cfg(not(feature = "target-wasm32"))]
|
#[cfg(not(feature = "target-wasm32"))]
|
||||||
{
|
{
|
||||||
internal_error!();
|
internal_error!("Compiler was not built with feature 'target-wasm32'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(BuiltHostOpt::None, Architecture::Wasm32) => {
|
(BuiltHostOpt::None, Architecture::Wasm32) => {
|
||||||
internal_error!("Cannot compile wasm32 without a host on the dev compiler backend")
|
internal_error!("Cannot compile wasm32 without a host on the dev compiler backend.")
|
||||||
}
|
}
|
||||||
(BuiltHostOpt::Legacy(host_path), Architecture::Wasm32) => internal_error!(
|
(BuiltHostOpt::Legacy(host_path), Architecture::Wasm32) => internal_error!(
|
||||||
"Unsupported host files found for use with wasm32 dev compiler backend\n {}",
|
"Unsupported host files found for use with wasm32 dev compiler backend:\n {}",
|
||||||
host_path.display()
|
host_path.display()
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
@ -470,7 +470,7 @@ fn gen_from_mono_module_dev<'a>(
|
||||||
}),
|
}),
|
||||||
Architecture::Wasm32,
|
Architecture::Wasm32,
|
||||||
) => internal_error!(
|
) => internal_error!(
|
||||||
"Unsupported host files found for use with wasm32 dev compiler backend\n {}",
|
"Unsupported host files found for use with wasm32 dev compiler backend:\n {}",
|
||||||
preprocessed_host.display()
|
preprocessed_host.display()
|
||||||
),
|
),
|
||||||
(_, Architecture::X86_64 | Architecture::Aarch64) => {
|
(_, Architecture::X86_64 | Architecture::Aarch64) => {
|
||||||
|
@ -481,7 +481,7 @@ fn gen_from_mono_module_dev<'a>(
|
||||||
|
|
||||||
#[cfg(feature = "target-wasm32")]
|
#[cfg(feature = "target-wasm32")]
|
||||||
{
|
{
|
||||||
internal_error!()
|
internal_error!("Compiler was not built with feature 'target-wasm32'.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(_, Architecture::Aarch32) => {
|
(_, Architecture::Aarch32) => {
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
# - update nightly-OLD_DATE in .github/workflows/windows_release_build.yml
|
# - update nightly-OLD_DATE in .github/workflows/windows_release_build.yml
|
||||||
# - update nightly-OLD_DATE in crates/compiler/build/src/link.rs
|
# - 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"
|
profile = "default"
|
||||||
components = [
|
components = [
|
||||||
# for usages of rust-analyzer or similar tools inside `nix develop`
|
# for usages of rust-analyzer or similar tools inside `nix develop`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue