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