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 <sjg@chromium.org>
This commit is contained in:
Simon Glass 2023-02-23 18:18:10 -07:00
parent 793aa17619
commit 5cfb73b590

View file

@ -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)')