xref: /aosp_15_r20/external/ltp/testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_pipe.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1#! /bin/sh
2
3###############################################################################
4#                                                                             #
5# Copyright (c) 2010 FUJITSU LIMITED                                          #
6#                                                                             #
7# This program is free software; you can redistribute it and/or modify it     #
8# under the terms of the GNU General Public License as published by the Free  #
9# Software Foundation; either version 2 of the License, or (at your option)   #
10# any later version.                                                          #
11#                                                                             #
12# Author: Li Zefan <[email protected]>                                      #
13#                                                                             #
14###############################################################################
15
16kill_this_pid()
17{
18	kill -KILL $this_pid
19	wait $this_pid
20	exit 0
21}
22
23trap kill_this_pid SIGUSR1
24
25LOOP=20
26
27while true; do
28	i=0
29	while [ $i -lt $LOOP ]; do
30		cat "$TRACING_PATH"/trace_pipe > /dev/null &
31		this_pid=$!
32
33		tst_sleep 200000us
34
35		kill -INT $this_pid
36		wait $this_pid
37
38		this_pid=0
39
40		tst_sleep 200000us
41
42		i=$((i + 1))
43	done
44	sleep 2
45done
46