From: epriestley Date: Mon, 5 Mar 2012 18:03:13 +0000 (-0800) Subject: Raise a better error from PhutilUnitTestEngine when trying to use one copy of libphut... X-Git-Tag: conduit-4~126 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=64ada40f03aec2be689f8681c56c673c16212ca4;p=arcanist.git Raise a better error from PhutilUnitTestEngine when trying to use one copy of libphutil to test another copy 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 --- diff --git a/src/unit/engine/phutil/PhutilUnitTestEngine.php b/src/unit/engine/phutil/PhutilUnitTestEngine.php index 7cef6fae..50b152a8 100644 --- a/src/unit/engine/phutil/PhutilUnitTestEngine.php +++ b/src/unit/engine/phutil/PhutilUnitTestEngine.php @@ -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)) {