diff options
Diffstat (limited to 'tests/ls-2/ls-tests')
-rwxr-xr-x | tests/ls-2/ls-tests | 288 |
1 files changed, 288 insertions, 0 deletions
diff --git a/tests/ls-2/ls-tests b/tests/ls-2/ls-tests new file mode 100755 index 000000000..e43ee167a --- /dev/null +++ b/tests/ls-2/ls-tests @@ -0,0 +1,288 @@ +#! /bin/sh +# This script was generated automatically by ./../mk-script. +case $# in + 0) xx='../../src/ls';; + *) xx="$1";; +esac +test "$VERBOSE" && echo=echo || echo=: +$echo testing program: $xx +errors=0 +test "$srcdir" || srcdir=. +test "$VERBOSE" && $xx --version 2> /dev/null + +# Make sure we get English translations. +LANGUAGE=C +export LANGUAGE +LC_ALL=C +export LC_ALL +LANG=C +export LANG + +filename_args="$srcdir/quotable" +new_filename_args= +for arg in $filename_args; do + if test -r $arg; then + basename_arg=`echo $arg|sed 's,.*/,,'` + test -f $basename_arg || cp -a $arg . + arg=$basename_arg + fi + new_filename_args="$new_filename_args $arg" +done +filename_args=$new_filename_args + +$xx $filename_args > q-.O 2> q-.E +code=$? +if test $code != 0 ; then + $echo "Test q- failed: ../../src/ls return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp q-.O $srcdir/q-.X > /dev/null 2>&1 + case $? in + 0) if test "$VERBOSE" ; then $echo "passed q-"; fi ;; + 1) $echo "Test q- failed: files q-.O and $srcdir/q-.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test q- may have failed." 1>&2; + $echo The command "cmp q-.O $srcdir/q-.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s q-.E || rm -f q-.E +filename_args="$srcdir/quotable" +new_filename_args= +for arg in $filename_args; do + if test -r $arg; then + basename_arg=`echo $arg|sed 's,.*/,,'` + test -f $basename_arg || cp -a $arg . + arg=$basename_arg + fi + new_filename_args="$new_filename_args $arg" +done +filename_args=$new_filename_args + +$xx -N $filename_args > q-N.O 2> q-N.E +code=$? +if test $code != 0 ; then + $echo "Test q-N failed: ../../src/ls return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp q-N.O $srcdir/q-N.X > /dev/null 2>&1 + case $? in + 0) if test "$VERBOSE" ; then $echo "passed q-N"; fi ;; + 1) $echo "Test q-N failed: files q-N.O and $srcdir/q-N.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test q-N may have failed." 1>&2; + $echo The command "cmp q-N.O $srcdir/q-N.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s q-N.E || rm -f q-N.E +filename_args="$srcdir/quotable" +new_filename_args= +for arg in $filename_args; do + if test -r $arg; then + basename_arg=`echo $arg|sed 's,.*/,,'` + test -f $basename_arg || cp -a $arg . + arg=$basename_arg + fi + new_filename_args="$new_filename_args $arg" +done +filename_args=$new_filename_args + +$xx -q $filename_args > q-q.O 2> q-q.E +code=$? +if test $code != 0 ; then + $echo "Test q-q failed: ../../src/ls return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp q-q.O $srcdir/q-q.X > /dev/null 2>&1 + case $? in + 0) if test "$VERBOSE" ; then $echo "passed q-q"; fi ;; + 1) $echo "Test q-q failed: files q-q.O and $srcdir/q-q.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test q-q may have failed." 1>&2; + $echo The command "cmp q-q.O $srcdir/q-q.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s q-q.E || rm -f q-q.E +filename_args="$srcdir/quotable" +new_filename_args= +for arg in $filename_args; do + if test -r $arg; then + basename_arg=`echo $arg|sed 's,.*/,,'` + test -f $basename_arg || cp -a $arg . + arg=$basename_arg + fi + new_filename_args="$new_filename_args $arg" +done +filename_args=$new_filename_args + +$xx -Q $filename_args > q-Q.O 2> q-Q.E +code=$? +if test $code != 0 ; then + $echo "Test q-Q failed: ../../src/ls return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp q-Q.O $srcdir/q-Q.X > /dev/null 2>&1 + case $? in + 0) if test "$VERBOSE" ; then $echo "passed q-Q"; fi ;; + 1) $echo "Test q-Q failed: files q-Q.O and $srcdir/q-Q.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test q-Q may have failed." 1>&2; + $echo The command "cmp q-Q.O $srcdir/q-Q.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s q-Q.E || rm -f q-Q.E +filename_args="$srcdir/q" +new_filename_args= +for arg in $filename_args; do + if test -r $arg; then + basename_arg=`echo $arg|sed 's,.*/,,'` + test -f $basename_arg || cp -a $arg . + arg=$basename_arg + fi + new_filename_args="$new_filename_args $arg" +done +filename_args=$new_filename_args + +$xx --quoting=literal $filename_args > q-qs-lit.O 2> q-qs-lit.E +code=$? +if test $code != 0 ; then + $echo "Test q-qs-lit failed: ../../src/ls return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp q-qs-lit.O $srcdir/q-qs-lit.X > /dev/null 2>&1 + case $? in + 0) if test "$VERBOSE" ; then $echo "passed q-qs-lit"; fi ;; + 1) $echo "Test q-qs-lit failed: files q-qs-lit.O and $srcdir/q-qs-lit.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test q-qs-lit may have failed." 1>&2; + $echo The command "cmp q-qs-lit.O $srcdir/q-qs-lit.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s q-qs-lit.E || rm -f q-qs-lit.E +filename_args="$srcdir/q" +new_filename_args= +for arg in $filename_args; do + if test -r $arg; then + basename_arg=`echo $arg|sed 's,.*/,,'` + test -f $basename_arg || cp -a $arg . + arg=$basename_arg + fi + new_filename_args="$new_filename_args $arg" +done +filename_args=$new_filename_args + +$xx --quoting=shell $filename_args > q-qs-sh.O 2> q-qs-sh.E +code=$? +if test $code != 0 ; then + $echo "Test q-qs-sh failed: ../../src/ls return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp q-qs-sh.O $srcdir/q-qs-sh.X > /dev/null 2>&1 + case $? in + 0) if test "$VERBOSE" ; then $echo "passed q-qs-sh"; fi ;; + 1) $echo "Test q-qs-sh failed: files q-qs-sh.O and $srcdir/q-qs-sh.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test q-qs-sh may have failed." 1>&2; + $echo The command "cmp q-qs-sh.O $srcdir/q-qs-sh.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s q-qs-sh.E || rm -f q-qs-sh.E +filename_args="$srcdir/q" +new_filename_args= +for arg in $filename_args; do + if test -r $arg; then + basename_arg=`echo $arg|sed 's,.*/,,'` + test -f $basename_arg || cp -a $arg . + arg=$basename_arg + fi + new_filename_args="$new_filename_args $arg" +done +filename_args=$new_filename_args + +$xx --quoting=shell-always $filename_args > q-qs-sh-a.O 2> q-qs-sh-a.E +code=$? +if test $code != 0 ; then + $echo "Test q-qs-sh-a failed: ../../src/ls return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp q-qs-sh-a.O $srcdir/q-qs-sh-a.X > /dev/null 2>&1 + case $? in + 0) if test "$VERBOSE" ; then $echo "passed q-qs-sh-a"; fi ;; + 1) $echo "Test q-qs-sh-a failed: files q-qs-sh-a.O and $srcdir/q-qs-sh-a.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test q-qs-sh-a may have failed." 1>&2; + $echo The command "cmp q-qs-sh-a.O $srcdir/q-qs-sh-a.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s q-qs-sh-a.E || rm -f q-qs-sh-a.E +filename_args="$srcdir/q" +new_filename_args= +for arg in $filename_args; do + if test -r $arg; then + basename_arg=`echo $arg|sed 's,.*/,,'` + test -f $basename_arg || cp -a $arg . + arg=$basename_arg + fi + new_filename_args="$new_filename_args $arg" +done +filename_args=$new_filename_args + +$xx --quoting=c $filename_args > q-qs-c.O 2> q-qs-c.E +code=$? +if test $code != 0 ; then + $echo "Test q-qs-c failed: ../../src/ls return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp q-qs-c.O $srcdir/q-qs-c.X > /dev/null 2>&1 + case $? in + 0) if test "$VERBOSE" ; then $echo "passed q-qs-c"; fi ;; + 1) $echo "Test q-qs-c failed: files q-qs-c.O and $srcdir/q-qs-c.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test q-qs-c may have failed." 1>&2; + $echo The command "cmp q-qs-c.O $srcdir/q-qs-c.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s q-qs-c.E || rm -f q-qs-c.E +filename_args="$srcdir/q" +new_filename_args= +for arg in $filename_args; do + if test -r $arg; then + basename_arg=`echo $arg|sed 's,.*/,,'` + test -f $basename_arg || cp -a $arg . + arg=$basename_arg + fi + new_filename_args="$new_filename_args $arg" +done +filename_args=$new_filename_args + +$xx --quoting=escape $filename_args > q-qs-esc.O 2> q-qs-esc.E +code=$? +if test $code != 0 ; then + $echo "Test q-qs-esc failed: ../../src/ls return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp q-qs-esc.O $srcdir/q-qs-esc.X > /dev/null 2>&1 + case $? in + 0) if test "$VERBOSE" ; then $echo "passed q-qs-esc"; fi ;; + 1) $echo "Test q-qs-esc failed: files q-qs-esc.O and $srcdir/q-qs-esc.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test q-qs-esc may have failed." 1>&2; + $echo The command "cmp q-qs-esc.O $srcdir/q-qs-esc.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s q-qs-esc.E || rm -f q-qs-esc.E +if test $errors = 0 ; then + $echo Passed all 9 tests. 1>&2 +else + $echo Failed $errors tests. 1>&2 +fi +test $errors = 0 || errors=1 +exit $errors |