13de33a5dc
This change is a proof of concept on how to easily integrate existing tests from the tools/regression/ hierarchy into the /usr/tests/ test suite and on how to adapt them to the new layout for src. To achieve these goals, this change: - Moves tests from tools/regression/bin/<tool>/ to bin/<tool>/tests/. - Renames the previous regress.sh files to legacy_test.sh. - Adds Makefiles to build and install the tests and all their supporting data files into /usr/tests/bin/. - Plugs the legacy_test test programs into the test suite using the new TAP backend for Kyua (appearing in 0.8) so that the code of the test programs does not have to change. - Registers the new directories in the BSD.test.dist mtree file. Reviewed by: freebsd-testing Approved by: rpaulo (mentor)
53 lines
1.1 KiB
Plaintext
53 lines
1.1 KiB
Plaintext
# $FreeBSD$
|
|
# This is really a test for outqstr(), which is readily accessible via trap.
|
|
|
|
runtest()
|
|
{
|
|
teststring=$1
|
|
trap -- "$teststring" USR1
|
|
traps=$(trap)
|
|
if [ "$teststring" != "-" ] && [ -z "$traps" ]; then
|
|
# One possible reading of POSIX requires the above to return an
|
|
# empty string because backquote commands are executed in a
|
|
# subshell and subshells shall reset traps. However, an example
|
|
# in the normative description of the trap builtin shows the
|
|
# same usage as here, it is useful and our /bin/sh allows it.
|
|
echo '$(trap) is broken'
|
|
exit 1
|
|
fi
|
|
trap - USR1
|
|
eval "$traps"
|
|
traps2=$(trap)
|
|
if [ "$traps" != "$traps2" ]; then
|
|
echo "Mismatch for '$teststring'"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
runtest 'echo'
|
|
runtest 'echo hi'
|
|
runtest "'echo' 'hi'"
|
|
runtest '"echo" $PATH'
|
|
runtest '\echo "$PATH"'
|
|
runtest ' 0'
|
|
runtest '0 '
|
|
runtest ' 1'
|
|
runtest '1 '
|
|
i=1
|
|
while [ $i -le 127 ]; do
|
|
c=$(printf \\"$(printf %o $i)")
|
|
if [ $i -lt 48 ] || [ $i -gt 57 ]; then
|
|
runtest "$c"
|
|
fi
|
|
runtest " $c$c"
|
|
runtest "a$c"
|
|
i=$((i+1))
|
|
done
|
|
IFS=,
|
|
runtest ' '
|
|
runtest ','
|
|
unset IFS
|
|
runtest ' '
|
|
|
|
exit 0
|