[BACK]Return to run.tar CVS log [TXT][DIR] Up to [Development] / xfs-cmds / xfstests

File: [Development] / xfs-cmds / xfstests / run.tar (download)

Revision 1.2, Wed Sep 18 08:03:37 2002 UTC (15 years, 1 month ago) by fsgqa
Branch: MAIN
Changes since 1.1: +8 -6 lines

change directory into the test directory before running.  don't use full
path names in tar args - gives a warning.

#!/bin/sh -x
# 
# 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}

barf()
{
	echo $@ >2
	exit 1
}

new_tar()
{
	source="bin sbin lib"
	if [ ! -f $TARFILE ]; then
		( cd / && tar cf $TARFILE $source ) || barf "tar c failed"
	fi
}

run_tar()
{
	# %U=user %S=system %E=elapsed
	mkdir ./tar || exit 1
	cd tar
	/usr/bin/time -f '%U,%S,%E' tar xf $TARFILE || exit 1
	cd ..
	rm -fr ./tar || exit 1
}

if [ $# -gt 0 ]; then
	echo "user,system,elapsed"
	exit 0
fi
new_tar
run_tar