Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf test: Fixes to variable expansion and stdout for diff test

When make_data fails its error message needs to go to stderr rather
than stdout and the stdout value is captured in a variable. Quote the
$err value so that it is always a valid input for test. This error is
commonly encountered if no sample data is gathered by the test.

Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250312001841.1515779-1-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
3a86d63e 4e82c88a

+6 -6
+6 -6
tools/perf/tests/shell/diff.sh
··· 39 39 file="$1" 40 40 if ! perf record -o "${file}" ${testprog} 2> /dev/null 41 41 then 42 - echo "Workload record [Failed record]" 42 + echo "Workload record [Failed record]" >&2 43 43 echo 1 44 44 return 45 45 fi 46 46 if ! perf report -i "${file}" -q | grep -q "${testsym}" 47 47 then 48 - echo "Workload record [Failed missing output]" 48 + echo "Workload record [Failed missing output]" >&2 49 49 echo 1 50 50 return 51 51 fi ··· 55 55 test_two_files() { 56 56 echo "Basic two file diff test" 57 57 err=$(make_data "${perfdata1}") 58 - if [ $err != 0 ] 58 + if [ "$err" != 0 ] 59 59 then 60 60 return 61 61 fi 62 62 err=$(make_data "${perfdata2}") 63 - if [ $err != 0 ] 63 + if [ "$err" != 0 ] 64 64 then 65 65 return 66 66 fi ··· 77 77 test_three_files() { 78 78 echo "Basic three file diff test" 79 79 err=$(make_data "${perfdata1}") 80 - if [ $err != 0 ] 80 + if [ "$err" != 0 ] 81 81 then 82 82 return 83 83 fi 84 84 err=$(make_data "${perfdata2}") 85 - if [ $err != 0 ] 85 + if [ "$err" != 0 ] 86 86 then 87 87 return 88 88 fi