1
0
Fork 0
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:
epriestley 2013-01-30 11:24:41 -08:00
parent c45053da4c
commit 51f32bdde7

View file

@ -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');