2 env::{self, current_dir},
7 use lang_tester::LangTester;
11 let tempdir = TempDir::new().expect("temp dir");
12 let current_dir = current_dir().expect("current dir");
13 let current_dir = current_dir.to_str().expect("current dir").to_string();
14 let gcc_path = include_str!("../gcc_path");
15 let gcc_path = gcc_path.trim();
16 env::set_var("LD_LIBRARY_PATH", gcc_path);
18 .test_dir("tests/run")
19 .test_file_filter(|path| path.extension().expect("extension").to_str().expect("to_str") == "rs")
20 .test_extract(|source| {
23 .skip_while(|l| !l.starts_with("//"))
24 .take_while(|l| l.starts_with("//"))
30 .test_cmds(move |path| {
31 // Test command 1: Compile `x.rs` into `tempdir/x`.
32 let mut exe = PathBuf::new();
34 exe.push(path.file_stem().expect("file_stem"));
35 let mut compiler = Command::new("rustc");
37 &format!("-Zcodegen-backend={}/target/debug/librustc_codegen_gcc.so", current_dir),
38 "--sysroot", &format!("{}/build_sysroot/sysroot/", current_dir),
42 "-o", exe.to_str().expect("to_str"),
43 path.to_str().expect("to_str"),
45 // Test command 2: run `tempdir/x`.
46 let runtime = Command::new(exe);
47 vec![("Compiler", compiler), ("Run-time", runtime)]