Skip to content

Commit

Permalink
perf test: Fixes to variable expansion and stdout for diff test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ian Rogers authored and Namhyung Kim committed Mar 15, 2025
1 parent 4e82c88 commit 3a86d63
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/perf/tests/shell/diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ make_data() {
file="$1"
if ! perf record -o "${file}" ${testprog} 2> /dev/null
then
echo "Workload record [Failed record]"
echo "Workload record [Failed record]" >&2
echo 1
return
fi
if ! perf report -i "${file}" -q | grep -q "${testsym}"
then
echo "Workload record [Failed missing output]"
echo "Workload record [Failed missing output]" >&2
echo 1
return
fi
Expand All @@ -55,12 +55,12 @@ make_data() {
test_two_files() {
echo "Basic two file diff test"
err=$(make_data "${perfdata1}")
if [ $err != 0 ]
if [ "$err" != 0 ]
then
return
fi
err=$(make_data "${perfdata2}")
if [ $err != 0 ]
if [ "$err" != 0 ]
then
return
fi
Expand All @@ -77,12 +77,12 @@ test_two_files() {
test_three_files() {
echo "Basic three file diff test"
err=$(make_data "${perfdata1}")
if [ $err != 0 ]
if [ "$err" != 0 ]
then
return
fi
err=$(make_data "${perfdata2}")
if [ $err != 0 ]
if [ "$err" != 0 ]
then
return
fi
Expand Down

0 comments on commit 3a86d63

Please sign in to comment.