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