From 99717090ef0f7146e6b6f90bf705623aff2627e2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 30 Nov 2011 16:10:27 -0800 Subject: [PATCH] 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 --- src/unit/engine/phutil/PhutilUnitTestEngine.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 -- 2.43.0