]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Avoid infinite loop in 'arc unit'
authorepriestley <git@epriestley.com>
Thu, 1 Dec 2011 00:10:27 +0000 (16:10 -0800)
committerepriestley <git@epriestley.com>
Thu, 1 Dec 2011 16:50:12 +0000 (08:50 -0800)
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

index 6921dc808e3845b9f301bc7754f3be2a014bff0b..f46862285dc5a5b2de537cd8b5a227ccb630b47f 100644 (file)
@@ -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