mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
fixed run_multi_dep_str
This commit is contained in:
parent
b346adfab8
commit
5b451f9288
2 changed files with 75 additions and 23 deletions
|
@ -269,7 +269,9 @@ mod cli_tests {
|
|||
|
||||
/// Build the platform host once for all tests in this module
|
||||
fn build_platform_host() {
|
||||
dbg!("Building platform host");
|
||||
BUILD_PLATFORM_HOST.call_once(|| {
|
||||
dbg!("call once");
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root("crates/cli/tests/test-projects/test-platform-simple-zig", "app.roc")
|
||||
|
@ -292,33 +294,22 @@ mod cli_tests {
|
|||
|
||||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn run_multi_dep_str_unoptimized() {
|
||||
fn run_multi_dep_str() {
|
||||
build_platform_host();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
let cli_build_unoptimized = 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 cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root("crates/cli/tests/test-projects/fixtures/multi-dep-str", "main.roc")
|
||||
)
|
||||
.arg(OPTIMIZE_FLAG);
|
||||
cli_build_unoptimized.clone().full_check_build_and_run(expected_output, TEST_LEGACY_LINKER, ALLOW_VALGRIND, None, None);
|
||||
|
||||
let expected_output = "I am Dep2.str2\n";
|
||||
|
||||
cli_build.full_check_build_and_run(expected_output, TEST_LEGACY_LINKER, ALLOW_VALGRIND, None, None);
|
||||
let cli_build_optimized = cli_build_unoptimized.arg(OPTIMIZE_FLAG);
|
||||
|
||||
cli_build_optimized.full_check_build_and_run(expected_output, TEST_LEGACY_LINKER, ALLOW_VALGRIND, None, None);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -10,6 +10,7 @@ use object::{
|
|||
use roc_collections::all::MutMap;
|
||||
use roc_error_macros::{internal_error, user_error};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::io::Write;
|
||||
use std::{
|
||||
ffi::{c_char, CStr},
|
||||
io::{BufReader, BufWriter},
|
||||
|
@ -1210,12 +1211,72 @@ fn surgery_elf_help(
|
|||
}
|
||||
let exec_header = load_struct_inplace::<elf::FileHeader64<LE>>(exec_mmap, 0);
|
||||
|
||||
let ph_offset = exec_header.e_phoff.get(LE);
|
||||
let ph_ent_size = exec_header.e_phentsize.get(LE);
|
||||
let ph_num = exec_header.e_phnum.get(LE);
|
||||
let sh_offset = exec_header.e_shoff.get(LE);
|
||||
let sh_ent_size = exec_header.e_shentsize.get(LE);
|
||||
let sh_num = exec_header.e_shnum.get(LE);
|
||||
let ph_offset = {
|
||||
let val = exec_header.e_phoff.get(LE);
|
||||
std::fs::OpenOptions::new()
|
||||
.append(true)
|
||||
.create(true)
|
||||
.open("log.txt")
|
||||
.unwrap()
|
||||
.write_all(format!("ph_offset = {:?}\n", val).as_bytes())
|
||||
.unwrap();
|
||||
val
|
||||
};
|
||||
let ph_ent_size = {
|
||||
let val = exec_header.e_phentsize.get(LE);
|
||||
std::fs::OpenOptions::new()
|
||||
.append(true)
|
||||
.create(true)
|
||||
.open("log.txt")
|
||||
.unwrap()
|
||||
.write_all(format!("ph_ent_size = {:?}\n", val).as_bytes())
|
||||
.unwrap();
|
||||
val
|
||||
};
|
||||
let ph_num = {
|
||||
let val = exec_header.e_phnum.get(LE);
|
||||
std::fs::OpenOptions::new()
|
||||
.append(true)
|
||||
.create(true)
|
||||
.open("log.txt")
|
||||
.unwrap()
|
||||
.write_all(format!("ph_num = {:?}\n", val).as_bytes())
|
||||
.unwrap();
|
||||
val
|
||||
};
|
||||
let sh_offset = {
|
||||
let val = exec_header.e_shoff.get(LE);
|
||||
std::fs::OpenOptions::new()
|
||||
.append(true)
|
||||
.create(true)
|
||||
.open("log.txt")
|
||||
.unwrap()
|
||||
.write_all(format!("sh_offset = {:?}\n", val).as_bytes())
|
||||
.unwrap();
|
||||
val
|
||||
};
|
||||
let sh_ent_size = {
|
||||
let val = exec_header.e_shentsize.get(LE);
|
||||
std::fs::OpenOptions::new()
|
||||
.append(true)
|
||||
.create(true)
|
||||
.open("log.txt")
|
||||
.unwrap()
|
||||
.write_all(format!("sh_ent_size = {:?}\n", val).as_bytes())
|
||||
.unwrap();
|
||||
val
|
||||
};
|
||||
let sh_num = {
|
||||
let val = exec_header.e_shnum.get(LE);
|
||||
std::fs::OpenOptions::new()
|
||||
.append(true)
|
||||
.create(true)
|
||||
.open("log.txt")
|
||||
.unwrap()
|
||||
.write_all(format!("sh_num = {:?}\n", val).as_bytes())
|
||||
.unwrap();
|
||||
val
|
||||
};
|
||||
|
||||
if verbose {
|
||||
println!();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue