U-Boot
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
January 2016
- 195 participants
- 740 discussions
*Changes in v3:
- split [PATCH v2 3/3] QE: assgin pins to QE-HDLC to two patches:
[PATCH v3 3/4] ls1043rdb: move USB mux config to config_board_mux
and [PATCH v3 4/4] qe: assgin pins to qe-hdlc.
*Changes in v2:
- Add new patch in patchset.QE: mask the codes not used for micro QE
- [PATCH v2 2/3] QE: add QE support on ls1043ardb
- get qe_immr and qe_immr directly instead of from qe_base
3
6

29 Jan '16
From: Stephen Warren <swarren(a)nvidia.com>
Allow the env__dfu_configs boardenv data to specify the set of DFU
transfer sizes to test. Manually specifying test sizes is useful if you
wish to test multiple DFU configurations (e.g. SD card ext4 filesystem, SD
card whole raw partition, RAM, etc.), but don't want to test every
single transfer size on each, to avoid bloating the overall time taken by
testing. If the boardenv doesn't specify a set of sizes, the built-in list
is used as a default, preserving backwards-compatibility.
Signed-off-by: Stephen Warren <swarren(a)nvidia.com>
---
test/py/tests/test_dfu.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py
index bb70008af300..093e8d067871 100644
--- a/test/py/tests/test_dfu.py
+++ b/test/py/tests/test_dfu.py
@@ -36,6 +36,14 @@ env__dfu_configs = (
"fixture_id": "emmc",
"alt_info": "/dfu_test.bin ext4 0 1;/dfu_dummy.bin ext4 0 1",
"cmd_params": "mmc 0",
+ # This value is optional.
+ # If present, it specified the set of transfer sizes tested.
+ # If missing, a default list of sizes will be used, which covers
+ # various useful corner cases.
+ # Manually specifying test sizes is useful if you wish to test 4 DFU
+ # configurations, but don't want to test every single transfer size
+ # on each, to avoid bloating the overall time taken by testing.
+ "test_sizes": (63, 64, 65),
},
)
@@ -52,7 +60,7 @@ device.)
# The set of file sizes to test. These values trigger various edge-cases such
# as one less than, equal to, and one greater than typical USB max packet
# sizes, and similar boundary conditions.
-test_sizes = (
+test_sizes_default = (
64 - 1,
64,
64 + 1,
@@ -245,7 +253,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
if not first_usb_dev_port:
first_usb_dev_port = env__usb_dev_port
if env__usb_dev_port == first_usb_dev_port:
- sizes = test_sizes
+ sizes = env__dfu_config.get('test_sizes', test_sizes_default)
else:
sizes = []
--
2.7.0
2
2
From: Stephen Warren <swarren(a)nvidia.com>
s/updata/update/.
Signed-off-by: Stephen Warren <swarren(a)nvidia.com>
---
test/py/tests/test_env.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
index 651303f8cd69..c41aa5a9d9c7 100644
--- a/test/py/tests/test_env.py
+++ b/test/py/tests/test_env.py
@@ -94,7 +94,7 @@ def unset_var(state_test_env, var):
object.
Args:
- state_test_env: The StateTestEnv object to updata.
+ state_test_env: The StateTestEnv object to update.
var: The variable name to unset.
Returns:
@@ -112,7 +112,7 @@ def set_var(state_test_env, var, value):
object.
Args:
- state_test_env: The StateTestEnv object to updata.
+ state_test_env: The StateTestEnv object to update.
var: The variable name to set.
value: The value to set the variable to.
--
2.7.0
2
2

29 Jan '16
From: Stephen Warren <swarren(a)nvidia.com>
The ut command prints a test failure count each time it is executed.
This is stored in a global variable which is never reset. Consequently,
the printed failure count accumulates across runs. Fix this by clearing
the counter each time "ut" is invoked.
Signed-off-by: Stephen Warren <swarren(a)nvidia.com>
---
test/dm/test-main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/test/dm/test-main.c b/test/dm/test-main.c
index 91bdda83ab36..f2e004814387 100644
--- a/test/dm/test-main.c
+++ b/test/dm/test-main.c
@@ -81,6 +81,8 @@ static int dm_test_main(const char *test_name)
struct unit_test *test;
int run_count;
+ uts->fail_count = 0;
+
/*
* If we have no device tree, or it only has a root node, then these
* tests clearly aren't going to work...
--
2.7.0
2
25

29 Jan '16
From: Stephen Warren <swarren(a)nvidia.com>
When pytest generates the name for parametrized tests, simple parameter
values (ints, strings) get used directly, but more complex values such
as dicts are not handled. This yields test names such as:
dfu[env__usb_dev_port0-env__dfu_config0]
dfu[env__usb_dev_port0-env__dfu_config1]
Add some code to extract a custom fixture ID from the fixture values, so
that we end up with meaningful names such as:
dfu[micro_b-emmc]
dfu[devport2-ram]
If the boardenv file doesn't define custom names, the code falls back to
the old algorithm.
Signed-off-by: Stephen Warren <swarren(a)nvidia.com>
---
test/py/conftest.py | 8 +++++++-
test/py/tests/test_dfu.py | 3 +++
test/py/tests/test_ums.py | 3 +++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/test/py/conftest.py b/test/py/conftest.py
index a4e54c66ceda..9c9426aebe10 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -225,7 +225,13 @@ def pytest_generate_tests(metafunc):
# ... otherwise, see if there's a key that contains a list of
# values to use instead.
vals = subconfig.get(fn + 's', [])
- metafunc.parametrize(fn, vals)
+ def fixture_id(index, val):
+ try:
+ return val["fixture_id"]
+ except:
+ return fn + str(index)
+ ids = [fixture_id(index, val) for (index, val) in enumerate(vals)]
+ metafunc.parametrize(fn, vals, ids=ids)
@pytest.fixture(scope='function')
def u_boot_console(request):
diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py
index c09b90278dca..bb70008af300 100644
--- a/test/py/tests/test_dfu.py
+++ b/test/py/tests/test_dfu.py
@@ -21,6 +21,7 @@ For example:
env__usb_dev_ports = (
{
+ "fixture_id": "micro_b",
"tgt_usb_ctlr": "0",
"host_usb_dev_node": "/dev/usbdev-p2371-2180",
# This parameter is optional /if/ you only have a single board
@@ -32,10 +33,12 @@ env__usb_dev_ports = (
env__dfu_configs = (
# eMMC, partition 1
{
+ "fixture_id": "emmc",
"alt_info": "/dfu_test.bin ext4 0 1;/dfu_dummy.bin ext4 0 1",
"cmd_params": "mmc 0",
},
)
+
b) udev rules to set permissions on devices nodes, so that sudo is not
required. For example:
diff --git a/test/py/tests/test_ums.py b/test/py/tests/test_ums.py
index 21d40a972581..8c3ee2b053c4 100644
--- a/test/py/tests/test_ums.py
+++ b/test/py/tests/test_ums.py
@@ -29,6 +29,7 @@ env__mount_points = (
env__usb_dev_ports = (
{
+ "fixture_id": "micro_b",
"tgt_usb_ctlr": "0",
"host_ums_dev_node": "/dev/disk/by-path/pci-0000:00:14.0-usb-0:13:1.0-scsi-0:0:0:0",
},
@@ -37,6 +38,7 @@ env__usb_dev_ports = (
env__block_devs = (
# eMMC; always present
{
+ "fixture_id": "emmc",
"type": "mmc",
"id": "0",
# The following two properties are optional.
@@ -48,6 +50,7 @@ env__block_devs = (
},
# SD card; present since I plugged one in
{
+ "fixture_id": "sd",
"type": "mmc",
"id": "1"
},
--
2.7.0
2
3
From: Stephen Warren <swarren(a)nvidia.com>
Python's coding style docs indicate to use " not ' for docstrings.
test/py has other violations of the coding style docs, since the docs
specify a stranger style than I would expect, but nobody has complained
about those yet:-)
Signed-off-by: Stephen Warren <swarren(a)nvidia.com>
---
test/py/conftest.py | 44 ++++++------
test/py/multiplexed_log.py | 122 +++++++++++++++++-----------------
test/py/tests/test_000_version.py | 2 +-
test/py/tests/test_dfu.py | 32 ++++-----
test/py/tests/test_env.py | 54 +++++++--------
test/py/tests/test_help.py | 2 +-
test/py/tests/test_hush_if_test.py | 10 +--
test/py/tests/test_md.py | 8 +--
test/py/tests/test_net.py | 24 +++----
test/py/tests/test_sandbox_exit.py | 4 +-
test/py/tests/test_shell_basics.py | 10 +--
test/py/tests/test_sleep.py | 4 +-
test/py/tests/test_ums.py | 24 +++----
test/py/tests/test_unknown_cmd.py | 4 +-
test/py/u_boot_console_base.py | 48 ++++++-------
test/py/u_boot_console_exec_attach.py | 12 ++--
test/py/u_boot_console_sandbox.py | 20 +++---
test/py/u_boot_spawn.py | 30 ++++-----
test/py/u_boot_utils.py | 36 +++++-----
19 files changed, 245 insertions(+), 245 deletions(-)
diff --git a/test/py/conftest.py b/test/py/conftest.py
index c1f19cee65a3..a4e54c66ceda 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -29,7 +29,7 @@ log = None
console = None
def mkdir_p(path):
- '''Create a directory path.
+ """Create a directory path.
This includes creating any intermediate/parent directories. Any errors
caused due to already extant directories are ignored.
@@ -39,7 +39,7 @@ def mkdir_p(path):
Returns:
Nothing.
- '''
+ """
try:
os.makedirs(path)
@@ -50,14 +50,14 @@ def mkdir_p(path):
raise
def pytest_addoption(parser):
- '''pytest hook: Add custom command-line options to the cmdline parser.
+ """pytest hook: Add custom command-line options to the cmdline parser.
Args:
parser: The pytest command-line parser.
Returns:
Nothing.
- '''
+ """
parser.addoption('--build-dir', default=None,
help='U-Boot build directory (O=)')
@@ -73,14 +73,14 @@ def pytest_addoption(parser):
help='Compile U-Boot before running tests')
def pytest_configure(config):
- '''pytest hook: Perform custom initialization at startup time.
+ """pytest hook: Perform custom initialization at startup time.
Args:
config: The pytest configuration.
Returns:
Nothing.
- '''
+ """
global log
global console
@@ -190,7 +190,7 @@ def pytest_configure(config):
console = u_boot_console_exec_attach.ConsoleExecAttach(log, ubconfig)
def pytest_generate_tests(metafunc):
- '''pytest hook: parameterize test functions based on custom rules.
+ """pytest hook: parameterize test functions based on custom rules.
If a test function takes parameter(s) (fixture names) of the form brd__xxx
or env__xxx, the brd and env configuration dictionaries are consulted to
@@ -202,7 +202,7 @@ def pytest_generate_tests(metafunc):
Returns:
Nothing.
- '''
+ """
subconfigs = {
'brd': console.config.brd,
@@ -229,14 +229,14 @@ def pytest_generate_tests(metafunc):
@pytest.fixture(scope='function')
def u_boot_console(request):
- '''Generate the value of a test's u_boot_console fixture.
+ """Generate the value of a test's u_boot_console fixture.
Args:
request: The pytest request.
Returns:
The fixture value.
- '''
+ """
console.ensure_spawned()
return console
@@ -247,7 +247,7 @@ tests_skipped = set()
tests_passed = set()
def pytest_itemcollected(item):
- '''pytest hook: Called once for each test found during collection.
+ """pytest hook: Called once for each test found during collection.
This enables our custom result analysis code to see the list of all tests
that should eventually be run.
@@ -257,12 +257,12 @@ def pytest_itemcollected(item):
Returns:
Nothing.
- '''
+ """
tests_not_run.add(item.name)
def cleanup():
- '''Clean up all global state.
+ """Clean up all global state.
Executed (via atexit) once the entire test process is complete. This
includes logging the status of all tests, and the identity of any failed
@@ -273,7 +273,7 @@ def cleanup():
Returns:
Nothing.
- '''
+ """
if console:
console.close()
@@ -295,7 +295,7 @@ def cleanup():
atexit.register(cleanup)
def setup_boardspec(item):
- '''Process any 'boardspec' marker for a test.
+ """Process any 'boardspec' marker for a test.
Such a marker lists the set of board types that a test does/doesn't
support. If tests are being executed on an unsupported board, the test is
@@ -306,7 +306,7 @@ def setup_boardspec(item):
Returns:
Nothing.
- '''
+ """
mark = item.get_marker('boardspec')
if not mark:
@@ -323,7 +323,7 @@ def setup_boardspec(item):
pytest.skip('board not supported')
def setup_buildconfigspec(item):
- '''Process any 'buildconfigspec' marker for a test.
+ """Process any 'buildconfigspec' marker for a test.
Such a marker lists some U-Boot configuration feature that the test
requires. If tests are being executed on an U-Boot build that doesn't
@@ -334,7 +334,7 @@ def setup_buildconfigspec(item):
Returns:
Nothing.
- '''
+ """
mark = item.get_marker('buildconfigspec')
if not mark:
@@ -344,7 +344,7 @@ def setup_buildconfigspec(item):
pytest.skip('.config feature not enabled')
def pytest_runtest_setup(item):
- '''pytest hook: Configure (set up) a test item.
+ """pytest hook: Configure (set up) a test item.
Called once for each test to perform any custom configuration. This hook
is used to skip the test if certain conditions apply.
@@ -354,14 +354,14 @@ def pytest_runtest_setup(item):
Returns:
Nothing.
- '''
+ """
log.start_section(item.name)
setup_boardspec(item)
setup_buildconfigspec(item)
def pytest_runtest_protocol(item, nextitem):
- '''pytest hook: Called to execute a test.
+ """pytest hook: Called to execute a test.
This hook wraps the standard pytest runtestprotocol() function in order
to acquire visibility into, and record, each test function's result.
@@ -372,7 +372,7 @@ def pytest_runtest_protocol(item, nextitem):
Returns:
A list of pytest reports (test result data).
- '''
+ """
reports = runtestprotocol(item, nextitem=nextitem)
failed = None
diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py
index 5059bbfb99c3..c2a3b8953643 100644
--- a/test/py/multiplexed_log.py
+++ b/test/py/multiplexed_log.py
@@ -14,12 +14,12 @@ import subprocess
mod_dir = os.path.dirname(os.path.abspath(__file__))
class LogfileStream(object):
- '''A file-like object used to write a single logical stream of data into
+ """A file-like object used to write a single logical stream of data into
a multiplexed log file. Objects of this type should be created by factory
- functions in the Logfile class rather than directly.'''
+ functions in the Logfile class rather than directly."""
def __init__(self, logfile, name, chained_file):
- '''Initialize a new object.
+ """Initialize a new object.
Args:
logfile: The Logfile object to log to.
@@ -29,26 +29,26 @@ class LogfileStream(object):
Returns:
Nothing.
- '''
+ """
self.logfile = logfile
self.name = name
self.chained_file = chained_file
def close(self):
- '''Dummy function so that this class is "file-like".
+ """Dummy function so that this class is "file-like".
Args:
None.
Returns:
Nothing.
- '''
+ """
pass
def write(self, data, implicit=False):
- '''Write data to the log stream.
+ """Write data to the log stream.
Args:
data: The data to write tot he file.
@@ -60,33 +60,33 @@ class LogfileStream(object):
Returns:
Nothing.
- '''
+ """
self.logfile.write(self, data, implicit)
if self.chained_file:
self.chained_file.write(data)
def flush(self):
- '''Flush the log stream, to ensure correct log interleaving.
+ """Flush the log stream, to ensure correct log interleaving.
Args:
None.
Returns:
Nothing.
- '''
+ """
self.logfile.flush()
if self.chained_file:
self.chained_file.flush()
class RunAndLog(object):
- '''A utility object used to execute sub-processes and log their output to
+ """A utility object used to execute sub-processes and log their output to
a multiplexed log file. Objects of this type should be created by factory
- functions in the Logfile class rather than directly.'''
+ functions in the Logfile class rather than directly."""
def __init__(self, logfile, name, chained_file):
- '''Initialize a new object.
+ """Initialize a new object.
Args:
logfile: The Logfile object to log to.
@@ -96,18 +96,18 @@ class RunAndLog(object):
Returns:
Nothing.
- '''
+ """
self.logfile = logfile
self.name = name
self.chained_file = chained_file
def close(self):
- '''Clean up any resources managed by this object.'''
+ """Clean up any resources managed by this object."""
pass
def run(self, cmd, cwd=None, ignore_errors=False):
- '''Run a command as a sub-process, and log the results.
+ """Run a command as a sub-process, and log the results.
Args:
cmd: The command to execute.
@@ -120,7 +120,7 @@ class RunAndLog(object):
Returns:
Nothing.
- '''
+ """
msg = "+" + " ".join(cmd) + "\n"
if self.chained_file:
@@ -163,13 +163,13 @@ class RunAndLog(object):
raise exception
class SectionCtxMgr(object):
- '''A context manager for Python's "with" statement, which allows a certain
+ """A context manager for Python's "with" statement, which allows a certain
portion of test code to be logged to a separate section of the log file.
Objects of this type should be created by factory functions in the Logfile
- class rather than directly.'''
+ class rather than directly."""
def __init__(self, log, marker):
- '''Initialize a new object.
+ """Initialize a new object.
Args:
log: The Logfile object to log to.
@@ -177,7 +177,7 @@ class SectionCtxMgr(object):
Returns:
Nothing.
- '''
+ """
self.log = log
self.marker = marker
@@ -189,18 +189,18 @@ class SectionCtxMgr(object):
self.log.end_section(self.marker)
class Logfile(object):
- '''Generates an HTML-formatted log file containing multiple streams of
- data, each represented in a well-delineated/-structured fashion.'''
+ """Generates an HTML-formatted log file containing multiple streams of
+ data, each represented in a well-delineated/-structured fashion."""
def __init__(self, fn):
- '''Initialize a new object.
+ """Initialize a new object.
Args:
fn: The filename to write to.
Returns:
Nothing.
- '''
+ """
self.f = open(fn, "wt")
self.last_stream = None
@@ -217,7 +217,7 @@ class Logfile(object):
""")
def close(self):
- '''Close the log file.
+ """Close the log file.
After calling this function, no more data may be written to the log.
@@ -226,7 +226,7 @@ class Logfile(object):
Returns:
Nothing.
- '''
+ """
self.f.write("""\
</tt>
@@ -241,7 +241,7 @@ class Logfile(object):
"".join(chr(c) for c in range(127, 256)))
def _escape(self, data):
- '''Render data format suitable for inclusion in an HTML document.
+ """Render data format suitable for inclusion in an HTML document.
This includes HTML-escaping certain characters, and translating
control characters to a hexadecimal representation.
@@ -251,7 +251,7 @@ class Logfile(object):
Returns:
An escaped version of the data.
- '''
+ """
data = data.replace(chr(13), "")
data = "".join((c in self._nonprint) and ("%%%02x" % ord(c)) or
@@ -260,14 +260,14 @@ class Logfile(object):
return data
def _terminate_stream(self):
- '''Write HTML to the log file to terminate the current stream's data.
+ """Write HTML to the log file to terminate the current stream's data.
Args:
None.
Returns:
Nothing.
- '''
+ """
self.cur_evt += 1
if not self.last_stream:
@@ -280,7 +280,7 @@ class Logfile(object):
self.last_stream = None
def _note(self, note_type, msg):
- '''Write a note or one-off message to the log file.
+ """Write a note or one-off message to the log file.
Args:
note_type: The type of note. This must be a value supported by the
@@ -289,7 +289,7 @@ class Logfile(object):
Returns:
Nothing.
- '''
+ """
self._terminate_stream()
self.f.write("<div class=\"" + note_type + "\">\n<pre>")
@@ -297,14 +297,14 @@ class Logfile(object):
self.f.write("\n</pre></div>\n")
def start_section(self, marker):
- '''Begin a new nested section in the log file.
+ """Begin a new nested section in the log file.
Args:
marker: The name of the section that is starting.
Returns:
Nothing.
- '''
+ """
self._terminate_stream()
self.blocks.append(marker)
@@ -314,7 +314,7 @@ class Logfile(object):
"\">Section: " + blk_path + "</div>\n")
def end_section(self, marker):
- '''Terminate the current nested section in the log file.
+ """Terminate the current nested section in the log file.
This function validates proper nesting of start_section() and
end_section() calls. If a mismatch is found, an exception is raised.
@@ -324,7 +324,7 @@ class Logfile(object):
Returns:
Nothing.
- '''
+ """
if (not self.blocks) or (marker != self.blocks[-1]):
raise Exception("Block nesting mismatch: \"%s\" \"%s\"" %
@@ -337,7 +337,7 @@ class Logfile(object):
self.blocks.pop()
def section(self, marker):
- '''Create a temporary section in the log file.
+ """Create a temporary section in the log file.
This function creates a context manager for Python's "with" statement,
which allows a certain portion of test code to be logged to a separate
@@ -352,96 +352,96 @@ class Logfile(object):
Returns:
A context manager object.
- '''
+ """
return SectionCtxMgr(self, marker)
def error(self, msg):
- '''Write an error note to the log file.
+ """Write an error note to the log file.
Args:
msg: A message describing the error.
Returns:
Nothing.
- '''
+ """
self._note("error", msg)
def warning(self, msg):
- '''Write an warning note to the log file.
+ """Write an warning note to the log file.
Args:
msg: A message describing the warning.
Returns:
Nothing.
- '''
+ """
self._note("warning", msg)
def info(self, msg):
- '''Write an informational note to the log file.
+ """Write an informational note to the log file.
Args:
msg: An informational message.
Returns:
Nothing.
- '''
+ """
self._note("info", msg)
def action(self, msg):
- '''Write an action note to the log file.
+ """Write an action note to the log file.
Args:
msg: A message describing the action that is being logged.
Returns:
Nothing.
- '''
+ """
self._note("action", msg)
def status_pass(self, msg):
- '''Write a note to the log file describing test(s) which passed.
+ """Write a note to the log file describing test(s) which passed.
Args:
msg: A message describing passed test(s).
Returns:
Nothing.
- '''
+ """
self._note("status-pass", msg)
def status_skipped(self, msg):
- '''Write a note to the log file describing skipped test(s).
+ """Write a note to the log file describing skipped test(s).
Args:
msg: A message describing passed test(s).
Returns:
Nothing.
- '''
+ """
self._note("status-skipped", msg)
def status_fail(self, msg):
- '''Write a note to the log file describing failed test(s).
+ """Write a note to the log file describing failed test(s).
Args:
msg: A message describing passed test(s).
Returns:
Nothing.
- '''
+ """
self._note("status-fail", msg)
def get_stream(self, name, chained_file=None):
- '''Create an object to log a single stream's data into the log file.
+ """Create an object to log a single stream's data into the log file.
This creates a "file-like" object that can be written to in order to
write a single stream's data to the log file. The implementation will
@@ -456,12 +456,12 @@ class Logfile(object):
Returns:
A file-like object.
- '''
+ """
return LogfileStream(self, name, chained_file)
def get_runner(self, name, chained_file=None):
- '''Create an object that executes processes and logs their output.
+ """Create an object that executes processes and logs their output.
Args:
name: The name of this sub-process.
@@ -470,12 +470,12 @@ class Logfile(object):
Returns:
A RunAndLog object.
- '''
+ """
return RunAndLog(self, name, chained_file)
def write(self, stream, data, implicit=False):
- '''Write stream data into the log file.
+ """Write stream data into the log file.
This function should only be used by instances of LogfileStream or
RunAndLog.
@@ -491,7 +491,7 @@ class Logfile(object):
Returns:
Nothing.
- '''
+ """
if stream != self.last_stream:
self._terminate_stream()
@@ -507,13 +507,13 @@ class Logfile(object):
self.last_stream = stream
def flush(self):
- '''Flush the log stream, to ensure correct log interleaving.
+ """Flush the log stream, to ensure correct log interleaving.
Args:
None.
Returns:
Nothing.
- '''
+ """
self.f.flush()
diff --git a/test/py/tests/test_000_version.py b/test/py/tests/test_000_version.py
index d262f0534efd..43a02e74f7d8 100644
--- a/test/py/tests/test_000_version.py
+++ b/test/py/tests/test_000_version.py
@@ -9,7 +9,7 @@
# command prompt.
def test_version(u_boot_console):
- '''Test that the "version" command prints the U-Boot version.'''
+ """Test that the "version" command prints the U-Boot version."""
# "version" prints the U-Boot sign-on message. This is usually considered
# an error, so that any unexpected reboot causes an error. Here, this
diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py
index 6c1a363b02df..0f69eef66bb2 100644
--- a/test/py/tests/test_dfu.py
+++ b/test/py/tests/test_dfu.py
@@ -12,7 +12,7 @@ import os.path
import pytest
import u_boot_utils
-'''
+"""
Note: This test relies on:
a) boardenv_* to contain configuration values to define which USB ports are
@@ -44,7 +44,7 @@ ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb", KERNELS=="3-13", MODE:="66
(You may wish to change the group ID instead of setting the permissions wide
open. All that matters is that the user ID running the test can access the
device.)
-'''
+"""
# The set of file sizes to test. These values trigger various edge-cases such
# as one less than, equal to, and one greater than typical USB max packet
@@ -71,7 +71,7 @@ first_usb_dev_port = None
@pytest.mark.buildconfigspec('cmd_dfu')
def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
- '''Test the "dfu" command; the host system must be able to enumerate a USB
+ """Test the "dfu" command; the host system must be able to enumerate a USB
device when "dfu" is running, various DFU transfers are tested, and the
USB device must disappear when "dfu" is aborted.
@@ -86,10 +86,10 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
Returns:
Nothing.
- '''
+ """
def start_dfu():
- '''Start U-Boot's dfu shell command.
+ """Start U-Boot's dfu shell command.
This also waits for the host-side USB enumeration process to complete.
@@ -98,7 +98,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
Returns:
Nothing.
- '''
+ """
fh = u_boot_utils.attempt_to_open_file(
env__usb_dev_port['host_usb_dev_node'])
@@ -120,7 +120,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
fh.close()
def stop_dfu(ignore_errors):
- '''Stop U-Boot's dfu shell command from executing.
+ """Stop U-Boot's dfu shell command from executing.
This also waits for the host-side USB de-enumeration process to
complete.
@@ -133,7 +133,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
Returns:
Nothing.
- '''
+ """
try:
u_boot_console.log.action(
@@ -148,7 +148,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
raise
def run_dfu_util(alt_setting, fn, up_dn_load_arg):
- '''Invoke dfu-util on the host.
+ """Invoke dfu-util on the host.
Args:
alt_setting: The DFU "alternate setting" identifier to interact
@@ -159,7 +159,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
Returns:
Nothing.
- '''
+ """
cmd = ['dfu-util', '-a', str(alt_setting), up_dn_load_arg, fn]
if 'host_usb_port_path' in env__usb_dev_port:
@@ -168,7 +168,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
u_boot_console.wait_for('Ctrl+C to exit ...')
def dfu_write(alt_setting, fn):
- '''Write a file to the target board using DFU.
+ """Write a file to the target board using DFU.
Args:
alt_setting: The DFU "alternate setting" identifier to interact
@@ -177,12 +177,12 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
Returns:
Nothing.
- '''
+ """
run_dfu_util(alt_setting, fn, '-D')
def dfu_read(alt_setting, fn):
- '''Read a file from the target board using DFU.
+ """Read a file from the target board using DFU.
Args:
alt_setting: The DFU "alternate setting" identifier to interact
@@ -191,7 +191,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
Returns:
Nothing.
- '''
+ """
# dfu-util fails reads/uploads if the host file already exists
if os.path.exists(fn):
@@ -199,7 +199,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
run_dfu_util(alt_setting, fn, '-U')
def dfu_write_read_check(size):
- '''Test DFU transfers of a specific size of data
+ """Test DFU transfers of a specific size of data
This function first writes data to the board then reads it back and
compares the written and read back data. Measures are taken to avoid
@@ -210,7 +210,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
Returns:
Nothing.
- '''
+ """
test_f = u_boot_utils.PersistentRandomFile(u_boot_console,
'dfu_%d.bin' % size, size)
diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
index 557c3afe5c0a..651303f8cd69 100644
--- a/test/py/tests/test_env.py
+++ b/test/py/tests/test_env.py
@@ -10,34 +10,34 @@ import pytest
# FIXME: This might be useful for other tests;
# perhaps refactor it into ConsoleBase or some other state object?
class StateTestEnv(object):
- '''Container that represents the state of all U-Boot environment variables.
+ """Container that represents the state of all U-Boot environment variables.
This enables quick determination of existant/non-existant variable
names.
- '''
+ """
def __init__(self, u_boot_console):
- '''Initialize a new StateTestEnv object.
+ """Initialize a new StateTestEnv object.
Args:
u_boot_console: A U-Boot console.
Returns:
Nothing.
- '''
+ """
self.u_boot_console = u_boot_console
self.get_env()
self.set_var = self.get_non_existent_var()
def get_env(self):
- '''Read all current environment variables from U-Boot.
+ """Read all current environment variables from U-Boot.
Args:
None.
Returns:
Nothing.
- '''
+ """
response = self.u_boot_console.run_command('printenv')
self.env = {}
@@ -48,27 +48,27 @@ class StateTestEnv(object):
self.env[var] = value
def get_existent_var(self):
- '''Return the name of an environment variable that exists.
+ """Return the name of an environment variable that exists.
Args:
None.
Returns:
The name of an environment variable.
- '''
+ """
for var in self.env:
return var
def get_non_existent_var(self):
- '''Return the name of an environment variable that does not exist.
+ """Return the name of an environment variable that does not exist.
Args:
None.
Returns:
The name of an environment variable.
- '''
+ """
n = 0
while True:
@@ -80,7 +80,7 @@ class StateTestEnv(object):
ste = None
@pytest.fixture(scope='function')
def state_test_env(u_boot_console):
- '''pytest fixture to provide a StateTestEnv object to tests.'''
+ """pytest fixture to provide a StateTestEnv object to tests."""
global ste
if not ste:
@@ -88,7 +88,7 @@ def state_test_env(u_boot_console):
return ste
def unset_var(state_test_env, var):
- '''Unset an environment variable.
+ """Unset an environment variable.
This both executes a U-Boot shell command and updates a StateTestEnv
object.
@@ -99,14 +99,14 @@ def unset_var(state_test_env, var):
Returns:
Nothing.
- '''
+ """
state_test_env.u_boot_console.run_command('setenv %s' % var)
if var in state_test_env.env:
del state_test_env.env[var]
def set_var(state_test_env, var, value):
- '''Set an environment variable.
+ """Set an environment variable.
This both executes a U-Boot shell command and updates a StateTestEnv
object.
@@ -118,26 +118,26 @@ def set_var(state_test_env, var, value):
Returns:
Nothing.
- '''
+ """
state_test_env.u_boot_console.run_command('setenv %s "%s"' % (var, value))
state_test_env.env[var] = value
def validate_empty(state_test_env, var):
- '''Validate that a variable is not set, using U-Boot shell commands.
+ """Validate that a variable is not set, using U-Boot shell commands.
Args:
var: The variable name to test.
Returns:
Nothing.
- '''
+ """
response = state_test_env.u_boot_console.run_command('echo $%s' % var)
assert response == ''
def validate_set(state_test_env, var, value):
- '''Validate that a variable is set, using U-Boot shell commands.
+ """Validate that a variable is set, using U-Boot shell commands.
Args:
var: The variable name to test.
@@ -145,7 +145,7 @@ def validate_set(state_test_env, var, value):
Returns:
Nothing.
- '''
+ """
# echo does not preserve leading, internal, or trailing whitespace in the
# value. printenv does, and hence allows more complete testing.
@@ -153,20 +153,20 @@ def validate_set(state_test_env, var, value):
assert response == ('%s=%s' % (var, value))
def test_env_echo_exists(state_test_env):
- '''Test echoing a variable that exists.'''
+ """Test echoing a variable that exists."""
var = state_test_env.get_existent_var()
value = state_test_env.env[var]
validate_set(state_test_env, var, value)
def test_env_echo_non_existent(state_test_env):
- '''Test echoing a variable that doesn't exist.'''
+ """Test echoing a variable that doesn't exist."""
var = state_test_env.set_var
validate_empty(state_test_env, var)
def test_env_printenv_non_existent(state_test_env):
- '''Test printenv error message for non-existant variables.'''
+ """Test printenv error message for non-existant variables."""
var = state_test_env.set_var
c = state_test_env.u_boot_console
@@ -175,14 +175,14 @@ def test_env_printenv_non_existent(state_test_env):
assert(response == '## Error: "%s" not defined' % var)
def test_env_unset_non_existent(state_test_env):
- '''Test unsetting a nonexistent variable.'''
+ """Test unsetting a nonexistent variable."""
var = state_test_env.get_non_existent_var()
unset_var(state_test_env, var)
validate_empty(state_test_env, var)
def test_env_set_non_existent(state_test_env):
- '''Test set a non-existant variable.'''
+ """Test set a non-existant variable."""
var = state_test_env.set_var
value = 'foo'
@@ -190,7 +190,7 @@ def test_env_set_non_existent(state_test_env):
validate_set(state_test_env, var, value)
def test_env_set_existing(state_test_env):
- '''Test setting an existant variable.'''
+ """Test setting an existant variable."""
var = state_test_env.set_var
value = 'bar'
@@ -198,14 +198,14 @@ def test_env_set_existing(state_test_env):
validate_set(state_test_env, var, value)
def test_env_unset_existing(state_test_env):
- '''Test unsetting a variable.'''
+ """Test unsetting a variable."""
var = state_test_env.set_var
unset_var(state_test_env, var)
validate_empty(state_test_env, var)
def test_env_expansion_spaces(state_test_env):
- '''Test expanding a variable that contains a space in its value.'''
+ """Test expanding a variable that contains a space in its value."""
var_space = None
var_test = None
diff --git a/test/py/tests/test_help.py b/test/py/tests/test_help.py
index 894f3b5f1700..420090cf0d12 100644
--- a/test/py/tests/test_help.py
+++ b/test/py/tests/test_help.py
@@ -4,6 +4,6 @@
# SPDX-License-Identifier: GPL-2.0
def test_help(u_boot_console):
- '''Test that the "help" command can be executed.'''
+ """Test that the "help" command can be executed."""
u_boot_console.run_command('help')
diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py
index cf4c3aeeb731..8b88425a6598 100644
--- a/test/py/tests/test_hush_if_test.py
+++ b/test/py/tests/test_hush_if_test.py
@@ -95,7 +95,7 @@ subtests = (
)
def exec_hush_if(u_boot_console, expr, result):
- '''Execute a shell "if" command, and validate its result.'''
+ """Execute a shell "if" command, and validate its result."""
cmd = 'if ' + expr + '; then echo true; else echo false; fi'
response = u_boot_console.run_command(cmd)
@@ -103,7 +103,7 @@ def exec_hush_if(u_boot_console, expr, result):
@pytest.mark.buildconfigspec('sys_hush_parser')
def test_hush_if_test_setup(u_boot_console):
- '''Set up environment variables used during the "if" tests.'''
+ """Set up environment variables used during the "if" tests."""
u_boot_console.run_command('setenv ut_var_nonexistent')
u_boot_console.run_command('setenv ut_var_exists 1')
@@ -111,13 +111,13 @@ def test_hush_if_test_setup(u_boot_console):
@pytest.mark.buildconfigspec('sys_hush_parser')
@pytest.mark.parametrize('expr,result', subtests)
def test_hush_if_test(u_boot_console, expr, result):
- '''Test a single "if test" condition.'''
+ """Test a single "if test" condition."""
exec_hush_if(u_boot_console, expr, result)
@pytest.mark.buildconfigspec('sys_hush_parser')
def test_hush_if_test_teardown(u_boot_console):
- '''Clean up environment variables used during the "if" tests.'''
+ """Clean up environment variables used during the "if" tests."""
u_boot_console.run_command('setenv ut_var_exists')
@@ -126,7 +126,7 @@ def test_hush_if_test_teardown(u_boot_console):
# Of those, only UMS currently allows file removal though.
@pytest.mark.boardspec('sandbox')
def test_hush_if_test_host_file_exists(u_boot_console):
- '''Test the "if test -e" shell command.'''
+ """Test the "if test -e" shell command."""
test_file = u_boot_console.config.result_dir + \
'/creating_this_file_breaks_u_boot_tests'
diff --git a/test/py/tests/test_md.py b/test/py/tests/test_md.py
index 32cce4f15c53..5fe25826b3f4 100644
--- a/test/py/tests/test_md.py
+++ b/test/py/tests/test_md.py
@@ -8,8 +8,8 @@ import u_boot_utils
@pytest.mark.buildconfigspec('cmd_memory')
def test_md(u_boot_console):
- '''Test that md reads memory as expected, and that memory can be modified
- using the mw command.'''
+ """Test that md reads memory as expected, and that memory can be modified
+ using the mw command."""
ram_base = u_boot_utils.find_ram_base(u_boot_console)
addr = '%08x' % ram_base
@@ -24,8 +24,8 @@ def test_md(u_boot_console):
@pytest.mark.buildconfigspec('cmd_memory')
def test_md_repeat(u_boot_console):
- '''Test command repeat (via executing an empty command) operates correctly
- for "md"; the command must repeat and dump an incrementing address.'''
+ """Test command repeat (via executing an empty command) operates correctly
+ for "md"; the command must repeat and dump an incrementing address."""
ram_base = u_boot_utils.find_ram_base(u_boot_console)
addr_base = '%08x' % ram_base
diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
index 9c46551e8cbf..68eedde7c8db 100644
--- a/test/py/tests/test_net.py
+++ b/test/py/tests/test_net.py
@@ -8,7 +8,7 @@
import pytest
import u_boot_utils
-'''
+"""
Note: This test relies on boardenv_* containing configuration values to define
which the network environment available for testing. Without this, this test
will be automatically skipped.
@@ -46,16 +46,16 @@ env__net_tftp_readable_file = {
"size": 5058624,
"crc32": "c2244b26",
}
-'''
+"""
net_set_up = False
def test_net_pre_commands(u_boot_console):
- '''Execute any commands required to enable network hardware.
+ """Execute any commands required to enable network hardware.
These commands are provided by the boardenv_* file; see the comment at the
beginning of this file.
- '''
+ """
init_usb = u_boot_console.config.env.get('env__net_uses_usb', False)
if init_usb:
@@ -67,11 +67,11 @@ def test_net_pre_commands(u_boot_console):
@pytest.mark.buildconfigspec('cmd_dhcp')
def test_net_dhcp(u_boot_console):
- '''Test the dhcp command.
+ """Test the dhcp command.
The boardenv_* file may be used to enable/disable this test; see the
comment at the beginning of this file.
- '''
+ """
test_dhcp = u_boot_console.config.env.get('env__net_dhcp_server', False)
if not test_dhcp:
@@ -86,11 +86,11 @@ def test_net_dhcp(u_boot_console):
@pytest.mark.buildconfigspec('net')
def test_net_setup_static(u_boot_console):
- '''Set up a static IP configuration.
+ """Set up a static IP configuration.
The configuration is provided by the boardenv_* file; see the comment at
the beginning of this file.
- '''
+ """
env_vars = u_boot_console.config.env.get('env__net_static_env_vars', None)
if not env_vars:
@@ -104,12 +104,12 @@ def test_net_setup_static(u_boot_console):
@pytest.mark.buildconfigspec('cmd_ping')
def test_net_ping(u_boot_console):
- '''Test the ping command.
+ """Test the ping command.
The $serverip (as set up by either test_net_dhcp or test_net_setup_static)
is pinged. The test validates that the host is alive, as reported by the
ping command's output.
- '''
+ """
if not net_set_up:
pytest.skip("Network not initialized")
@@ -119,14 +119,14 @@ def test_net_ping(u_boot_console):
@pytest.mark.buildconfigspec('cmd_net')
def test_net_tftpboot(u_boot_console):
- '''Test the tftpboot command.
+ """Test the tftpboot command.
A file is downloaded from the TFTP server, its size and optionally its
CRC32 are validated.
The details of the file to download are provided by the boardenv_* file;
see the comment at the beginning of this file.
- '''
+ """
if not net_set_up:
pytest.skip("Network not initialized")
diff --git a/test/py/tests/test_sandbox_exit.py b/test/py/tests/test_sandbox_exit.py
index 1ec3607eb28a..d1aa3083f458 100644
--- a/test/py/tests/test_sandbox_exit.py
+++ b/test/py/tests/test_sandbox_exit.py
@@ -9,14 +9,14 @@ import signal
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('reset')
def test_reset(u_boot_console):
- '''Test that the "reset" command exits sandbox process.'''
+ """Test that the "reset" command exits sandbox process."""
u_boot_console.run_command('reset', wait_for_prompt=False)
assert(u_boot_console.validate_exited())
@pytest.mark.boardspec('sandbox')
def test_ctrl_c(u_boot_console):
- '''Test that sending SIGINT to sandbox causes it to exit.'''
+ """Test that sending SIGINT to sandbox causes it to exit."""
u_boot_console.kill(signal.SIGINT)
assert(u_boot_console.validate_exited())
diff --git a/test/py/tests/test_shell_basics.py b/test/py/tests/test_shell_basics.py
index 719ce611d71c..32e5f83015d3 100644
--- a/test/py/tests/test_shell_basics.py
+++ b/test/py/tests/test_shell_basics.py
@@ -5,13 +5,13 @@
# Test basic shell functionality, such as commands separate by semi-colons.
def test_shell_execute(u_boot_console):
- '''Test any shell command.'''
+ """Test any shell command."""
response = u_boot_console.run_command('echo hello')
assert response.strip() == 'hello'
def test_shell_semicolon_two(u_boot_console):
- '''Test two shell commands separate by a semi-colon.'''
+ """Test two shell commands separate by a semi-colon."""
cmd = 'echo hello; echo world'
response = u_boot_console.run_command(cmd)
@@ -19,8 +19,8 @@ def test_shell_semicolon_two(u_boot_console):
assert response.index('hello') < response.index('world')
def test_shell_semicolon_three(u_boot_console):
- '''Test three shell commands separate by a semi-colon, with variable
- expansion dependencies between them.'''
+ """Test three shell commands separate by a semi-colon, with variable
+ expansion dependencies between them."""
cmd = 'setenv list 1; setenv list ${list}2; setenv list ${list}3; ' + \
'echo ${list}'
@@ -29,7 +29,7 @@ def test_shell_semicolon_three(u_boot_console):
u_boot_console.run_command('setenv list')
def test_shell_run(u_boot_console):
- '''Test the "run" shell command.'''
+ """Test the "run" shell command."""
u_boot_console.run_command('setenv foo \"setenv monty 1; setenv python 2\"')
u_boot_console.run_command('run foo')
diff --git a/test/py/tests/test_sleep.py b/test/py/tests/test_sleep.py
index 437b6bb9fea9..74add891c333 100644
--- a/test/py/tests/test_sleep.py
+++ b/test/py/tests/test_sleep.py
@@ -6,8 +6,8 @@ import pytest
import time
def test_sleep(u_boot_console):
- '''Test the sleep command, and validate that it sleeps for approximately
- the correct amount of time.'''
+ """Test the sleep command, and validate that it sleeps for approximately
+ the correct amount of time."""
# 3s isn't too long, but is enough to cross a few second boundaries.
sleep_time = 3
diff --git a/test/py/tests/test_ums.py b/test/py/tests/test_ums.py
index f482cfeca1b1..21d40a972581 100644
--- a/test/py/tests/test_ums.py
+++ b/test/py/tests/test_ums.py
@@ -14,7 +14,7 @@ import re
import time
import u_boot_utils
-'''
+"""
Note: This test relies on:
a) boardenv_* to contain configuration values to define which USB ports are
@@ -69,11 +69,11 @@ root permissions. For example:
This entry is only needed if any block_devs above contain a
writable_fs_partition value.
-'''
+"""
@pytest.mark.buildconfigspec('cmd_usb_mass_storage')
def test_ums(u_boot_console, env__usb_dev_port, env__block_devs):
- '''Test the "ums" command; the host system must be able to enumerate a UMS
+ """Test the "ums" command; the host system must be able to enumerate a UMS
device when "ums" is running, block and optionally file I/O are tested,
and this device must disappear when "ums" is aborted.
@@ -88,7 +88,7 @@ def test_ums(u_boot_console, env__usb_dev_port, env__block_devs):
Returns:
Nothing.
- '''
+ """
have_writable_fs_partition = 'writable_fs_partition' in env__block_devs[0]
if not have_writable_fs_partition:
@@ -120,7 +120,7 @@ def test_ums(u_boot_console, env__usb_dev_port, env__block_devs):
mounted_test_fn = mount_point + '/' + mount_subdir + test_f.fn
def start_ums():
- '''Start U-Boot's ums shell command.
+ """Start U-Boot's ums shell command.
This also waits for the host-side USB enumeration process to complete.
@@ -129,7 +129,7 @@ def test_ums(u_boot_console, env__usb_dev_port, env__block_devs):
Returns:
Nothing.
- '''
+ """
u_boot_console.log.action(
'Starting long-running U-Boot ums shell command')
@@ -142,21 +142,21 @@ def test_ums(u_boot_console, env__usb_dev_port, env__block_devs):
fh.close()
def mount():
- '''Mount the block device that U-Boot exports.
+ """Mount the block device that U-Boot exports.
Args:
None.
Returns:
Nothing.
- '''
+ """
u_boot_console.log.action('Mounting exported UMS device')
cmd = ('/bin/mount', host_ums_part_node)
u_boot_utils.run_and_log(u_boot_console, cmd)
def umount(ignore_errors):
- '''Unmount the block device that U-Boot exports.
+ """Unmount the block device that U-Boot exports.
Args:
ignore_errors: Ignore any errors. This is useful if an error has
@@ -166,14 +166,14 @@ def test_ums(u_boot_console, env__usb_dev_port, env__block_devs):
Returns:
Nothing.
- '''
+ """
u_boot_console.log.action('Unmounting UMS device')
cmd = ('/bin/umount', host_ums_part_node)
u_boot_utils.run_and_log(u_boot_console, cmd, ignore_errors)
def stop_ums(ignore_errors):
- '''Stop U-Boot's ums shell command from executing.
+ """Stop U-Boot's ums shell command from executing.
This also waits for the host-side USB de-enumeration process to
complete.
@@ -186,7 +186,7 @@ def test_ums(u_boot_console, env__usb_dev_port, env__block_devs):
Returns:
Nothing.
- '''
+ """
u_boot_console.log.action(
'Stopping long-running U-Boot ums shell command')
diff --git a/test/py/tests/test_unknown_cmd.py b/test/py/tests/test_unknown_cmd.py
index 2de93e0026ff..c27ab49d5517 100644
--- a/test/py/tests/test_unknown_cmd.py
+++ b/test/py/tests/test_unknown_cmd.py
@@ -4,8 +4,8 @@
# SPDX-License-Identifier: GPL-2.0
def test_unknown_command(u_boot_console):
- '''Test that executing an unknown command causes U-Boot to print an
- error.'''
+ """Test that executing an unknown command causes U-Boot to print an
+ error."""
# The "unknown command" error is actively expected here,
# so error detection for it is disabled.
diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index bb834b0d34ab..c500fb3ae535 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -24,12 +24,12 @@ pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'')
pattern_error_notification = re.compile('## Error: ')
class ConsoleDisableCheck(object):
- '''Context manager (for Python's with statement) that temporarily disables
+ """Context manager (for Python's with statement) that temporarily disables
the specified console output error check. This is useful when deliberately
executing a command that is known to trigger one of the error checks, in
order to test that the error condition is actually raised. This class is
used internally by ConsoleBase::disable_check(); it is not intended for
- direct usage.'''
+ direct usage."""
def __init__(self, console, check_type):
self.console = console
@@ -42,13 +42,13 @@ class ConsoleDisableCheck(object):
self.console.disable_check_count[self.check_type] -= 1
class ConsoleBase(object):
- '''The interface through which test functions interact with the U-Boot
+ """The interface through which test functions interact with the U-Boot
console. This primarily involves executing shell commands, capturing their
results, and checking for common error conditions. Some common utilities
- are also provided too.'''
+ are also provided too."""
def __init__(self, log, config, max_fifo_fill):
- '''Initialize a U-Boot console connection.
+ """Initialize a U-Boot console connection.
Can only usefully be called by sub-classes.
@@ -65,7 +65,7 @@ class ConsoleBase(object):
Returns:
Nothing.
- '''
+ """
self.log = log
self.config = config
@@ -88,7 +88,7 @@ class ConsoleBase(object):
self.at_prompt_logevt = None
def close(self):
- '''Terminate the connection to the U-Boot console.
+ """Terminate the connection to the U-Boot console.
This function is only useful once all interaction with U-Boot is
complete. Once this function is called, data cannot be sent to or
@@ -99,7 +99,7 @@ class ConsoleBase(object):
Returns:
Nothing.
- '''
+ """
if self.p:
self.p.close()
@@ -107,7 +107,7 @@ class ConsoleBase(object):
def run_command(self, cmd, wait_for_echo=True, send_nl=True,
wait_for_prompt=True):
- '''Execute a command via the U-Boot console.
+ """Execute a command via the U-Boot console.
The command is always sent to U-Boot.
@@ -142,7 +142,7 @@ class ConsoleBase(object):
The output from U-Boot during command execution. In other
words, the text U-Boot emitted between the point it echod the
command string and emitted the subsequent command prompts.
- '''
+ """
if self.at_prompt and \
self.at_prompt_logevt != self.logstream.logfile.cur_evt:
@@ -198,7 +198,7 @@ class ConsoleBase(object):
raise
def ctrlc(self):
- '''Send a CTRL-C character to U-Boot.
+ """Send a CTRL-C character to U-Boot.
This is useful in order to stop execution of long-running synchronous
commands such as "ums".
@@ -208,13 +208,13 @@ class ConsoleBase(object):
Returns:
Nothing.
- '''
+ """
self.log.action('Sending Ctrl-C')
self.run_command(chr(3), wait_for_echo=False, send_nl=False)
def wait_for(self, text):
- '''Wait for a pattern to be emitted by U-Boot.
+ """Wait for a pattern to be emitted by U-Boot.
This is useful when a long-running command such as "dfu" is executing,
and it periodically emits some text that should show up at a specific
@@ -226,14 +226,14 @@ class ConsoleBase(object):
Returns:
Nothing.
- '''
+ """
if type(text) == type(''):
text = re.escape(text)
self.p.expect([text])
def drain_console(self):
- '''Read from and log the U-Boot console for a short time.
+ """Read from and log the U-Boot console for a short time.
U-Boot's console output is only logged when the test code actively
waits for U-Boot to emit specific data. There are cases where tests
@@ -248,7 +248,7 @@ class ConsoleBase(object):
Returns:
Nothing.
- '''
+ """
# If we are already not connected to U-Boot, there's nothing to drain.
# This should only happen when a previous call to run_command() or
@@ -270,7 +270,7 @@ class ConsoleBase(object):
self.p.timeout = orig_timeout
def ensure_spawned(self):
- '''Ensure a connection to a correctly running U-Boot instance.
+ """Ensure a connection to a correctly running U-Boot instance.
This may require spawning a new Sandbox process or resetting target
hardware, as defined by the implementation sub-class.
@@ -282,7 +282,7 @@ class ConsoleBase(object):
Returns:
Nothing.
- '''
+ """
if self.p:
return
@@ -320,7 +320,7 @@ class ConsoleBase(object):
raise
def cleanup_spawn(self):
- '''Shut down all interaction with the U-Boot instance.
+ """Shut down all interaction with the U-Boot instance.
This is used when an error is detected prior to re-establishing a
connection with a fresh U-Boot instance.
@@ -332,7 +332,7 @@ class ConsoleBase(object):
Returns:
Nothing.
- '''
+ """
try:
if self.p:
@@ -342,7 +342,7 @@ class ConsoleBase(object):
self.p = None
def validate_version_string_in_text(self, text):
- '''Assert that a command's output includes the U-Boot signon message.
+ """Assert that a command's output includes the U-Boot signon message.
This is primarily useful for validating the "version" command without
duplicating the signon text regex in a test function.
@@ -352,12 +352,12 @@ class ConsoleBase(object):
Returns:
Nothing. An exception is raised if the validation fails.
- '''
+ """
assert(self.u_boot_version_string in text)
def disable_check(self, check_type):
- '''Temporarily disable an error check of U-Boot's output.
+ """Temporarily disable an error check of U-Boot's output.
Create a new context manager (for use with the "with" statement) which
temporarily disables a particular console output error check.
@@ -368,6 +368,6 @@ class ConsoleBase(object):
Returns:
A context manager object.
- '''
+ """
return ConsoleDisableCheck(self, check_type)
diff --git a/test/py/u_boot_console_exec_attach.py b/test/py/u_boot_console_exec_attach.py
index 0ca9e7c178ec..19520cb3b907 100644
--- a/test/py/u_boot_console_exec_attach.py
+++ b/test/py/u_boot_console_exec_attach.py
@@ -11,15 +11,15 @@ from u_boot_spawn import Spawn
from u_boot_console_base import ConsoleBase
class ConsoleExecAttach(ConsoleBase):
- '''Represents a physical connection to a U-Boot console, typically via a
+ """Represents a physical connection to a U-Boot console, typically via a
serial port. This implementation executes a sub-process to attach to the
console, expecting that the stdin/out of the sub-process will be forwarded
to/from the physical hardware. This approach isolates the test infra-
structure from the user-/installation-specific details of how to
- communicate with, and the identity of, serial ports etc.'''
+ communicate with, and the identity of, serial ports etc."""
def __init__(self, log, config):
- '''Initialize a U-Boot console connection.
+ """Initialize a U-Boot console connection.
Args:
log: A multiplexed_log.Logfile instance.
@@ -27,7 +27,7 @@ class ConsoleExecAttach(ConsoleBase):
Returns:
Nothing.
- '''
+ """
# The max_fifo_fill value might need tweaking per-board/-SoC?
# 1 would be safe anywhere, but is very slow (a pexpect issue?).
@@ -42,7 +42,7 @@ class ConsoleExecAttach(ConsoleBase):
runner.close()
def get_spawn(self):
- '''Connect to a fresh U-Boot instance.
+ """Connect to a fresh U-Boot instance.
The target board is reset, so that U-Boot begins running from scratch.
@@ -51,7 +51,7 @@ class ConsoleExecAttach(ConsoleBase):
Returns:
A u_boot_spawn.Spawn object that is attached to U-Boot.
- '''
+ """
args = [self.config.board_type, self.config.board_identity]
s = Spawn(['u-boot-test-console'] + args)
diff --git a/test/py/u_boot_console_sandbox.py b/test/py/u_boot_console_sandbox.py
index eb84150a1e44..267f8b06508b 100644
--- a/test/py/u_boot_console_sandbox.py
+++ b/test/py/u_boot_console_sandbox.py
@@ -10,11 +10,11 @@ from u_boot_spawn import Spawn
from u_boot_console_base import ConsoleBase
class ConsoleSandbox(ConsoleBase):
- '''Represents a connection to a sandbox U-Boot console, executed as a sub-
- process.'''
+ """Represents a connection to a sandbox U-Boot console, executed as a sub-
+ process."""
def __init__(self, log, config):
- '''Initialize a U-Boot console connection.
+ """Initialize a U-Boot console connection.
Args:
log: A multiplexed_log.Logfile instance.
@@ -22,12 +22,12 @@ class ConsoleSandbox(ConsoleBase):
Returns:
Nothing.
- '''
+ """
super(ConsoleSandbox, self).__init__(log, config, max_fifo_fill=1024)
def get_spawn(self):
- '''Connect to a fresh U-Boot instance.
+ """Connect to a fresh U-Boot instance.
A new sandbox process is created, so that U-Boot begins running from
scratch.
@@ -37,25 +37,25 @@ class ConsoleSandbox(ConsoleBase):
Returns:
A u_boot_spawn.Spawn object that is attached to U-Boot.
- '''
+ """
return Spawn([self.config.build_dir + '/u-boot'])
def kill(self, sig):
- '''Send a specific Unix signal to the sandbox process.
+ """Send a specific Unix signal to the sandbox process.
Args:
sig: The Unix signal to send to the process.
Returns:
Nothing.
- '''
+ """
self.log.action('kill %d' % sig)
self.p.kill(sig)
def validate_exited(self):
- '''Determine whether the sandbox process has exited.
+ """Determine whether the sandbox process has exited.
If required, this function waits a reasonable time for the process to
exit.
@@ -65,7 +65,7 @@ class ConsoleSandbox(ConsoleBase):
Returns:
Boolean indicating whether the process has exited.
- '''
+ """
p = self.p
self.p = None
diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index df4c67597cab..d50807599027 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -12,23 +12,23 @@ import select
import time
class Timeout(Exception):
- '''An exception sub-class that indicates that a timeout occurred.'''
+ """An exception sub-class that indicates that a timeout occurred."""
pass
class Spawn(object):
- '''Represents the stdio of a freshly created sub-process. Commands may be
+ """Represents the stdio of a freshly created sub-process. Commands may be
sent to the process, and responses waited for.
- '''
+ """
def __init__(self, args):
- '''Spawn (fork/exec) the sub-process.
+ """Spawn (fork/exec) the sub-process.
Args:
args: array of processs arguments. argv[0] is the command to execute.
Returns:
Nothing.
- '''
+ """
self.waited = False
self.buf = ''
@@ -56,26 +56,26 @@ class Spawn(object):
self.poll.register(self.fd, select.POLLIN | select.POLLPRI | select.POLLERR | select.POLLHUP | select.POLLNVAL)
def kill(self, sig):
- '''Send unix signal "sig" to the child process.
+ """Send unix signal "sig" to the child process.
Args:
sig: The signal number to send.
Returns:
Nothing.
- '''
+ """
os.kill(self.pid, sig)
def isalive(self):
- '''Determine whether the child process is still running.
+ """Determine whether the child process is still running.
Args:
None.
Returns:
Boolean indicating whether process is alive.
- '''
+ """
if self.waited:
return False
@@ -88,19 +88,19 @@ class Spawn(object):
return False
def send(self, data):
- '''Send data to the sub-process's stdin.
+ """Send data to the sub-process's stdin.
Args:
data: The data to send to the process.
Returns:
Nothing.
- '''
+ """
os.write(self.fd, data)
def expect(self, patterns):
- '''Wait for the sub-process to emit specific data.
+ """Wait for the sub-process to emit specific data.
This function waits for the process to emit one pattern from the
supplied list of patterns, or for a timeout to occur.
@@ -116,7 +116,7 @@ class Spawn(object):
Notable exceptions:
Timeout, if the process did not emit any of the patterns within
the expected time.
- '''
+ """
for pi in xrange(len(patterns)):
if type(patterns[pi]) == type(''):
@@ -161,7 +161,7 @@ class Spawn(object):
self.logfile_read.flush()
def close(self):
- '''Close the stdio connection to the sub-process.
+ """Close the stdio connection to the sub-process.
This also waits a reasonable time for the sub-process to stop running.
@@ -170,7 +170,7 @@ class Spawn(object):
Returns:
Nothing.
- '''
+ """
os.close(self.fd)
for i in xrange(100):
diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py
index 522390a207ef..72d24e42aa33 100644
--- a/test/py/u_boot_utils.py
+++ b/test/py/u_boot_utils.py
@@ -11,21 +11,21 @@ import sys
import time
def md5sum_data(data):
- '''Calculate the MD5 hash of some data.
+ """Calculate the MD5 hash of some data.
Args:
data: The data to hash.
Returns:
The hash of the data, as a binary string.
- '''
+ """
h = hashlib.md5()
h.update(data)
return h.digest()
def md5sum_file(fn, max_length=None):
- '''Calculate the MD5 hash of the contents of a file.
+ """Calculate the MD5 hash of the contents of a file.
Args:
fn: The filename of the file to hash.
@@ -35,7 +35,7 @@ def md5sum_file(fn, max_length=None):
Returns:
The hash of the file content, as a binary string.
- '''
+ """
with open(fn, 'rb') as fh:
if max_length:
@@ -46,11 +46,11 @@ def md5sum_file(fn, max_length=None):
return md5sum_data(data)
class PersistentRandomFile(object):
- '''Generate and store information about a persistent file containing
- random data.'''
+ """Generate and store information about a persistent file containing
+ random data."""
def __init__(self, u_boot_console, fn, size):
- '''Create or process the persistent file.
+ """Create or process the persistent file.
If the file does not exist, it is generated.
@@ -66,7 +66,7 @@ class PersistentRandomFile(object):
Returns:
Nothing.
- '''
+ """
self.fn = fn
@@ -85,7 +85,7 @@ class PersistentRandomFile(object):
self.content_hash = md5sum_data(data)
def attempt_to_open_file(fn):
- '''Attempt to open a file, without throwing exceptions.
+ """Attempt to open a file, without throwing exceptions.
Any errors (exceptions) that occur during the attempt to open the file
are ignored. This is useful in order to test whether a file (in
@@ -98,7 +98,7 @@ def attempt_to_open_file(fn):
Returns:
An open file handle to the file, or None if the file could not be
opened.
- '''
+ """
try:
return open(fn, 'rb')
@@ -106,7 +106,7 @@ def attempt_to_open_file(fn):
return None
def wait_until_open_succeeds(fn):
- '''Poll until a file can be opened, or a timeout occurs.
+ """Poll until a file can be opened, or a timeout occurs.
Continually attempt to open a file, and return when this succeeds, or
raise an exception after a timeout.
@@ -116,7 +116,7 @@ def wait_until_open_succeeds(fn):
Returns:
An open file handle to the file.
- '''
+ """
for i in xrange(100):
fh = attempt_to_open_file(fn)
@@ -126,7 +126,7 @@ def wait_until_open_succeeds(fn):
raise Exception('File could not be opened')
def wait_until_file_open_fails(fn, ignore_errors):
- '''Poll until a file cannot be opened, or a timeout occurs.
+ """Poll until a file cannot be opened, or a timeout occurs.
Continually attempt to open a file, and return when this fails, or
raise an exception after a timeout.
@@ -139,7 +139,7 @@ def wait_until_file_open_fails(fn, ignore_errors):
Returns:
Nothing.
- '''
+ """
for i in xrange(100):
fh = attempt_to_open_file(fn)
@@ -152,7 +152,7 @@ def wait_until_file_open_fails(fn, ignore_errors):
raise Exception('File can still be opened')
def run_and_log(u_boot_console, cmd, ignore_errors=False):
- '''Run a command and log its output.
+ """Run a command and log its output.
Args:
u_boot_console: A console connection to U-Boot.
@@ -164,7 +164,7 @@ def run_and_log(u_boot_console, cmd, ignore_errors=False):
Returns:
Nothing.
- '''
+ """
runner = u_boot_console.log.get_runner(cmd[0], sys.stdout)
runner.run(cmd, ignore_errors=ignore_errors)
@@ -172,7 +172,7 @@ def run_and_log(u_boot_console, cmd, ignore_errors=False):
ram_base = None
def find_ram_base(u_boot_console):
- '''Find the running U-Boot's RAM location.
+ """Find the running U-Boot's RAM location.
Probe the running U-Boot to determine the address of the first bank
of RAM. This is useful for tests that test reading/writing RAM, or
@@ -186,7 +186,7 @@ def find_ram_base(u_boot_console):
Returns:
The address of U-Boot's first RAM bank, as an integer.
- '''
+ """
global ram_base
if u_boot_console.config.buildconfig.get('config_cmd_bdi', 'n') != 'y':
--
2.7.0
2
5

29 Jan '16
From: Stephen Warren <swarren(a)nvidia.com>
With CONFIG_DM_PCI enabled, PCI buses are not enumerated at boot, as they
are without that config option enabled. No command exists to enumerate the
PCI buses. Hence, unless some board-specific code causes PCI enumeration,
PCI-based Ethernet devices are not detected, and network access is not
available.
This patch implements "pci enum" in the CONFIG_DM_PCI case, thus giving a
mechanism whereby PCI can be enumerated.
do_pci()'s handling of case 'e' is moved into a single location before the
dev variable is assigned, in order to skip calculation of dev. The enum
sub-command doesn't need the dev value, and skipping its calculation
avoids an irrelevant error being printed.
Using a command to initialize PCI like this has a disadvantage relative to
enumerating PCI at boot. In particular, Ethernet devices are not probed
during PCI enumeration, but only when used. This defers setting variables
such as ethact, ethaddr, etc. until the first network-related command is
executed. Hopefully this will not cause further issues. Perhaps in the
long term, we need a "net start/enum" command too?
Signed-off-by: Stephen Warren <swarren(a)nvidia.com>
---
This series naturally needs to be applied in order in a single branch.
This series depends on all previous applied test/py patches.
common/cmd_pci.c | 18 +++++-------------
drivers/pci/pci-uclass.c | 15 +++++++++++++++
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/common/cmd_pci.c b/common/cmd_pci.c
index 8094d3380fbd..2f4978af9fe3 100644
--- a/common/cmd_pci.c
+++ b/common/cmd_pci.c
@@ -578,9 +578,10 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if ((bdf = get_pci_dev(argv[2])) == -1)
return 1;
break;
-#ifdef CONFIG_CMD_PCI_ENUM
+#if defined(CONFIG_CMD_PCI_ENUM) || defined(CONFIG_DM_PCI)
case 'e':
- break;
+ pci_init();
+ return 0;
#endif
default: /* scan bus */
value = 1; /* short listing */
@@ -621,15 +622,6 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
break;
case 'd': /* display */
return pci_cfg_display(dev, addr, size, value);
-#ifdef CONFIG_CMD_PCI_ENUM
- case 'e':
-# ifdef CONFIG_DM_PCI
- printf("This command is not yet supported with driver model\n");
-# else
- pci_init();
-# endif
- break;
-#endif
case 'n': /* next */
if (argc < 4)
goto usage;
@@ -665,9 +657,9 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static char pci_help_text[] =
"[bus] [long]\n"
" - short or long list of PCI devices on bus 'bus'\n"
-#ifdef CONFIG_CMD_PCI_ENUM
+#if defined(CONFIG_CMD_PCI_ENUM) || defined(CONFIG_DM_PCI)
"pci enum\n"
- " - re-enumerate PCI buses\n"
+ " - Enumerate PCI buses\n"
#endif
"pci header b.d.f\n"
" - show header of PCI device 'bus.device.function'\n"
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 685df9d274e4..f51f08289d66 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -1247,3 +1247,18 @@ U_BOOT_DRIVER(pci_generic_drv) = {
.id = UCLASS_PCI_GENERIC,
.of_match = pci_generic_ids,
};
+
+void pci_init(void)
+{
+ struct udevice *bus;
+
+ /*
+ * Enumerate all known controller devices. Enumeration has the side-
+ * effect of probing them, so PCIe devices will be enumerated too.
+ */
+ for (uclass_first_device(UCLASS_PCI, &bus);
+ bus;
+ uclass_next_device(&bus)) {
+ ;
+ }
+}
--
2.7.0
3
12

[U-Boot] [PATCH 1/2] ARM: tegra: shut down USB device controller at boot
by Stephen Warren 29 Jan '16
by Stephen Warren 29 Jan '16
29 Jan '16
From: Stephen Warren <swarren(a)nvidia.com>
When loading U-Boot into RAM over USB protocols using tools such as
tegrarcm or L4T's exec-uboot.sh/tegraflash.py, Tegra's USB device
mode controller is initialized and enumerated by the host PC running
the tool. Unfortunately, these tools do not shut down the USB
controller before executing the downloaded code, and so the host PC
does not "de-enumerate" the USB device. This patch implements optional
code to shut down the USB controller when U-Boot boots to avoid leaving
a stale USB device present.
Signed-off-by: Stephen Warren <swarren(a)nvidia.com>
---
This patch needs to be applied along with the next patch in this series,
likely in u-boot-dm since that patch modifies test code that's only
currently present in u-boot-dm.
---
arch/arm/mach-tegra/Kconfig | 13 +++++++++++++
arch/arm/mach-tegra/board2.c | 10 +++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 48a387c95713..0b2852c4dae5 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -52,6 +52,19 @@ config TEGRA210
endchoice
+config TEGRA_DISCONNECT_UDC_ON_BOOT
+ bool "Disconnect USB device mode controller on boot"
+ default y
+ help
+ When loading U-Boot into RAM over USB protocols using tools such as
+ tegrarcm or L4T's exec-uboot.sh/tegraflash.py, Tegra's USB device
+ mode controller is initialized and enumerated by the host PC running
+ the tool. Unfortunately, these tools do not shut down the USB
+ controller before executing the downloaded code, and so the host PC
+ does not "de-enumerate" the USB device. This option shuts down the
+ USB controller when U-Boot boots to avoid leaving a stale USB device
+ present.
+
config SYS_MALLOC_F_LEN
default 0x1800
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index a650abd731ad..60e19c838784 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -34,8 +34,8 @@
#ifdef CONFIG_TEGRA_CLOCK_SCALING
#include <asm/arch/emc.h>
#endif
-#ifdef CONFIG_USB_EHCI_TEGRA
#include <asm/arch-tegra/usb.h>
+#ifdef CONFIG_USB_EHCI_TEGRA
#include <usb.h>
#endif
#ifdef CONFIG_TEGRA_MMC
@@ -201,6 +201,14 @@ void gpio_early_init(void) __attribute__((weak, alias("__gpio_early_init")));
int board_early_init_f(void)
{
+#if defined(CONFIG_TEGRA_DISCONNECT_UDC_ON_BOOT)
+#define USBCMD_FS2 (1 << 15)
+ {
+ struct usb_ctlr *usbctlr = (struct usb_ctlr *)0x7d000000;
+ writel(USBCMD_FS2, &usbctlr->usb_cmd);
+ }
+#endif
+
/* Do any special system timer/TSC setup */
#if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
if (!tegra_cpu_is_non_secure())
--
2.7.0
2
5
From: Stephen Warren <swarren(a)nvidia.com>
test/py contains logic to detect the target crashing and rebooting by
searching the console output for a U-Boot signon message, which will
presumably be emitted when the system boots after the crash/reset.
Currently, this logic only searches for the exact signon message that
was printed by the U-Boot version under test, upon the assumption that
binary is written into flash, and hence will be the version booted after
any reset. However, this is not a valid assumption; some test setups
download the U-Boot-under-test into RAM and boot it from there, and in
such a scenario an arbitrary U-Boot version may be located in flash and
hence run after any reset.
Fix the reset detection logic to match any U-Boot signon message. This
prevents false negatives.
Signed-off-by: Stephen Warren <swarren(a)nvidia.com>
---
test/py/u_boot_console_base.py | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index 51163bc0db68..bb834b0d34ab 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -150,12 +150,11 @@ class ConsoleBase(object):
bad_patterns = []
bad_pattern_ids = []
- if (self.disable_check_count['spl_signon'] == 0 and
- self.u_boot_spl_signon):
- bad_patterns.append(self.u_boot_spl_signon_escaped)
+ if (self.disable_check_count['spl_signon'] == 0):
+ bad_patterns.append(pattern_u_boot_spl_signon)
bad_pattern_ids.append('SPL signon')
if self.disable_check_count['main_signon'] == 0:
- bad_patterns.append(self.u_boot_main_signon_escaped)
+ bad_patterns.append(pattern_u_boot_main_signon)
bad_pattern_ids.append('U-Boot main signon')
if self.disable_check_count['unknown_command'] == 0:
bad_patterns.append(pattern_unknown_command)
@@ -299,18 +298,13 @@ class ConsoleBase(object):
self.p.logfile_read = self.logstream
if self.config.buildconfig.get('CONFIG_SPL', False) == 'y':
self.p.expect([pattern_u_boot_spl_signon])
- self.u_boot_spl_signon = self.p.after
- self.u_boot_spl_signon_escaped = re.escape(self.p.after)
- else:
- self.u_boot_spl_signon = None
self.p.expect([pattern_u_boot_main_signon])
- self.u_boot_main_signon = self.p.after
- self.u_boot_main_signon_escaped = re.escape(self.p.after)
- build_idx = self.u_boot_main_signon.find(', Build:')
+ signon = self.p.after
+ build_idx = signon.find(', Build:')
if build_idx == -1:
- self.u_boot_version_string = self.u_boot_main_signon
+ self.u_boot_version_string = signon
else:
- self.u_boot_version_string = self.u_boot_main_signon[:build_idx]
+ self.u_boot_version_string = signon[:build_idx]
while True:
match = self.p.expect([self.prompt_escaped,
pattern_stop_autoboot_prompt])
--
2.7.0
2
4
This function is not used as the use case for it did not eventuate. Remove
it to avoid confusion.
Signed-off-by: Simon Glass <sjg(a)chromium.org>
---
drivers/core/device.c | 9 +--------
include/dm/device-internal.h | 13 -------------
2 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/drivers/core/device.c b/drivers/core/device.c
index f5def35..cb24a61 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -223,7 +223,7 @@ static void *alloc_priv(int size, uint flags)
return priv;
}
-int device_probe_child(struct udevice *dev, void *parent_priv)
+int device_probe(struct udevice *dev)
{
const struct driver *drv;
int size = 0;
@@ -270,8 +270,6 @@ int device_probe_child(struct udevice *dev, void *parent_priv)
ret = -ENOMEM;
goto fail;
}
- if (parent_priv)
- memcpy(dev->parent_priv, parent_priv, size);
}
ret = device_probe(dev->parent);
@@ -349,11 +347,6 @@ fail:
return ret;
}
-int device_probe(struct udevice *dev)
-{
- return device_probe_child(dev, NULL);
-}
-
void *dev_get_platdata(struct udevice *dev)
{
if (!dev) {
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index 9388870..b348ad5 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -66,19 +66,6 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
int device_probe(struct udevice *dev);
/**
- * device_probe() - Probe a child device, activating it
- *
- * Activate a device so that it is ready for use. All its parents are probed
- * first. The child is provided with parent data if parent_priv is not NULL.
- *
- * @dev: Pointer to device to probe
- * @parent_priv: Pointer to parent data. If non-NULL then this is provided to
- * the child.
- * @return 0 if OK, -ve on error
- */
-int device_probe_child(struct udevice *dev, void *parent_priv);
-
-/**
* device_remove() - Remove a device, de-activating it
*
* De-activate a device so that it is no longer ready for use. All its
--
2.7.0.rc3.207.g0ac5344
3
3