mirror of
https://https.git.savannah.gnu.org/git/findutils.git
synced 2026-01-26 07:37:52 +00:00
Add new test for octal and letter escapes in -printf format.
* find/testsuite/test_escapechars.golden: Expected output file. * find/testsuite/Makefile.am (EXTRA_DIST_GOLDEN): New variable; distribute test_escapechars.golden. * find/testsuite/test_escapechars.sh: New test. * find/testsuite/Makefile.am (test_shell_progs): New variable, where we keep the list of shell script tests. Move existing examples from TESTS and add test_escapechars.sh. * find/testsuite/Makefile.am (TESTS): Refer to test_shell_progs. * cfg.mk: allow trailing blanks and space-tab sequences in find/testsuite/test_escapechars.golden.
This commit is contained in:
parent
3953192b4e
commit
79568ec575
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
2011-06-18 James Youngman <jay@gnu.org>
|
||||
|
||||
Add new test for octal and letter escapes in -printf format.
|
||||
* find/testsuite/test_escapechars.golden: Expected output file.
|
||||
* find/testsuite/Makefile.am (EXTRA_DIST_GOLDEN): New variable;
|
||||
distribute test_escapechars.golden.
|
||||
* find/testsuite/test_escapechars.sh: New test.
|
||||
* find/testsuite/Makefile.am (test_shell_progs): New variable,
|
||||
where we keep the list of shell script tests. Move existing
|
||||
examples from TESTS and add test_escapechars.sh.
|
||||
* find/testsuite/Makefile.am (TESTS): Refer to test_shell_progs.
|
||||
* cfg.mk: allow trailing blanks and space-tab sequences in
|
||||
find/testsuite/test_escapechars.golden.
|
||||
|
||||
2011-06-17 James Youngman <jay@gnu.org>
|
||||
|
||||
Split find's printf-related code into a new file.
|
||||
|
||||
4
cfg.mk
4
cfg.mk
@ -22,7 +22,7 @@ local-checks-to-skip += sc_error_message_period sc_error_message_uppercase \
|
||||
|
||||
exclude_file_name_regexp--sc_obsolete_symbols = build-aux/src-sniff\.py
|
||||
exclude_file_name_regexp--sc_space_tab = \
|
||||
xargs/testsuite/(inputs/.*\.xi|xargs.(gnu|posix|sysv)/.*\.xo)$$
|
||||
xargs/testsuite/(inputs/.*\.xi|xargs.(gnu|posix|sysv)/.*\.xo)|find/testsuite/test_escapechars\.golden$$
|
||||
|
||||
# Skip sc_two_space_separator_in_usage because it reflects the requirements
|
||||
# of help2man. It gets run on files that are not help2man inputs, and in
|
||||
@ -31,7 +31,7 @@ local-checks-to-skip += sc_two_space_separator_in_usage
|
||||
|
||||
# Some test inputs/outputs have trailing blanks.
|
||||
exclude_file_name_regexp--sc_trailing_blank = \
|
||||
^COPYING|(po/.*\.po)|(find/testsuite/find.gnu/printf\.xo)|(xargs/testsuite/(inputs/.*\.xi|xargs\.(gnu|posix|sysv)/.*\.(x[oe])))$$
|
||||
^COPYING|(po/.*\.po)|(find/testsuite/(test_escapechars\.golden|find.gnu/printf\.xo))|(xargs/testsuite/(inputs/.*\.xi|xargs\.(gnu|posix|sysv)/.*\.(x[oe])))$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
|
||||
^(.*/testsuite/.*\.(xo|xi|xe))|COPYING|doc/regexprops\.texi|m4/order-(bad|good)\.bin$$
|
||||
|
||||
@ -242,14 +242,20 @@ find.posix/exec-one.exp \
|
||||
find.posix/user-empty.exp \
|
||||
find.posix/user-missing.exp
|
||||
|
||||
EXTRA_DIST = $(EXTRA_DIST_EXP) $(EXTRA_DIST_XO) sv-bug-32043.sh
|
||||
EXTRA_DIST_GOLDEN = \
|
||||
test_escapechars.golden
|
||||
|
||||
test_shell_progs = sv-bug-32043.sh test_escapechars.sh
|
||||
|
||||
EXTRA_DIST = $(EXTRA_DIST_EXP) $(EXTRA_DIST_XO) $(EXTRA_DIST_GOLDEN) \
|
||||
$(test_shell_progs)
|
||||
|
||||
CLEANFILES = *.log *.sum site.exp site.bak
|
||||
|
||||
#DIST_SUBDIRS = config
|
||||
|
||||
|
||||
TESTS = sv-bug-32043.sh
|
||||
TESTS = $(test_shell_progs)
|
||||
|
||||
checklists:
|
||||
cd $(srcdir) && \
|
||||
|
||||
13
find/testsuite/test_escapechars.golden
Normal file
13
find/testsuite/test_escapechars.golden
Normal file
@ -0,0 +1,13 @@
|
||||
OCTAL1:
|
||||
OCTAL2:
|
||||
OCTAL3:
|
||||
OCTAL4: 4
|
||||
OCTAL8: 8
|
||||
BEL:
|
||||
CR:
|
||||
FF:
|
||||
TAB:
|
||||
VTAB:
|
||||
BS:
|
||||
BACKSLASH: \
|
||||
UNKNOWN: \z
|
||||
54
find/testsuite/test_escapechars.sh
Executable file
54
find/testsuite/test_escapechars.sh
Executable file
@ -0,0 +1,54 @@
|
||||
#! /bin/sh
|
||||
testname="$(basename $0)"
|
||||
|
||||
parent="$(cd .. && pwd)"
|
||||
if [[ -f "${parent}/ftsfind" ]]; then
|
||||
ftsfind="${parent}/ftsfind"
|
||||
oldfind="${parent}/find"
|
||||
elif [[ -f "${parent}/oldfind" ]]; then
|
||||
ftsfind="${parent}/find"
|
||||
oldfind="${parent}/oldfind"
|
||||
else
|
||||
echo "Cannot find the executables to test." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
goldenfile="${srcdir}/test_escapechars.golden"
|
||||
|
||||
if outfile=$(mktemp); then
|
||||
for executable in "$oldfind" "$ftsfind"
|
||||
do
|
||||
if "$executable" . -maxdepth 0 \
|
||||
-printf 'OCTAL1: \1\n' \
|
||||
-printf 'OCTAL2: \02\n' \
|
||||
-printf 'OCTAL3: \003\n' \
|
||||
-printf 'OCTAL4: \0044\n' \
|
||||
-printf 'OCTAL8: \0028\n' \
|
||||
-printf 'BEL: \a\n' \
|
||||
-printf 'CR: \r\n' \
|
||||
-printf 'FF: \f\n' \
|
||||
-printf 'TAB: \t\n' \
|
||||
-printf 'VTAB: \v\n' \
|
||||
-printf 'BS: \b\n' \
|
||||
-printf 'BACKSLASH: \\\n' \
|
||||
-printf 'UNKNOWN: \z\n' \
|
||||
>| "${outfile}" 2>/dev/null; then
|
||||
if cmp "${outfile}" "${goldenfile}"; then
|
||||
rm "${outfile}"
|
||||
else
|
||||
exec >&2
|
||||
echo "FAIL: $executable produced incorrect output:"
|
||||
od -c "${outfile}"
|
||||
echo "Expected output was:"
|
||||
od -c "${goldenfile}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "FAIL: $executable returned $?" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "FAIL: could not create a test output file." >&2
|
||||
exit 1
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user