Imported Upstream version 4.5.14
[platform/upstream/findutils.git] / find / testsuite / test_escapechars.sh
1 #! /bin/sh
2 testname="$(basename $0)"
3
4 . "${srcdir}"/binary_locations.sh
5
6 goldenfile="${srcdir}/test_escapechars.golden"
7
8 if outfile=$(mktemp); then
9     for executable in "$oldfind" "$ftsfind"
10     do
11         if "$executable" . -maxdepth 0 \
12             -printf 'OCTAL1: \1\n' \
13             -printf 'OCTAL2: \02\n' \
14             -printf 'OCTAL3: \003\n' \
15             -printf 'OCTAL4: \0044\n' \
16             -printf 'OCTAL8: \0028\n' \
17             -printf 'BEL: \a\n' \
18             -printf 'CR: \r\n' \
19             -printf 'FF: \f\n' \
20             -printf 'TAB: \t\n' \
21             -printf 'VTAB: \v\n' \
22             -printf 'BS: \b\n' \
23             -printf 'BACKSLASH: \\\n' \
24             -printf 'UNKNOWN: \z\n' \
25             >| "${outfile}" 2>/dev/null; then
26             if cmp "${outfile}" "${goldenfile}"; then
27                 rm "${outfile}"
28             else
29                 exec >&2
30                 echo "FAIL: $executable produced incorrect output:"
31                 od -c "${outfile}"
32                 echo "Expected output was:"
33                 od -c "${goldenfile}"
34                 exit 1
35             fi
36         else
37             echo "FAIL: $executable returned $?" >&2
38             exit 1
39         fi
40     done
41 else
42     echo "FAIL: could not create a test output file." >&2
43     exit 1
44 fi