mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-01 17:10:11 +00:00
d8318feba1
The python tools' test utilities handle printing test results, but the output is quite bare compared to an ordinary unittest run. Delegate printing the results to a unittest text runner, which gives us niceties like clear separation between each test's result and how long it took to run the test suite. Unfortunately it does not print info for skipped tests by default, but this can be handled later by a custom test result subclass. It also does not print the tool name; manually print a heading that includes the toolname so that the outputs of each tool's tests are distinguishable in the CI output. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
62 lines
1.6 KiB
Python
Executable file
62 lines
1.6 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-2.0+
|
|
#
|
|
# Copyright (c) 2012 The Chromium OS Authors.
|
|
#
|
|
|
|
"""See README for more information"""
|
|
|
|
import doctest
|
|
import multiprocessing
|
|
import os
|
|
import re
|
|
import sys
|
|
|
|
# Bring in the patman libraries
|
|
our_path = os.path.dirname(os.path.realpath(__file__))
|
|
sys.path.insert(1, os.path.join(our_path, '..'))
|
|
|
|
# Our modules
|
|
from buildman import board
|
|
from buildman import bsettings
|
|
from buildman import builder
|
|
from buildman import cmdline
|
|
from buildman import control
|
|
from buildman import toolchain
|
|
from patman import patchstream
|
|
from patman import gitutil
|
|
from patman import terminal
|
|
from patman import test_util
|
|
|
|
def RunTests(skip_net_tests, verboose, args):
|
|
from buildman import func_test
|
|
from buildman import test
|
|
import doctest
|
|
|
|
test_name = args and args[0] or None
|
|
if skip_net_tests:
|
|
test.use_network = False
|
|
|
|
# Run the entry tests first ,since these need to be the first to import the
|
|
# 'entry' module.
|
|
result = test_util.run_test_suites(
|
|
'buildman', False, verboose, False, None, test_name, [],
|
|
[test.TestBuild, func_test.TestFunctional,
|
|
'buildman.toolchain', 'patman.gitutil'])
|
|
|
|
return (0 if result.wasSuccessful() else 1)
|
|
|
|
options, args = cmdline.ParseArgs()
|
|
|
|
if not options.debug:
|
|
sys.tracebacklimit = 0
|
|
|
|
# Run our meagre tests
|
|
if options.test:
|
|
RunTests(options.skip_net_tests, options.verbose, args)
|
|
|
|
# Build selected commits for selected boards
|
|
else:
|
|
bsettings.Setup(options.config_file)
|
|
ret_code = control.DoBuildman(options, args)
|
|
sys.exit(ret_code)
|