xref: /linux/tools/perf/tests/shell/base_probe/test_adding_kernel.sh (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1e7d759f3SVeronika Molnarova#!/bin/bash
27255fcc8SArnaldo Carvalho de Melo# Add 'perf probe's, list and remove them
3e7d759f3SVeronika Molnarova# SPDX-License-Identifier: GPL-2.0
4e7d759f3SVeronika Molnarova
5e7d759f3SVeronika Molnarova#
6e7d759f3SVeronika Molnarova#	test_adding_kernel of perf_probe test
7e7d759f3SVeronika Molnarova#	Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
8e7d759f3SVeronika Molnarova#	Author: Michael Petlan <mpetlan@redhat.com>
9e7d759f3SVeronika Molnarova#
10e7d759f3SVeronika Molnarova#	Description:
11e7d759f3SVeronika Molnarova#
12e7d759f3SVeronika Molnarova#		This test tests adding of probes, their correct listing
13e7d759f3SVeronika Molnarova#		and removing.
14e7d759f3SVeronika Molnarova#
15e7d759f3SVeronika Molnarova
16e7d759f3SVeronika Molnarova# include working environment
17e7d759f3SVeronika Molnarova. ../common/init.sh
18e7d759f3SVeronika Molnarova
19e7d759f3SVeronika MolnarovaTEST_RESULT=0
20e7d759f3SVeronika Molnarova
21*90d32e92SAthira Rajeev# shellcheck source=lib/probe_vfs_getname.sh
22*90d32e92SAthira Rajeev. "$(dirname "$0")/../lib/probe_vfs_getname.sh"
23*90d32e92SAthira Rajeev
24e7d759f3SVeronika MolnarovaTEST_PROBE=${TEST_PROBE:-"inode_permission"}
25e7d759f3SVeronika Molnarova
26*90d32e92SAthira Rajeev# set NO_DEBUGINFO to skip testcase if debuginfo is not present
27*90d32e92SAthira Rajeev# skip_if_no_debuginfo returns 2 if debuginfo is not present
28*90d32e92SAthira Rajeevskip_if_no_debuginfo
29*90d32e92SAthira Rajeevif [ $? -eq 2 ]; then
30*90d32e92SAthira Rajeev	NO_DEBUGINFO=1
31*90d32e92SAthira Rajeevfi
32*90d32e92SAthira Rajeev
33e7d759f3SVeronika Molnarovacheck_kprobes_available
34e7d759f3SVeronika Molnarovaif [ $? -ne 0 ]; then
35e7d759f3SVeronika Molnarova	print_overall_skipped
36e7d759f3SVeronika Molnarova	exit 0
37e7d759f3SVeronika Molnarovafi
38e7d759f3SVeronika Molnarova
39e7d759f3SVeronika Molnarova
40e7d759f3SVeronika Molnarova### basic probe adding
41e7d759f3SVeronika Molnarova
42e7d759f3SVeronika Molnarovafor opt in "" "-a" "--add"; do
43e7d759f3SVeronika Molnarova	clear_all_probes
44e7d759f3SVeronika Molnarova	$CMD_PERF probe $opt $TEST_PROBE 2> $LOGS_DIR/adding_kernel_add$opt.err
45e7d759f3SVeronika Molnarova	PERF_EXIT_CODE=$?
46e7d759f3SVeronika Molnarova
47e7d759f3SVeronika Molnarova	../common/check_all_patterns_found.pl "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE" < $LOGS_DIR/adding_kernel_add$opt.err
48e7d759f3SVeronika Molnarova	CHECK_EXIT_CODE=$?
49e7d759f3SVeronika Molnarova
50e7d759f3SVeronika Molnarova	print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "adding probe $TEST_PROBE :: $opt"
51e7d759f3SVeronika Molnarova	(( TEST_RESULT += $? ))
52e7d759f3SVeronika Molnarovadone
53e7d759f3SVeronika Molnarova
54e7d759f3SVeronika Molnarova
55e7d759f3SVeronika Molnarova### listing added probe :: perf list
56e7d759f3SVeronika Molnarova
57e7d759f3SVeronika Molnarova# any added probes should appear in perf-list output
58e7d759f3SVeronika Molnarova$CMD_PERF list probe:\* > $LOGS_DIR/adding_kernel_list.log
59e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
60e7d759f3SVeronika Molnarova
61e7d759f3SVeronika Molnarova../common/check_all_lines_matched.pl "$RE_LINE_EMPTY" "List of pre-defined events" "probe:${TEST_PROBE}(?:_\d+)?\s+\[Tracepoint event\]" "Metric Groups:" < $LOGS_DIR/adding_kernel_list.log
62e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
63e7d759f3SVeronika Molnarova
64e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "listing added probe :: perf list"
65e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
66e7d759f3SVeronika Molnarova
67e7d759f3SVeronika Molnarova
68e7d759f3SVeronika Molnarova### listing added probe :: perf probe -l
69e7d759f3SVeronika Molnarova
70e7d759f3SVeronika Molnarova# '-l' should list all the added probes as well
71e7d759f3SVeronika Molnarova$CMD_PERF probe -l > $LOGS_DIR/adding_kernel_list-l.log
72e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
73e7d759f3SVeronika Molnarova
74e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "\s*probe:${TEST_PROBE}(?:_\d+)?\s+\(on ${TEST_PROBE}(?:[:\+]$RE_NUMBER_HEX)?@.+\)" < $LOGS_DIR/adding_kernel_list-l.log
75e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
76e7d759f3SVeronika Molnarova
77*90d32e92SAthira Rajeevif [ $NO_DEBUGINFO ] ; then
78*90d32e92SAthira Rajeev	print_testcase_skipped $NO_DEBUGINFO $NO_DEBUGINFO "Skipped due to missing debuginfo"
79*90d32e92SAthira Rajeevelse
80e7d759f3SVeronika Molnarova	print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "listing added probe :: perf probe -l"
81*90d32e92SAthira Rajeevfi
82*90d32e92SAthira Rajeev
83e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
84e7d759f3SVeronika Molnarova
85e7d759f3SVeronika Molnarova
86e7d759f3SVeronika Molnarova### using added probe
87e7d759f3SVeronika Molnarova
88e7d759f3SVeronika Molnarova$CMD_PERF stat -e probe:$TEST_PROBE\* -o $LOGS_DIR/adding_kernel_using_probe.log -- cat /proc/uptime > /dev/null
89e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
90e7d759f3SVeronika Molnarova
91e7d759f3SVeronika MolnarovaREGEX_STAT_HEADER="\s*Performance counter stats for \'cat /proc/uptime\':"
92e7d759f3SVeronika MolnarovaREGEX_STAT_VALUES="\s*\d+\s+probe:$TEST_PROBE"
93e7d759f3SVeronika Molnarova# the value should be greater than 1
94e7d759f3SVeronika MolnarovaREGEX_STAT_VALUE_NONZERO="\s*[1-9][0-9]*\s+probe:$TEST_PROBE"
95e7d759f3SVeronika MolnarovaREGEX_STAT_TIME="\s*$RE_NUMBER\s+seconds (?:time elapsed|user|sys)"
96e7d759f3SVeronika Molnarova../common/check_all_lines_matched.pl "$REGEX_STAT_HEADER" "$REGEX_STAT_VALUES" "$REGEX_STAT_TIME" "$RE_LINE_COMMENT" "$RE_LINE_EMPTY" < $LOGS_DIR/adding_kernel_using_probe.log
97e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
98e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "$REGEX_STAT_HEADER" "$REGEX_STAT_VALUE_NONZERO" "$REGEX_STAT_TIME" < $LOGS_DIR/adding_kernel_using_probe.log
99e7d759f3SVeronika Molnarova(( CHECK_EXIT_CODE += $? ))
100e7d759f3SVeronika Molnarova
101e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "using added probe"
102e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
103e7d759f3SVeronika Molnarova
104e7d759f3SVeronika Molnarova
105e7d759f3SVeronika Molnarova### removing added probe
106e7d759f3SVeronika Molnarova
107e7d759f3SVeronika Molnarova# '-d' should remove the probe
108e7d759f3SVeronika Molnarova$CMD_PERF probe -d $TEST_PROBE\* 2> $LOGS_DIR/adding_kernel_removing.err
109e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
110e7d759f3SVeronika Molnarova
111e7d759f3SVeronika Molnarova../common/check_all_lines_matched.pl "Removed event: probe:$TEST_PROBE" < $LOGS_DIR/adding_kernel_removing.err
112e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
113e7d759f3SVeronika Molnarova
114e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "deleting added probe"
115e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
116e7d759f3SVeronika Molnarova
117e7d759f3SVeronika Molnarova
118e7d759f3SVeronika Molnarova### listing removed probe
119e7d759f3SVeronika Molnarova
120e7d759f3SVeronika Molnarova# removed probes should NOT appear in perf-list output
121e7d759f3SVeronika Molnarova$CMD_PERF list probe:\* > $LOGS_DIR/adding_kernel_list_removed.log
122e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
123e7d759f3SVeronika Molnarova
124e7d759f3SVeronika Molnarova../common/check_all_lines_matched.pl "$RE_LINE_EMPTY" "List of pre-defined events" "Metric Groups:" < $LOGS_DIR/adding_kernel_list_removed.log
125e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
126e7d759f3SVeronika Molnarova
127e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "listing removed probe (should NOT be listed)"
128e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
129e7d759f3SVeronika Molnarova
130e7d759f3SVeronika Molnarova
131e7d759f3SVeronika Molnarova### dry run
132e7d759f3SVeronika Molnarova
133e7d759f3SVeronika Molnarova# the '-n' switch should run it in dry mode
134e7d759f3SVeronika Molnarova$CMD_PERF probe -n --add $TEST_PROBE 2> $LOGS_DIR/adding_kernel_dryrun.err
135e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
136e7d759f3SVeronika Molnarova
137e7d759f3SVeronika Molnarova# check for the output (should be the same as usual)
138e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE" < $LOGS_DIR/adding_kernel_dryrun.err
139e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
140e7d759f3SVeronika Molnarova
141e7d759f3SVeronika Molnarova# check that no probe was added in real
142e7d759f3SVeronika Molnarova! ( $CMD_PERF probe -l | grep "probe:$TEST_PROBE" )
143e7d759f3SVeronika Molnarova(( CHECK_EXIT_CODE += $? ))
144e7d759f3SVeronika Molnarova
145e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "dry run :: adding probe"
146e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
147e7d759f3SVeronika Molnarova
148e7d759f3SVeronika Molnarova
149e7d759f3SVeronika Molnarova### force-adding probes
150e7d759f3SVeronika Molnarova
151e7d759f3SVeronika Molnarova# when using '--force' a probe should be added even if it is already there
152e7d759f3SVeronika Molnarova$CMD_PERF probe --add $TEST_PROBE 2> $LOGS_DIR/adding_kernel_forceadd_01.err
153e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
154e7d759f3SVeronika Molnarova
155e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE" < $LOGS_DIR/adding_kernel_forceadd_01.err
156e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
157e7d759f3SVeronika Molnarova
158e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "force-adding probes :: first probe adding"
159e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
160e7d759f3SVeronika Molnarova
161e7d759f3SVeronika Molnarova# adding existing probe without '--force' should fail
162e7d759f3SVeronika Molnarova! $CMD_PERF probe --add $TEST_PROBE 2> $LOGS_DIR/adding_kernel_forceadd_02.err
163e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
164e7d759f3SVeronika Molnarova
165e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "Error: event \"$TEST_PROBE\" already exists." "Error: Failed to add events." < $LOGS_DIR/adding_kernel_forceadd_02.err
166e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
167e7d759f3SVeronika Molnarova
168e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "force-adding probes :: second probe adding (without force)"
169e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
170e7d759f3SVeronika Molnarova
171e7d759f3SVeronika Molnarova# adding existing probe with '--force' should pass
172e7d759f3SVeronika MolnarovaNO_OF_PROBES=`$CMD_PERF probe -l | wc -l`
173e7d759f3SVeronika Molnarova$CMD_PERF probe --force --add $TEST_PROBE 2> $LOGS_DIR/adding_kernel_forceadd_03.err
174e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
175e7d759f3SVeronika Molnarova
176e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "Added new events?:" "probe:${TEST_PROBE}_${NO_OF_PROBES}" "on $TEST_PROBE" < $LOGS_DIR/adding_kernel_forceadd_03.err
177e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
178e7d759f3SVeronika Molnarova
179e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "force-adding probes :: second probe adding (with force)"
180e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
181e7d759f3SVeronika Molnarova
182e7d759f3SVeronika Molnarova
183e7d759f3SVeronika Molnarova### using doubled probe
184e7d759f3SVeronika Molnarova
185e7d759f3SVeronika Molnarova# since they are the same, they should produce the same results
186e7d759f3SVeronika Molnarova$CMD_PERF stat -e probe:$TEST_PROBE -e probe:${TEST_PROBE}_${NO_OF_PROBES} -x';' -o $LOGS_DIR/adding_kernel_using_two.log -- bash -c 'cat /proc/cpuinfo > /dev/null'
187e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
188e7d759f3SVeronika Molnarova
189e7d759f3SVeronika MolnarovaREGEX_LINE="$RE_NUMBER;+probe:${TEST_PROBE}_?(?:$NO_OF_PROBES)?;$RE_NUMBER;$RE_NUMBER"
190e7d759f3SVeronika Molnarova../common/check_all_lines_matched.pl "$REGEX_LINE" "$RE_LINE_EMPTY" "$RE_LINE_COMMENT" < $LOGS_DIR/adding_kernel_using_two.log
191e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
192e7d759f3SVeronika Molnarova
193e7d759f3SVeronika MolnarovaVALUE_1=`grep "$TEST_PROBE;" $LOGS_DIR/adding_kernel_using_two.log | awk -F';' '{print $1}'`
194e7d759f3SVeronika MolnarovaVALUE_2=`grep "${TEST_PROBE}_${NO_OF_PROBES};" $LOGS_DIR/adding_kernel_using_two.log | awk -F';' '{print $1}'`
195e7d759f3SVeronika Molnarova
196e7d759f3SVeronika Molnarovatest $VALUE_1 -eq $VALUE_2
197e7d759f3SVeronika Molnarova(( CHECK_EXIT_CODE += $? ))
198e7d759f3SVeronika Molnarova
199e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "using doubled probe"
200e7d759f3SVeronika Molnarova
201e7d759f3SVeronika Molnarova
202e7d759f3SVeronika Molnarova### removing multiple probes
203e7d759f3SVeronika Molnarova
204e7d759f3SVeronika Molnarova# using wildcards should remove all matching probes
205e7d759f3SVeronika Molnarova$CMD_PERF probe --del \* 2> $LOGS_DIR/adding_kernel_removing_wildcard.err
206e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
207e7d759f3SVeronika Molnarova
208e7d759f3SVeronika Molnarova../common/check_all_lines_matched.pl "Removed event: probe:$TEST_PROBE" "Removed event: probe:${TEST_PROBE}_1" < $LOGS_DIR/adding_kernel_removing_wildcard.err
209e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
210e7d759f3SVeronika Molnarova
211e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "removing multiple probes"
212e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
213e7d759f3SVeronika Molnarova
214e7d759f3SVeronika Molnarova
215e7d759f3SVeronika Molnarova### wildcard adding support
216e7d759f3SVeronika Molnarova
217e7d759f3SVeronika Molnarova$CMD_PERF probe -nf --max-probes=512 -a 'vfs_* $params' 2> $LOGS_DIR/adding_kernel_adding_wildcard.err
218e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
219e7d759f3SVeronika Molnarova
220e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "probe:vfs_mknod" "probe:vfs_create" "probe:vfs_rmdir" "probe:vfs_link" "probe:vfs_write" < $LOGS_DIR/adding_kernel_adding_wildcard.err
221e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
222e7d759f3SVeronika Molnarova
223*90d32e92SAthira Rajeevif [ $NO_DEBUGINFO ] ; then
224*90d32e92SAthira Rajeev	print_testcase_skipped $NO_DEBUGINFO $NO_DEBUGINFO "Skipped due to missing debuginfo"
225*90d32e92SAthira Rajeevelse
226e7d759f3SVeronika Molnarova	print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "wildcard adding support"
227*90d32e92SAthira Rajeevfi
228*90d32e92SAthira Rajeev
229e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
230e7d759f3SVeronika Molnarova
231e7d759f3SVeronika Molnarova
232e7d759f3SVeronika Molnarova### non-existing variable
233e7d759f3SVeronika Molnarova
234e7d759f3SVeronika Molnarova# perf probe should survive a non-existing variable probing attempt
235e7d759f3SVeronika Molnarova{ $CMD_PERF probe 'vfs_read somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64' ; } 2> $LOGS_DIR/adding_kernel_nonexisting.err
236e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
237e7d759f3SVeronika Molnarova
238e7d759f3SVeronika Molnarova# the exitcode should not be 0 or segfault
239e7d759f3SVeronika Molnarovatest $PERF_EXIT_CODE -ne 139 -a $PERF_EXIT_CODE -ne 0
240e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
241e7d759f3SVeronika Molnarova
242e7d759f3SVeronika Molnarova# check that the error message is reasonable
243e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "Failed to find" "somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64" < $LOGS_DIR/adding_kernel_nonexisting.err
244e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
245e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "in this function|at this address" "Error" "Failed to add events" < $LOGS_DIR/adding_kernel_nonexisting.err
246e7d759f3SVeronika Molnarova(( CHECK_EXIT_CODE += $? ))
247e7d759f3SVeronika Molnarova../common/check_all_lines_matched.pl "Failed to find" "Error" "Probe point .+ not found" "optimized out" "Use.+\-\-range option to show.+location range" < $LOGS_DIR/adding_kernel_nonexisting.err
248e7d759f3SVeronika Molnarova(( CHECK_EXIT_CODE += $? ))
249e7d759f3SVeronika Molnarova../common/check_no_patterns_found.pl "$RE_SEGFAULT" < $LOGS_DIR/adding_kernel_nonexisting.err
250e7d759f3SVeronika Molnarova(( CHECK_EXIT_CODE += $? ))
251e7d759f3SVeronika Molnarova
252*90d32e92SAthira Rajeevif [ $NO_DEBUGINFO ]; then
253*90d32e92SAthira Rajeev	print_testcase_skipped $NO_DEBUGINFO $NO_DEBUGINFO "Skipped due to missing debuginfo"
254*90d32e92SAthira Rajeevelse
255e7d759f3SVeronika Molnarova	print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "non-existing variable"
256*90d32e92SAthira Rajeevfi
257*90d32e92SAthira Rajeev
258e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
259e7d759f3SVeronika Molnarova
260e7d759f3SVeronika Molnarova
261e7d759f3SVeronika Molnarova### function with return value
262e7d759f3SVeronika Molnarova
263e7d759f3SVeronika Molnarova# adding probe with return value
264e7d759f3SVeronika Molnarova$CMD_PERF probe --add "$TEST_PROBE%return \$retval" 2> $LOGS_DIR/adding_kernel_func_retval_add.err
265e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
266e7d759f3SVeronika Molnarova
267e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE%return with \\\$retval" < $LOGS_DIR/adding_kernel_func_retval_add.err
268e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
269e7d759f3SVeronika Molnarova
270e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "function with retval :: add"
271e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
272e7d759f3SVeronika Molnarova
273e7d759f3SVeronika Molnarova# recording some data
274e7d759f3SVeronika Molnarova$CMD_PERF record -e probe:$TEST_PROBE\* -o $CURRENT_TEST_DIR/perf.data -- cat /proc/cpuinfo > /dev/null 2> $LOGS_DIR/adding_kernel_func_retval_record.err
275e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
276e7d759f3SVeronika Molnarova
277e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/adding_kernel_func_retval_record.err
278e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
279e7d759f3SVeronika Molnarova
280e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "function with retval :: record"
281e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
282e7d759f3SVeronika Molnarova
283e7d759f3SVeronika Molnarova# perf script should report the function calls with the correct arg values
284e7d759f3SVeronika Molnarova$CMD_PERF script -i $CURRENT_TEST_DIR/perf.data > $LOGS_DIR/adding_kernel_func_retval_script.log
285e7d759f3SVeronika MolnarovaPERF_EXIT_CODE=$?
286e7d759f3SVeronika Molnarova
287e7d759f3SVeronika MolnarovaREGEX_SCRIPT_LINE="\s*cat\s+$RE_NUMBER\s+\[$RE_NUMBER\]\s+$RE_NUMBER:\s+probe:$TEST_PROBE\w*:\s+\($RE_NUMBER_HEX\s+<\-\s+$RE_NUMBER_HEX\)\s+arg1=$RE_NUMBER_HEX"
288e7d759f3SVeronika Molnarova../common/check_all_lines_matched.pl "$REGEX_SCRIPT_LINE" < $LOGS_DIR/adding_kernel_func_retval_script.log
289e7d759f3SVeronika MolnarovaCHECK_EXIT_CODE=$?
290e7d759f3SVeronika Molnarova../common/check_all_patterns_found.pl "$REGEX_SCRIPT_LINE" < $LOGS_DIR/adding_kernel_func_retval_script.log
291e7d759f3SVeronika Molnarova(( CHECK_EXIT_CODE += $? ))
292e7d759f3SVeronika Molnarova
293e7d759f3SVeronika Molnarovaprint_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "function argument probing :: script"
294e7d759f3SVeronika Molnarova(( TEST_RESULT += $? ))
295e7d759f3SVeronika Molnarova
296e7d759f3SVeronika Molnarova
297e7d759f3SVeronika Molnarovaclear_all_probes
298e7d759f3SVeronika Molnarova
299e7d759f3SVeronika Molnarova# print overall results
300e7d759f3SVeronika Molnarovaprint_overall_results "$TEST_RESULT"
301e7d759f3SVeronika Molnarovaexit $?
302