1# SPDX-License-Identifier: GPL-2.0 2# Copyright (c) 2015 Stephen Warren 3# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. 4 5import pytest 6import signal 7 8@pytest.mark.boardspec('sandbox') 9@pytest.mark.buildconfigspec('sysreset_cmd_poweroff') 10def test_poweroff(ubman): 11 """Test that the "poweroff" command exits sandbox process.""" 12 13 ubman.run_command('poweroff', wait_for_prompt=False) 14 assert(ubman.validate_exited()) 15 16@pytest.mark.boardspec('sandbox') 17def test_ctrl_c(ubman): 18 """Test that sending SIGINT to sandbox causes it to exit.""" 19 20 ubman.kill(signal.SIGINT) 21 assert(ubman.validate_exited()) 22 23@pytest.mark.boardspec('sandbox') 24@pytest.mark.buildconfigspec('cmd_exception') 25@pytest.mark.buildconfigspec('sandbox_crash_reset') 26def test_exception_reset(ubman): 27 """Test that SIGILL causes a reset.""" 28 29 ubman.run_command('exception undefined', wait_for_prompt=False) 30 m = ubman.p.expect(['resetting ...', 'U-Boot']) 31 if m != 0: 32 raise Exception('SIGILL did not lead to reset') 33 m = ubman.p.expect(['U-Boot', '=>']) 34 if m != 0: 35 raise Exception('SIGILL did not lead to reset') 36 ubman.restart_uboot() 37 38@pytest.mark.boardspec('sandbox') 39@pytest.mark.buildconfigspec('cmd_exception') 40@pytest.mark.notbuildconfigspec('sandbox_crash_reset') 41def test_exception_exit(ubman): 42 """Test that SIGILL causes a reset.""" 43 44 ubman.run_command('exception undefined', wait_for_prompt=False) 45 assert(ubman.validate_exited()) 46