diff options
Diffstat (limited to 'tools/releasetools/test_utils.py')
| -rwxr-xr-x | tools/releasetools/test_utils.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/releasetools/test_utils.py b/tools/releasetools/test_utils.py index ca127b1366..1e919f7bb5 100755 --- a/tools/releasetools/test_utils.py +++ b/tools/releasetools/test_utils.py @@ -31,6 +31,18 @@ import common # Some test runner doesn't like outputs from stderr. 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") + + +def SkipIfExternalToolsUnavailable(): + """Decorator function that allows skipping tests per tools availability.""" + if EXTERNAL_TOOLS_UNAVAILABLE: + return unittest.skip('External tools unavailable') + return lambda func: func + def get_testdata_dir(): """Returns the testdata dir, in relative to the script dir.""" |