mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Consistent handling of ld chained fixup warning in cli/glue tests
This commit is contained in:
parent
c072eda598
commit
58cb8352bb
3 changed files with 19 additions and 14 deletions
|
@ -10,8 +10,9 @@ extern crate roc_module;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod cli_run {
|
mod cli_run {
|
||||||
use cli_utils::helpers::{
|
use cli_utils::helpers::{
|
||||||
extract_valgrind_errors, file_path_from_root, fixture_file, fixtures_dir, known_bad_file,
|
extract_valgrind_errors, file_path_from_root, fixture_file, fixtures_dir, has_error,
|
||||||
run_cmd, run_roc, run_with_valgrind, strip_colors, Out, ValgrindError, ValgrindErrorXWhat,
|
known_bad_file, run_cmd, run_roc, run_with_valgrind, strip_colors, Out, ValgrindError,
|
||||||
|
ValgrindErrorXWhat,
|
||||||
};
|
};
|
||||||
use const_format::concatcp;
|
use const_format::concatcp;
|
||||||
use indoc::indoc;
|
use indoc::indoc;
|
||||||
|
@ -149,13 +150,7 @@ mod cli_run {
|
||||||
// for some reason, llvm prints out this warning when targeting windows
|
// for some reason, llvm prints out this warning when targeting windows
|
||||||
let ignorable = "warning: ignoring debug info with an invalid version (0) in app\r\n";
|
let ignorable = "warning: ignoring debug info with an invalid version (0) in app\r\n";
|
||||||
let stderr = stderr.replacen(ignorable, "", 1);
|
let stderr = stderr.replacen(ignorable, "", 1);
|
||||||
|
if has_error(&stderr) {
|
||||||
let is_reporting_runtime = stderr.starts_with("runtime: ") && stderr.ends_with("ms\n");
|
|
||||||
if !(stderr.is_empty() || is_reporting_runtime
|
|
||||||
// macOS ld reports this warning, but if we remove -undefined dynamic_lookup,
|
|
||||||
// linking stops working properly.
|
|
||||||
|| stderr.trim() == "ld: warning: -undefined dynamic_lookup may not work with chained fixups")
|
|
||||||
{
|
|
||||||
panic!("\n___________\nThe roc command:\n\n {:?}\n\nhad unexpected stderr:\n\n {}\n___________\n", compile_out.cmd_str, stderr);
|
panic!("\n___________\nThe roc command:\n\n {:?}\n\nhad unexpected stderr:\n\n {}\n___________\n", compile_out.cmd_str, stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,18 @@ where
|
||||||
run_roc_with_stdin(&path_to_roc_binary(), args, &[])
|
run_roc_with_stdin(&path_to_roc_binary(), args, &[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn has_error(stderr: &str) -> bool {
|
||||||
|
let is_reporting_runtime = stderr.starts_with("runtime: ") && stderr.ends_with("ms\n");
|
||||||
|
|
||||||
|
let is_clean = stderr.is_empty() ||
|
||||||
|
is_reporting_runtime ||
|
||||||
|
// macOS ld reports this warning, but if we remove -undefined dynamic_lookup,
|
||||||
|
// linking stops working properly.
|
||||||
|
stderr.trim() == "ld: warning: -undefined dynamic_lookup may not work with chained fixups";
|
||||||
|
|
||||||
|
!is_clean
|
||||||
|
}
|
||||||
|
|
||||||
pub fn path_to_roc_binary() -> PathBuf {
|
pub fn path_to_roc_binary() -> PathBuf {
|
||||||
path_to_binary(if cfg!(windows) { "roc.exe" } else { "roc" })
|
path_to_binary(if cfg!(windows) { "roc.exe" } else { "roc" })
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ mod helpers;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod glue_cli_run {
|
mod glue_cli_run {
|
||||||
use crate::helpers::fixtures_dir;
|
use crate::helpers::fixtures_dir;
|
||||||
use cli_utils::helpers::{run_glue, run_roc, Out};
|
use cli_utils::helpers::{has_error, run_glue, run_roc, Out};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
@ -215,8 +215,7 @@ mod glue_cli_run {
|
||||||
|
|
||||||
let ignorable = "🔨 Rebuilding platform...\n";
|
let ignorable = "🔨 Rebuilding platform...\n";
|
||||||
let stderr = glue_out.stderr.replacen(ignorable, "", 1);
|
let stderr = glue_out.stderr.replacen(ignorable, "", 1);
|
||||||
let is_reporting_runtime = stderr.starts_with("runtime: ") && stderr.ends_with("ms\n");
|
if has_error(&stderr) {
|
||||||
if !(stderr.is_empty() || is_reporting_runtime) {
|
|
||||||
panic!("`roc glue` command had unexpected stderr: {}", stderr);
|
panic!("`roc glue` command had unexpected stderr: {}", stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +237,7 @@ mod glue_cli_run {
|
||||||
|
|
||||||
let ignorable = "🔨 Rebuilding platform...\n";
|
let ignorable = "🔨 Rebuilding platform...\n";
|
||||||
let stderr = compile_out.stderr.replacen(ignorable, "", 1);
|
let stderr = compile_out.stderr.replacen(ignorable, "", 1);
|
||||||
let is_reporting_runtime = stderr.starts_with("runtime: ") && stderr.ends_with("ms\n");
|
if has_error(&stderr) {
|
||||||
if !(stderr.is_empty() || is_reporting_runtime) {
|
|
||||||
panic!("`roc` command had unexpected stderr: {}", stderr);
|
panic!("`roc` command had unexpected stderr: {}", stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue