Skip to content

Commit

Permalink
perf test: Fix non-bash issue with stat bpf counters
Browse files Browse the repository at this point in the history
$(( .. )) is a bash feature but the test's interpreter is !/bin/sh,
switch the code to use expr.

Signed-off-by: Ian Rogers <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Song Liu <[email protected]>
Cc: [email protected]
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
captain5050 authored and acmel committed Jun 19, 2021
1 parent c087e94 commit 482698c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/perf/tests/shell/stat_bpf_counters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ compare_number()
second_num=$2

# upper bound is first_num * 110%
upper=$(( $first_num + $first_num / 10 ))
upper=$(expr $first_num + $first_num / 10 )
# lower bound is first_num * 90%
lower=$(( $first_num - $first_num / 10 ))
lower=$(expr $first_num - $first_num / 10 )

if [ $second_num -gt $upper ] || [ $second_num -lt $lower ]; then
echo "The difference between $first_num and $second_num are greater than 10%."
Expand Down

0 comments on commit 482698c

Please sign in to comment.