Blame tests/p_findutils/10-find_tests

Christoph Galuschka d0b941
#!/bin/bash
Christoph Galuschka d0b941
# Author: Iain Douglas <centos@1n6.org.uk>
Christoph Galuschka d0b941
#
Christoph Galuschka d0b941
Christoph Galuschka d0b941
echo "Running $0"
Christoph Galuschka d0b941
TMPDIR=/var/tmp/find 
Christoph Galuschka d0b941
Christoph Galuschka d0b941
[[ -e  "$TMPDIR" ]] && rm -rf "$TMPDIR"
Christoph Galuschka d0b941
Christoph Galuschka d0b941
mkdir -p "$TMPDIR" || { t_Log "FAIL: Can't create working area $TMPDIR" ; exit $FAIL; }
Christoph Galuschka d0b941
touch "$TMPDIR"/file1
Christoph Galuschka d0b941
touch "$TMPDIR"/"file space"
Christoph Galuschka d0b941
# Basic find tests
Christoph Galuschka d0b941
echo "Basic find tests"
Christoph Galuschka d0b941
Christoph Galuschka d0b941
find "$TMPDIR" &>/dev/null
Christoph Galuschka d0b941
t_CheckExitStatus $?
Christoph Galuschka d0b941
Christoph Galuschka d0b941
# Check find fails for non existent directory
Christoph Galuschka d0b941
echo "Check find fails for non existent directory"
Christoph Galuschka d0b941
find "$TMPDIR"/1 &>/dev/null && { t_Log "FAIL: find incorrectly exited with 0 status"; exit $FAIL ; }
Christoph Galuschka d0b941
t_Log "PASS"
Christoph Galuschka d0b941
Christoph Galuschka d0b941
# Check print0 works so we can use it for an xargs test
Christoph Galuschka d0b941
echo "Test -print0"
Athmane Madjoudj 02a691
lines_count=$( find "$TMPDIR" -print0 | wc -l )
Christoph Galuschka d0b941
Athmane Madjoudj 02a691
if [ $lines_count -eq 0 ] ; then
Athmane Madjoudj 02a691
    t_CheckExitStatus 0
Athmane Madjoudj 02a691
else
Athmane Madjoudj 02a691
    t_CheckExitStatus 1
Athmane Madjoudj 02a691
fi