trivial updates to get more bits to work together.
[xfstests-dev.git] / run.tar
1 #!/bin/sh -x
2
3 # Produces a .tar file (if one doesn't exist as $TARFILE), then
4 # times how long it takes to untar it onto the current directory.
5
6 TARFILE=${TARFILE:=/var/tmp/bench.tar}
7
8 barf()
9 {
10         echo $@ >2
11         exit 1
12 }
13
14 new_tar()
15 {
16         source="bin sbin lib"
17         if [ ! -f $TARFILE ]; then
18                 ( cd / && tar cf $TARFILE $source ) || barf "tar c failed"
19         fi
20 }
21
22 run_tar()
23 {
24         # %U=user %S=system %E=elapsed
25         mkdir ./tar || exit 1
26         cd tar
27         /usr/bin/time -f '%U,%S,%E' tar xf $TARFILE || exit 1
28         cd ..
29         rm -fr ./tar || exit 1
30 }
31
32 if [ $# -gt 0 ]; then
33         echo "user,system,elapsed"
34         exit 0
35 fi
36 new_tar
37 run_tar