pkgsrc/regress/show-all/spec
rillig f37f30c061 mk/misc: adjust layout of the show-all output to pkgsrc format
In Makefiles, the variable values are aligned vertically. This format is
now also used in the show-all target, which makes it easier readable.

Some more variables have been marked as multi-value, and single-valued
variables ending in space are clearly marked. Without the latter, the
regression test would have a line with significant trailing whitespace.
2018-11-11 19:07:12 +00:00

71 lines
1.9 KiB
Text

# $NetBSD: spec,v 1.2 2018/11/11 19:07:12 rillig Exp $
tmpdir=${TMPDIR:-/tmp}/pkgsrc-show-all
rm -rf "$tmpdir"
mkdir -p "$tmpdir"
require_file() {
if diff -u "$3" "$1" > /dev/null; then
:
else
regress_fail "Expected files to be equal."
diff -u "$3" "$1" || true
fi
}
do_test() {
$TEST_MAKE show-all-regress > "$tmpdir/show-all-regress.out"
}
check_result() {
exit_status 0
cat <<'EOF' > "$tmpdir/expected"
regress:
pkg REGRESS_ENV.undefined # undefined
pkg REGRESS_ENV.empty= # empty
pkg REGRESS_ENV.space= # empty
pkg REGRESS_ENV.value= \
*=all \
VAR1=value1 \
VAR2=`command \
backticks` \
execution \
via \
# end of REGRESS_ENV.value (sorted)
pkg REGRESS_ARGS.undefined # undefined
pkg REGRESS_ARGS.empty= # empty
pkg REGRESS_ARGS.space= # empty
pkg REGRESS_ARGS.value= \
VAR1=value1 \
VAR2=`command \
execution \
via \
backticks` \
*=all \
# end of REGRESS_ARGS.value
pkg REGRESS.undefined # undefined
pkg REGRESS.empty= # empty
pkg REGRESS.space= # ends with space
pkg REGRESS.value= All * kinds of `strange' \escape $characters
pkg *= show-all-regress
pkg **= asterisk
EOF
# The "*" variable is built-in into bmake and expands to the current
# make target, which in this case is "show-all-regress".
# The "**" variable ensures that show-all doesn't accidentally expand
# filenames.
# It's a bit strange that bmake doesn't handle the backticks command
# as a single word. Luckily, this is a rare case.
#
# On the other hand, if it did, bmake would also have to handle
# variable expansion and all the other syntactic difficulties from
# parsing shell commands, and that would be just too much.
require_file "$tmpdir/show-all-regress.out" --equals "$tmpdir/expected"
}