From: Simon Glass Date: Fri, 24 Feb 2023 01:18:10 +0000 (-0700) Subject: buildman: Hide the test options unless test code is available X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=5cfb73b5902d46f656657c765c61e84980d9989c;p=u-boot.git buildman: Hide the test options unless test code is available It doesn't make much sense to expose tests when buildman is running outside of the U-Boot git checkout. Hide the option in this case Signed-off-by: Simon Glass --- diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index da7f1a99f6..a9cda24957 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -3,6 +3,11 @@ # from optparse import OptionParser +import os +import pathlib + +BUILDMAN_DIR = pathlib.Path(__file__).parent +HAS_TESTS = os.path.exists(BUILDMAN_DIR / "test.py") def ParseArgs(): """Parse command line arguments from sys.argv[] @@ -105,12 +110,13 @@ def ParseArgs(): default=False, help='Show a build summary') parser.add_option('-S', '--show-sizes', action='store_true', default=False, help='Show image size variation in summary') - parser.add_option('--skip-net-tests', action='store_true', default=False, - help='Skip tests which need the network') parser.add_option('--step', type='int', default=1, help='Only build every n commits (0=just first and last)') - parser.add_option('-t', '--test', action='store_true', dest='test', - default=False, help='run tests') + if HAS_TESTS: + parser.add_option('--skip-net-tests', action='store_true', default=False, + help='Skip tests which need the network') + parser.add_option('-t', '--test', action='store_true', dest='test', + default=False, help='run tests') parser.add_option('-T', '--threads', type='int', default=None, help='Number of builder threads to use (0=single-thread)')