diff options
| author | Antoni Boucher <bouanto@zoho.com> | 2023-10-26 17:42:02 -0400 |
|---|---|---|
| committer | Antoni Boucher <bouanto@zoho.com> | 2023-10-26 17:42:02 -0400 |
| commit | c797cccda61e1116fa4a2e8feb0fb43432add599 (patch) | |
| tree | 0c135dadf0e67d118d77ddb06e449d0014f6f22a /compiler/rustc_codegen_gcc/build_system/src/test.rs | |
| parent | 8396efecf7d30ca9f7edcf76aba2ea388300f6ab (diff) | |
| parent | e4fe941b11a55c5005630696e9b6d81c65f7bd04 (diff) | |
| download | rust-c797cccda61e1116fa4a2e8feb0fb43432add599.tar.gz rust-c797cccda61e1116fa4a2e8feb0fb43432add599.zip | |
Merge commit 'e4fe941b11a55c5005630696e9b6d81c65f7bd04' into subtree-update_cg_gcc_2023-10-25
Diffstat (limited to 'compiler/rustc_codegen_gcc/build_system/src/test.rs')
| -rw-r--r-- | compiler/rustc_codegen_gcc/build_system/src/test.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_gcc/build_system/src/test.rs b/compiler/rustc_codegen_gcc/build_system/src/test.rs new file mode 100644 index 00000000000..4c8c63e59ab --- /dev/null +++ b/compiler/rustc_codegen_gcc/build_system/src/test.rs @@ -0,0 +1,15 @@ +use crate::utils::run_command_with_output; + +fn get_args<'a>(args: &mut Vec<&'a dyn AsRef<std::ffi::OsStr>>, extra_args: &'a Vec<String>) { + for extra_arg in extra_args { + args.push(extra_arg); + } +} + +pub fn run() -> Result<(), String> { + let mut args: Vec<&dyn AsRef<std::ffi::OsStr>> = vec![&"bash", &"test.sh"]; + let extra_args = std::env::args().skip(2).collect::<Vec<_>>(); + get_args(&mut args, &extra_args); + let current_dir = std::env::current_dir().map_err(|error| format!("`current_dir` failed: {:?}", error))?; + run_command_with_output(args.as_slice(), Some(¤t_dir)) +} |
