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_timeout_kill 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# Test timed out, sending SIGTERM! 10# If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1 11# Terminated 12# timeout03 1 TBROK: test terminated 13# timeout03 1 TPASS: test run cleanup after timeout 14# Test is still running... 10 15# Test is still running... 9 16# Test is still running... 8 17# Test is still running... 7 18# Test is still running... 6 19# Test is still running... 5 20# Test is still running... 4 21# Test is still running... 3 22# Test is still running... 2 23# Test is still running... 1 24# Test is still running, sending SIGKILL 25# Killed 26 27TST_TESTFUNC=do_test 28TST_CLEANUP=cleanup 29 30TST_TIMEOUT=1 31. tst_test.sh 32 33do_test() 34{ 35 tst_res TINFO "testing killing test after TST_TIMEOUT" 36 37 sleep 2 38 tst_res TFAIL "test: running after TST_TIMEOUT" 39} 40 41cleanup() 42{ 43 tst_res TPASS "test run cleanup after timeout" 44 45 sleep 15 # must be higher than wait time in _tst_kill_test 46 tst_res TFAIL "cleanup: running after TST_TIMEOUT" 47} 48 49tst_run 50