]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Raise a better error from PhutilUnitTestEngine when trying to use one copy of libphut...
authorepriestley <git@epriestley.com>
Mon, 5 Mar 2012 18:03:13 +0000 (10:03 -0800)
committerepriestley <git@epriestley.com>
Mon, 5 Mar 2012 18:03:13 +0000 (10:03 -0800)
Summary:
We currently raise a very confusing error when we hit this case:

  Exception: The phutil library '' has not been loaded!

Because of the trickiness of init-order stuff, it's difficult to detect this more explicitly earlier -- instead, just raise a more descriptive error.

Test Plan: Ran "arc unit" in a copy of libphutil other than the one arc loads.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T580

Differential Revision: https://secure.phabricator.com/D1760

src/unit/engine/phutil/PhutilUnitTestEngine.php

index 7cef6fae54ffb3d26fb6bd4c5f53406c1534a8fd..50b152a8fe965c8d4041535ed3ca7879c99ab56a 100644 (file)
@@ -35,6 +35,18 @@ final class PhutilUnitTestEngine extends ArcanistBaseUnitTestEngine {
       }
       $library_name = phutil_get_library_name_for_root($library_root);
 
+      if (!$library_name) {
+        throw new Exception(
+          "Attempting to run unit tests on a libphutil library which has not ".
+          "been loaded, at:\n\n".
+          "    {$library_root}\n\n".
+          "This probably means one of two things:\n\n".
+          "    - You may need to add this library to .arcconfig.\n".
+          "    - You may be running tests on a copy of libphutil or arcanist\n".
+          "      using a different copy of libphutil or arcanist. This\n".
+          "      operation is not supported.");
+      }
+
       $path = Filesystem::resolvePath($path);
 
       if (!is_dir($path)) {