xref: /aosp_15_r20/external/ltp/testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_pid.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
16LOOP=300
17
18while true; do
19	j=0
20	while [ $j -lt $LOOP ]; do
21		k=1
22		while [ $k -le $NR_PIDS ]; do
23			str="\$pid$k"
24			eval echo $str >> "$TRACING_PATH"/set_ftrace_pid
25			k=$((k + 1))
26		done
27
28		if ! echo > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1; then
29			if ! echo -1 > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1; then
30				tst_resm TBROK "Cannot disable set_ftrace_pid!"
31				exit 1
32			fi
33		fi
34		j=$((j + 1))
35	done
36	sleep 1
37done
38