bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_cpio/10-cpio-tests

Athmane Madjoudj 536354
#!/bin/bash
Athmane Madjoudj 536354
#
Athmane Madjoudj 536354
# Author: Iain Douglas <centos@1n6.org.uk>
Athmane Madjoudj 536354
#
Athmane Madjoudj 536354
Athmane Madjoudj 536354
ExitFail() {
Athmane Madjoudj 536354
    t_Log "FAIL"
Athmane Madjoudj 536354
    exit $FAIL
Athmane Madjoudj 536354
}
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# Basic tests for cpio
Athmane Madjoudj 536354
Athmane Madjoudj 536354
OUTDIR=/var/tmp/cpio/cpio_out
Athmane Madjoudj 536354
INDIR=/var/tmp/cpio/cpio_in
Athmane Madjoudj 536354
PASSDIR=/var/tmp/cpio/cpio_pass
Athmane Madjoudj 536354
Athmane Madjoudj 536354
[ -d /var/tmp/cpio ] && rm -rf /var/tmp/cpio
Athmane Madjoudj 536354
mkdir -p "$OUTDIR"
Athmane Madjoudj 536354
mkdir -p "$INDIR"
Athmane Madjoudj 536354
mkdir -p "$PASSDIR"
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# create a basic cpio archive
Athmane Madjoudj 536354
echo "Basic copy out test"
Athmane Madjoudj 536354
Athmane Madjoudj 536354
ls | cpio -o > "$OUTDIR"/cpio.out 
Athmane Madjoudj 536354
t_CheckExitStatus $?
Athmane Madjoudj 536354
Christoph Galuschka 78f125
# Basic copy incheck
Athmane Madjoudj 536354
echo "Basic copy in test"
Athmane Madjoudj 536354
pushd "$INDIR"
Athmane Madjoudj 536354
cpio -i <"$OUTDIR"/cpio.out
Athmane Madjoudj 536354
t_CheckExitStatus $?
Athmane Madjoudj 536354
popd
Christoph Galuschka 78f125
# Basic pass through mode
Christoph Galuschka 78f125
echo "Basic pass through test"
Athmane Madjoudj 536354
Athmane Madjoudj 536354
pushd $INDIR
Athmane Madjoudj 536354
find . | cpio -pd "$PASSDIR"
Athmane Madjoudj 536354
t_CheckExitStatus $?
Athmane Madjoudj 536354
popd 
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# Check that $PASSDIR and $INDIR are the same
Athmane Madjoudj 536354
echo "Check that the working directories are the same"
Athmane Madjoudj 536354
diff $PASSDIR $INDIR &>/dev/null 
Athmane Madjoudj 536354
t_CheckExitStatus $?
Athmane Madjoudj 536354
Athmane Madjoudj 536354
#rm -rf /var/tmp/cpio