Skip to content

Change libaux directory to fix aux crate tests on Windows #7979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

crnobog
Copy link

@crnobog crnobog commented Jul 22, 2013

No description provided.

@huonw
Copy link
Member

huonw commented Jul 22, 2013

Hey @crnobog, these fixes look like they might be caused by some bug in std::path that is making with_filetype not work. Maybe that's worth investigating?

@crnobog
Copy link
Author

crnobog commented Jul 22, 2013

I think with_filetype is working as documented and just shouldn't be used in constructing these paths in compiletest. The way with_filetype is commented Path("something").with_filetype("foo").with_filetype("bar") should produce "something.bar".

The offending functions causing the problem here are below:

fn output_base_name(config: &config, testfile: &Path) -> Path {
    config.build_base
        .push_rel(&output_testname(testfile))
        .with_filetype(config.stage_id)
}

fn aux_output_dir_name(config: &config, testfile: &Path) -> Path {
    output_base_name(config, testfile).with_filetype("libaux")
}

fn make_exe_name(config: &config, testfile: &Path) -> Path {
    Path(output_base_name(config, testfile).to_str() + os::EXE_SUFFIX)
}

#[cfg(target_os = "win32")]
fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {

    let mut env = os::env();

    // Make sure we include the aux directory in the path
    assert!(prog.ends_with(".exe"));
    let aux_path = prog.slice(0u, prog.len() - 4u).to_owned() + ".libaux";

    env = do env.map() |pair| {
        let (k,v) = (*pair).clone();
        if k == ~"PATH" { (~"PATH", v + ";" + lib_path + ";" + aux_path) }
        else { (k,v) }
    };
    if prog.ends_with("rustc.exe") {
        env.push((~"RUST_THREADS", ~"1"));
    }
    return env;
}

make_exe_name will produce something like test.stage2-i686-mingw.exe on my machine, output_base_name being test.state2-i686-mingw, and aux_output_dir_name being test.libaux.

But then the window procsrv runner will try to add test.stage2-i686-mingw to the PATH because it extracts it from the exe name.

This fix seemed the simplest way of getting uniform behaviour across platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants