1d201506cSStephen Warren# Copyright (c) 2015 Stephen Warren
2d201506cSStephen Warren# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3d201506cSStephen Warren#
4d201506cSStephen Warren# SPDX-License-Identifier: GPL-2.0
5d201506cSStephen Warren
6d201506cSStephen Warren# pytest runs tests the order of their module path, which is related to the
7d201506cSStephen Warren# filename containing the test. This file is named such that it is sorted
8d201506cSStephen Warren# first, simply as a very basic sanity check of the functionality of the U-Boot
9d201506cSStephen Warren# command prompt.
10d201506cSStephen Warren
11d201506cSStephen Warrendef test_version(u_boot_console):
12*e8debf39SStephen Warren    """Test that the "version" command prints the U-Boot version."""
13d201506cSStephen Warren
14d201506cSStephen Warren    # "version" prints the U-Boot sign-on message. This is usually considered
15d201506cSStephen Warren    # an error, so that any unexpected reboot causes an error. Here, this
16d201506cSStephen Warren    # error detection is disabled since the sign-on message is expected.
17d201506cSStephen Warren    with u_boot_console.disable_check('main_signon'):
18d201506cSStephen Warren        response = u_boot_console.run_command('version')
19d201506cSStephen Warren    # Ensure "version" printed what we expected.
20d201506cSStephen Warren    u_boot_console.validate_version_string_in_text(response)
21