From 7d223c6ddddc7314df8f600fb29fb1f0304bbfde Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 1 Aug 2019 12:12:59 -0700 Subject: [PATCH] releasetools: Add FORCE_RUN_RELEASETOOLS. This allows test runner to take care of the external tools setup, then to start the test without a lunch'd environment. This is needed before having supports like python_test_helper that packs dependents into releasetools_test module. Bug: 138791766 Test: Don't lunch any target. Use `FORCE_RUN_RELEASETOOLS=1 python -m unittest -v test_add_img_to_target_files` and check there's no skipped testcases. Change-Id: Iafeaba54fc228d8e1fc5ff3c91f7ffebef18ad7f --- tools/releasetools/test_utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/releasetools/test_utils.py b/tools/releasetools/test_utils.py index 1e919f7bb..244567166 100755 --- a/tools/releasetools/test_utils.py +++ b/tools/releasetools/test_utils.py @@ -32,9 +32,12 @@ import common logging.basicConfig(stream=sys.stdout) # Use ANDROID_BUILD_TOP as an indicator to tell if the needed tools (e.g. -# avbtool, mke2fs) are available while running the tests. Not having the var or -# having empty string means we can't run the tests that require external tools. -EXTERNAL_TOOLS_UNAVAILABLE = not os.environ.get("ANDROID_BUILD_TOP") +# avbtool, mke2fs) are available while running the tests, unless +# FORCE_RUN_RELEASETOOLS is set to '1'. Not having the required vars means we +# can't run the tests that require external tools. +EXTERNAL_TOOLS_UNAVAILABLE = ( + not os.environ.get('ANDROID_BUILD_TOP') and + os.environ.get('FORCE_RUN_RELEASETOOLS') != '1') def SkipIfExternalToolsUnavailable():