Blob Blame History Raw
#!/bin/bash
#
# Author: Iain Douglas <centos@1n6.org.uk>
#

ExitFail() {
    t_Log "FAIL"
    exit $FAIL
}

# Basic tests for cpio

OUTDIR=/var/tmp/cpio/cpio_out
INDIR=/var/tmp/cpio/cpio_in
PASSDIR=/var/tmp/cpio/cpio_pass

[ -d /var/tmp/cpio ] && rm -rf /var/tmp/cpio
mkdir -p "$OUTDIR"
mkdir -p "$INDIR"
mkdir -p "$PASSDIR"

# create a basic cpio archive
echo "Basic copy out test"

ls | cpio -o > "$OUTDIR"/cpio.out 
t_CheckExitStatus $?

# Basic copy incheck
echo "Basic copy in test"
pushd "$INDIR"
cpio -i <"$OUTDIR"/cpio.out
t_CheckExitStatus $?
popd
# Basic pass through mode
echo "Basic pass through test"

pushd $INDIR
find . | cpio -pd "$PASSDIR"
t_CheckExitStatus $?
popd 

# Check that $PASSDIR and $INDIR are the same
echo "Check that the working directories are the same"
diff $PASSDIR $INDIR &>/dev/null 
t_CheckExitStatus $?

#rm -rf /var/tmp/cpio