about summary refs log tree commit diff
path: root/tests/run-make/doctests-runtool/rmake.rs
blob: bc406630932a72991e5bab8bc07220e01fe2bb72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//@ ignore-cross-compile (needs to run host tool binary)

// Tests behavior of rustdoc `--test-runtool`.

use std::path::PathBuf;

use run_make_support::rfs::{create_dir, remove_dir_all};
use run_make_support::{rustc, rustdoc};

fn mkdir(name: &str) -> PathBuf {
    let dir = PathBuf::from(name);
    create_dir(&dir);
    dir
}

// Behavior with --test-runtool with relative paths and --test-run-directory.
fn main() {
    let run_dir_name = "rundir";
    let run_dir = mkdir(run_dir_name);
    let run_tool = mkdir("runtool");
    let run_tool_binary = run_tool.join("runtool");

    rustc().input("t.rs").crate_type("rlib").run();
    rustc().input("runtool.rs").output(&run_tool_binary).run();

    rustdoc()
        .input("t.rs")
        .arg("-Zunstable-options")
        .arg("--test")
        .arg("--test-run-directory")
        .arg(run_dir_name)
        .arg("--test-runtool")
        .arg(&run_tool_binary)
        .extern_("t", "libt.rlib")
        .run();

    remove_dir_all(run_dir);
    remove_dir_all(run_tool);
}