mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
Restore directory after executing ArcanistBundleTestCase
Summary: This test currently chdir()'s into a directory which is later removed. If another test tries to run a shell script while the CWD is invalid, the shell may emit this to stderr: shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory Among other things, this can cause the XHPAST test to fail, because it detects syntax errors by examining stderr. Instead, retore the directory. Test Plan: Ran "arc unit --everything", which could previously fail if XHPAST ran after Bundle. Reviewers: btrahan, vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4738
This commit is contained in:
parent
c45053da4c
commit
51f32bdde7
1 changed files with 18 additions and 1 deletions
|
@ -40,11 +40,28 @@ final class ArcanistBundleTestCase extends ArcanistTestCase {
|
|||
}
|
||||
|
||||
$archive = dirname(__FILE__).'/bundle.git.tgz';
|
||||
$patches = dirname(__FILE__).'/patches/';
|
||||
$fixture = PhutilDirectoryFixture::newFromArchive($archive);
|
||||
|
||||
$old_dir = getcwd();
|
||||
chdir($fixture->getPath());
|
||||
|
||||
$caught = null;
|
||||
try {
|
||||
$this->runGitRepositoryTests($fixture);
|
||||
} catch (Exception $ex) {
|
||||
$caught = $ex;
|
||||
}
|
||||
|
||||
chdir($old_dir);
|
||||
|
||||
if ($caught) {
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
private function runGitRepositoryTests(PhutilDirectoryFixture $fixture) {
|
||||
$patches = dirname(__FILE__).'/patches/';
|
||||
|
||||
list($commits) = execx(
|
||||
'git log --format=%s',
|
||||
'%H %T %s');
|
||||
|
|
Loading…
Reference in a new issue