xref: /OK3568_Linux_fs/u-boot/test/py/tests/test_unknown_cmd.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# Copyright (c) 2015 Stephen Warren
2*4882a593Smuzhiyun# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0
5*4882a593Smuzhiyun
6*4882a593Smuzhiyundef test_unknown_command(u_boot_console):
7*4882a593Smuzhiyun    """Test that executing an unknown command causes U-Boot to print an
8*4882a593Smuzhiyun    error."""
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun    # The "unknown command" error is actively expected here,
11*4882a593Smuzhiyun    # so error detection for it is disabled.
12*4882a593Smuzhiyun    with u_boot_console.disable_check('unknown_command'):
13*4882a593Smuzhiyun        response = u_boot_console.run_command('non_existent_cmd')
14*4882a593Smuzhiyun    assert('Unknown command \'non_existent_cmd\' - try \'help\'' in response)
15