mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Add surgical linker to cli_run tests that don't use rust
This commit is contained in:
parent
1fba3702a8
commit
eae8a2ea37
5 changed files with 29 additions and 5 deletions
|
@ -18,6 +18,13 @@ mod cli_run {
|
|||
#[cfg(not(debug_assertions))]
|
||||
use roc_collections::all::MutMap;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
const TEST_SURGICAL_LINKER: bool = true;
|
||||
|
||||
// Surgical linker currently only supports linux.
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
const TEST_SURGICAL_LINKER: bool = false;
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
const ALLOW_VALGRIND: bool = true;
|
||||
|
||||
|
@ -136,7 +143,6 @@ mod cli_run {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// This macro does two things.
|
||||
///
|
||||
/// First, it generates and runs a separate test for each of the given
|
||||
|
@ -184,6 +190,24 @@ mod cli_run {
|
|||
example.expected_ending,
|
||||
example.use_valgrind,
|
||||
);
|
||||
|
||||
// Also check with the surgical linker.
|
||||
|
||||
if TEST_SURGICAL_LINKER {
|
||||
if matches!(example.executable_filename, "echo" | "hello-rust") {
|
||||
eprintln!("WARNING: skipping testing example {} with surgical linking because rust is currently not supported!", example.filename);
|
||||
return;
|
||||
}
|
||||
|
||||
check_output_with_stdin(
|
||||
&file_name,
|
||||
example.stdin,
|
||||
example.executable_filename,
|
||||
&["--roc-linker"],
|
||||
example.expected_ending,
|
||||
example.use_valgrind,
|
||||
);
|
||||
}
|
||||
}
|
||||
)*
|
||||
|
||||
|
@ -228,7 +252,7 @@ mod cli_run {
|
|||
},
|
||||
hello_rust:"hello-rust" => Example {
|
||||
filename: "Hello.roc",
|
||||
executable_filename: "hello-world",
|
||||
executable_filename: "hello-rust",
|
||||
stdin: &[],
|
||||
expected_ending:"Hello, World!\n",
|
||||
use_valgrind: true,
|
||||
|
|
2
examples/hello-rust/.gitignore
vendored
2
examples/hello-rust/.gitignore
vendored
|
@ -1 +1 @@
|
|||
hello-world
|
||||
hello-rust
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
app "hello-world"
|
||||
app "hello-rust"
|
||||
packages { base: "platform" }
|
||||
imports []
|
||||
provides [ main ] to base
|
||||
|
|
|
@ -31,7 +31,6 @@ This linker is run in 2 phases: preprocessing and surigical linking.
|
|||
|
||||
## TODO (In a lightly prioritized order)
|
||||
|
||||
- Run CLI tests and/or benchmarks with the Roc Linker.
|
||||
- Test with an executable completely generated by Cargo (It will hopefully work out of the box like zig).
|
||||
- Add Macho support
|
||||
- Honestly should be almost exactly the same code.
|
||||
|
|
|
@ -199,6 +199,7 @@ fn generate_dynamic_lib(
|
|||
// TODO properly generate this list.
|
||||
for name in &[
|
||||
format!("roc__{}_1_exposed", sym),
|
||||
format!("roc__{}_1_exposed_generic", sym),
|
||||
format!("roc__{}_1_Fx_caller", sym),
|
||||
format!("roc__{}_1_Fx_size", sym),
|
||||
format!("roc__{}_1_Fx_result_size", sym),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue