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
}
$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');