bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

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"
Christoph Galuschka d0b941
checksum=$( find "$TMPDIR" -print0 |  md5sum - | awk '{print $1}')
Christoph Galuschka d0b941
#if (( $centos_ver == 6 ))
Christoph Galuschka d0b941
#then
Christoph Galuschka d0b941
#    [[ "$checksum" == "6105e5998b2d6feea56c80cf279bc24b" ]]
Christoph Galuschka d0b941
#else
Christoph Galuschka d0b941
    [[ "$checksum" == "789e232a7e4f19cee9be7d6e3ebbef3b" ]]
Christoph Galuschka d0b941
    t_CheckExitStatus $?
Christoph Galuschka d0b941
#fi 
Christoph Galuschka d0b941
Christoph Galuschka d0b941
Christoph Galuschka d0b941