1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0-or-later 3# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz> 4 5# testing shell timeout handling in _tst_kill_test() 6# expected output: 7# timeout03 1 TINFO: timeout per run is 0h 0m 1s 8# timeout03 1 TINFO: testing killing test after TST_TIMEOUT 9# timeout03 1 TBROK: Test timeouted, sending SIGINT! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1 10# timeout03 1 TBROK: test interrupted or timed out 11# timeout03 1 TPASS: test run cleanup after timeout 12# timeout03 1 TINFO: Test is still running, waiting 10s 13# timeout03 1 TINFO: Test is still running, waiting 9s 14# timeout03 1 TINFO: Test is still running, waiting 8s 15# timeout03 1 TINFO: Test is still running, waiting 7s 16# timeout03 1 TINFO: Test is still running, waiting 6s 17# timeout03 1 TINFO: Test is still running, waiting 5s 18# timeout03 1 TINFO: Test is still running, waiting 4s 19# timeout03 1 TINFO: Test is still running, waiting 3s 20# timeout03 1 TINFO: Test is still running, waiting 2s 21# timeout03 1 TINFO: Test is still running, waiting 1s 22# timeout03 1 TBROK: Test still running, sending SIGKILL 23# Killed 24 25TST_TESTFUNC=do_test 26TST_CLEANUP=cleanup 27 28TST_TIMEOUT=1 29. tst_test.sh 30 31do_test() 32{ 33 tst_res TINFO "testing killing test after TST_TIMEOUT" 34 35 sleep 2 36 tst_res TFAIL "test: running after TST_TIMEOUT" 37} 38 39cleanup() 40{ 41 tst_res TPASS "test run cleanup after timeout" 42 43 sleep 15 # must be higher than wait time in _tst_kill_test 44 tst_res TFAIL "cleanup: running after TST_TIMEOUT" 45} 46 47tst_run 48