Files
apfstests/run.tar
T
Dave Chinner fa6a7868cd xfsqa: more sh to bash conversions
A new test is using /bin/sh and failing on debian. Clean it up and all the
remaining uses of /bin/sh.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-04-29 09:59:24 +10:00

41 lines
720 B
Bash
Executable File

#!/bin/bash
#
# Produces a .tar file (if one doesn't exist as $TARFILE), then
# times how long it takes to untar it onto the current directory.
#
TARFILE=${TARFILE:=/var/tmp/bench.tar.gz}
barf()
{
echo $@ >2
exit 1
}
new_tar()
{
source="bin sbin lib"
if [ ! -f $TARFILE ]; then
( cd / && tar czf $TARFILE $source ) || barf "tar cz failed"
fi
}
run_tar()
{
# %U=user %S=system %E=elapsed
mkdir ./tar || exit 1
size=`ls -Llh $TARFILE | awk '{print $5}'`
time=`/usr/bin/time -f '%U, %S, %E' tar xzf $TARFILE 2>&1`
status=$?
cd ..
rm -fr ./tar
[ $status -eq 0 ] || exit 1
printf "%6s, %s\n" "$size" "$time"
}
if [ $# -gt 0 ]; then
printf "%6s,%5s,%5s,%8s\n" sz usr sys real
exit 0
fi
new_tar
run_tar