1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 23:02:41 +01:00

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
This commit is contained in:
epriestley 2012-03-05 10:03:13 -08:00
parent 2f9a422bc6
commit 64ada40f03

View file

@ -35,6 +35,18 @@ final class PhutilUnitTestEngine extends ArcanistBaseUnitTestEngine {
} }
$library_name = phutil_get_library_name_for_root($library_root); $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); $path = Filesystem::resolvePath($path);
if (!is_dir($path)) { if (!is_dir($path)) {