Skip to content
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

appveyor: Attempt to debug flaky test runs #38695

Merged
merged 1 commit into from
Dec 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ install:
- 7z x -y sccache.tar > nul
- set PATH=%PATH%;%CD%\sccache2

# Help debug some handle issues on AppVeyor
- ps: Invoke-WebRequest -Uri https://download.sysinternals.com/files/Handle.zip -OutFile handle.zip
- mkdir handle
- ps: Expand-Archive handle.zip -dest handle
- set PATH=%PATH%;%CD%\handle
- handle.exe -accepteula -help

test_script:
- git submodule update --init
- set SRC=.
Expand Down
38 changes: 38 additions & 0 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1619,10 +1619,48 @@ actual:\n\
}

fn fatal_proc_rec(&self, err: &str, proc_res: &ProcRes) -> ! {
self.try_print_open_handles();
self.error(err);
proc_res.fatal(None);
}

// This function is a poor man's attempt to debug rust-lang/rust#38620, if
// that's closed then this should be deleted
//
// This is a very "opportunistic" debugging attempt, so we ignore all
// errors here.
fn try_print_open_handles(&self) {
if !cfg!(windows) {
return
}
if self.config.mode != Incremental {
return
}

let filename = match self.testpaths.file.file_stem() {
Some(path) => path,
None => return,
};

let mut cmd = Command::new("handle.exe");
cmd.arg("-a").arg("-u");
cmd.arg(filename);
cmd.arg("-nobanner");
let output = match cmd.output() {
Ok(output) => output,
Err(_) => return,
};
println!("---------------------------------------------------");
println!("ran extra command to debug rust-lang/rust#38620: ");
println!("{:?}", cmd);
println!("result: {}", output.status);
println!("--- stdout ----------------------------------------");
println!("{}", String::from_utf8_lossy(&output.stdout));
println!("--- stderr ----------------------------------------");
println!("{}", String::from_utf8_lossy(&output.stderr));
println!("---------------------------------------------------");
}

fn _arm_exec_compiled_test(&self, env: Vec<(String, String)>) -> ProcRes {
let args = self.make_run_args();
let cmdline = self.make_cmdline("", &args.prog, &args.args);
Expand Down