xref: /rk3399_rockchip-uboot/test/py/tests/test_sandbox_exit.py (revision 472040d5cbd1bbf9f5f325508b37feb7f129c125)
1*472040d5SStephen Warren# Copyright (c) 2015 Stephen Warren
2*472040d5SStephen Warren# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
3*472040d5SStephen Warren#
4*472040d5SStephen Warren# SPDX-License-Identifier: GPL-2.0
5*472040d5SStephen Warren
6*472040d5SStephen Warrenimport pytest
7*472040d5SStephen Warrenimport signal
8*472040d5SStephen Warren
9*472040d5SStephen Warren@pytest.mark.boardspec('sandbox')
10*472040d5SStephen Warren@pytest.mark.buildconfigspec('reset')
11*472040d5SStephen Warrendef test_reset(u_boot_console):
12*472040d5SStephen Warren    '''Test that the "reset" command exits sandbox process.'''
13*472040d5SStephen Warren
14*472040d5SStephen Warren    u_boot_console.run_command('reset', wait_for_prompt=False)
15*472040d5SStephen Warren    assert(u_boot_console.validate_exited())
16*472040d5SStephen Warren    u_boot_console.ensure_spawned()
17*472040d5SStephen Warren
18*472040d5SStephen Warren@pytest.mark.boardspec('sandbox')
19*472040d5SStephen Warrendef test_ctrl_c(u_boot_console):
20*472040d5SStephen Warren    '''Test that sending SIGINT to sandbox causes it to exit.'''
21*472040d5SStephen Warren
22*472040d5SStephen Warren    u_boot_console.kill(signal.SIGINT)
23*472040d5SStephen Warren    assert(u_boot_console.validate_exited())
24*472040d5SStephen Warren    u_boot_console.ensure_spawned()
25