mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-30 16:35:37 +00:00
dtoc: Hide the test options unless test code is available
It doesn't make much sense to expose tests when dtoc 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:
parent
0de2ffe717
commit
ab9272b804
1 changed files with 13 additions and 6 deletions
|
@ -23,6 +23,7 @@ see doc/driver-model/of-plat.rst
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
import os
|
import os
|
||||||
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Bring in the patman libraries
|
# Bring in the patman libraries
|
||||||
|
@ -37,6 +38,9 @@ sys.path.insert(0, os.path.join(our_path,
|
||||||
from dtoc import dtb_platdata
|
from dtoc import dtb_platdata
|
||||||
from u_boot_pylib import test_util
|
from u_boot_pylib import test_util
|
||||||
|
|
||||||
|
DTOC_DIR = pathlib.Path(__file__).parent
|
||||||
|
HAVE_TESTS = (DTOC_DIR / 'test_dtoc.py').exists()
|
||||||
|
|
||||||
def run_tests(processes, args):
|
def run_tests(processes, args):
|
||||||
"""Run all the test we have for dtoc
|
"""Run all the test we have for dtoc
|
||||||
|
|
||||||
|
@ -93,19 +97,22 @@ parser.add_argument('-p', '--phase', type=str,
|
||||||
help='set phase of U-Boot this invocation is for (spl/tpl)')
|
help='set phase of U-Boot this invocation is for (spl/tpl)')
|
||||||
parser.add_argument('-P', '--processes', type=int,
|
parser.add_argument('-P', '--processes', type=int,
|
||||||
help='set number of processes to use for running tests')
|
help='set number of processes to use for running tests')
|
||||||
parser.add_argument('-t', '--test', action='store_true', dest='test',
|
if HAVE_TESTS:
|
||||||
default=False, help='run tests')
|
parser.add_argument('-t', '--test', action='store_true', dest='test',
|
||||||
parser.add_argument('-T', '--test-coverage', action='store_true',
|
default=False, help='run tests')
|
||||||
default=False, help='run tests and check for 100%% coverage')
|
parser.add_argument(
|
||||||
|
'-T', '--test-coverage', action='store_true',
|
||||||
|
default=False, help='run tests and check for 100%% coverage')
|
||||||
|
|
||||||
parser.add_argument('files', nargs='*')
|
parser.add_argument('files', nargs='*')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Run our meagre tests
|
# Run our meagre tests
|
||||||
if args.test:
|
if HAVE_TESTS and args.test:
|
||||||
ret_code = run_tests(args.processes, args)
|
ret_code = run_tests(args.processes, args)
|
||||||
sys.exit(ret_code)
|
sys.exit(ret_code)
|
||||||
|
|
||||||
elif args.test_coverage:
|
elif HAVE_TESTS and args.test_coverage:
|
||||||
RunTestCoverage()
|
RunTestCoverage()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue