Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157993179
D51795.id160014.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D51795.id160014.diff
View Options
diff --git a/usr.bin/indent/tests/functional_test.sh b/usr.bin/indent/tests/functional_test.sh
--- a/usr.bin/indent/tests/functional_test.sh
+++ b/usr.bin/indent/tests/functional_test.sh
@@ -1,3 +1,5 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright 2016 Dell EMC
# All rights reserved.
@@ -29,61 +31,34 @@
check()
{
- local tc=${1}; shift
-
- local indent=$(atf_config_get usr.bin.indent.test_indent /usr/bin/indent)
-
- # All of the files need to be in the ATF sandbox in order for the tests
- # to pass.
- atf_check cp ${SRCDIR}/${tc}* .
+ local tc=${1}
+ local profile_flag
- # Remove $FreeBSD$ RCS expansions because they get re-indented, which
- # changes the output
- local out_file="${tc}.stdout"
- if [ -f "${out_file}" ]; then
- parsed_file=output_file.parsed
+ cp "${SRCDIR}/${tc%.[0-9]}".* .
- atf_check -o save:$parsed_file sed -e '/\$FreeBSD.*\$/d' \
- ${tc}.stdout
- out_flag="-o file:$parsed_file"
- fi
- local profile_file="${tc}.pro"
- if [ -f "${profile_file}" ]; then
- profile_flag="-P${profile_file}"
+ if [ -f "${tc}.pro" ]; then
+ profile_flag="-P${tc}.pro"
else
# Make sure we don't implicitly use ~/.indent.pro from the test
# host, for determinism purposes.
profile_flag="-npro"
fi
- sed -e '/\$FreeBSD.*\$/d' ${tc} > input_file.parsed
- atf_check -s exit:${tc##*.} ${out_flag} ${indent} ${profile_flag} < input_file.parsed
+ atf_check -s exit:${tc##*.} -o file:"${tc}.stdout" \
+ indent ${profile_flag} < "${tc}"
}
-add_testcase()
+add_legacy_testcase()
{
local tc=${1}
- local tc_escaped word
-
- case "${tc%.*}" in
- *-*)
- local IFS="-"
- for word in ${tc%.*}; do
- tc_escaped="${tc_escaped:+${tc_escaped}_}${word}"
- done
- ;;
- *)
- tc_escaped=${tc%.*}
- ;;
- esac
- atf_test_case ${tc_escaped}
- eval "${tc_escaped}_body() { check ${tc}; }"
- atf_add_test_case ${tc_escaped}
+ atf_test_case ${tc%.[0-9]}
+ eval "${tc%.[0-9]}_body() { check ${tc}; }"
+ atf_add_test_case ${tc%.[0-9]}
}
atf_init_test_cases()
{
- for path in $(find -Es "${SRCDIR}" -regex '.*\.[0-9]+$'); do
- add_testcase ${path##*/}
+ for tc in $(find -s "${SRCDIR}" -name '*.[0-9]'); do
+ add_legacy_testcase "${tc##*/}"
done
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 28, 6:45 AM (17 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33556900
Default Alt Text
D51795.id160014.diff (2 KB)
Attached To
Mode
D51795: indent: Simplify test script
Attached
Detach File
Event Timeline
Log In to Comment