From: epriestley Date: Thu, 1 Dec 2011 00:10:27 +0000 (-0800) Subject: Avoid infinite loop in 'arc unit' X-Git-Tag: conduit-4~226 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=99717090ef0f7146e6b6f90bf705623aff2627e2;p=arcanist.git Avoid infinite loop in 'arc unit' Summary: If you modify a file at the root level (like the celerity map) we run the dir/path checks in the wrong order and fail to detect that we can't possibly find any modules. This leads to an infinite loop inside the while loop below. Test Plan: Ran "arc unit" on a change which affects the celerity map. Reviewers: btrahan Reviewed By: btrahan CC: aran, btrahan Differential Revision: 1146 --- diff --git a/src/unit/engine/phutil/PhutilUnitTestEngine.php b/src/unit/engine/phutil/PhutilUnitTestEngine.php index 6921dc80..f4686228 100644 --- a/src/unit/engine/phutil/PhutilUnitTestEngine.php +++ b/src/unit/engine/phutil/PhutilUnitTestEngine.php @@ -36,14 +36,15 @@ class PhutilUnitTestEngine extends ArcanistBaseUnitTestEngine { $library_name = phutil_get_library_name_for_root($library_root); $path = Filesystem::resolvePath($path); - if ($path == $library_root) { - continue; - } if (!is_dir($path)) { $path = dirname($path); } + if ($path == $library_root) { + continue; + } + $library_path = Filesystem::readablePath($path, $library_root); do { // Add the module and all parent modules as affected modules, which