Blame p_findutils/10-find_tests

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