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