A test can declare it expects a specific output on stdout. In this case, we compare it to a reference file. We implement this instead of relying on a wrapper because we need the flexibility to resolve name of reference file per target. For instance, multiarch float tests expect different ref files for each target, which is something we can't express with a test wrapper. Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Aniket Sahu <asahu1x@linux.ibm.com> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Message-ID: <20260827221506.91574-17-pierrick.bouvier@oss.qualcomm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
16 lines
299 B
Bash
Executable File
16 lines
299 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
set -euo pipefail
|
|
|
|
if [ $# -lt 2 ]; then
|
|
echo "run_and_diff: expected_output_file cmd [args]..." 1>&2
|
|
exit 1
|
|
fi
|
|
expected="$1";shift
|
|
output=$(mktemp)
|
|
trap "rm -rf $output" EXIT
|
|
set -x
|
|
"$@" |& tee $output
|
|
diff $output $expected
|