tests: factor out dl-linux-tarball.bash
This will be also used by the reverse benchmarks.
This commit is contained in:
parent
53aedc3783
commit
53555fec1c
@ -6,24 +6,20 @@
|
|||||||
#
|
#
|
||||||
# This is called by the top-level script "benchmark.bash".
|
# This is called by the top-level script "benchmark.bash".
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
MYNAME=$(basename "$0")
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
MYNAME=$(basename $0)
|
|
||||||
echo "usage: $MYNAME TESTDIR"
|
echo "usage: $MYNAME TESTDIR"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Download /tmp/linux-3.0.tar.gz
|
||||||
|
./dl-linux-tarball.bash
|
||||||
|
|
||||||
# cd to TESTDIR
|
# cd to TESTDIR
|
||||||
cd "$1"
|
cd "$1"
|
||||||
|
|
||||||
TGZ=/tmp/linux-3.0.tar.gz
|
|
||||||
|
|
||||||
if [ "$(md5sum /tmp/linux-3.0.tar.gz | cut -f1 -d' ')" != \
|
|
||||||
"f7e6591d86a9dbe123dfd1a0be054e7f" ]; then
|
|
||||||
echo "Downloading linux-3.0.tar.gz"
|
|
||||||
wget -nv --show-progress -c -O $TGZ \
|
|
||||||
https://cdn.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.gz
|
|
||||||
fi
|
|
||||||
|
|
||||||
function etime {
|
function etime {
|
||||||
LC_ALL=C /usr/bin/time -f %e 2>&1 $@ > /dev/null
|
LC_ALL=C /usr/bin/time -f %e 2>&1 $@ > /dev/null
|
||||||
}
|
}
|
||||||
@ -33,7 +29,7 @@ dd if=/dev/zero of=zero bs=131072 count=2000 2>&1 | tail -n 1
|
|||||||
rm zero
|
rm zero
|
||||||
sleep 1
|
sleep 1
|
||||||
echo -n "UNTAR: "
|
echo -n "UNTAR: "
|
||||||
etime tar xzf $TGZ
|
etime tar xzf /tmp/linux-3.0.tar.gz
|
||||||
sleep 1
|
sleep 1
|
||||||
echo -n "LS: "
|
echo -n "LS: "
|
||||||
etime ls -lR linux-3.0
|
etime ls -lR linux-3.0
|
||||||
|
15
tests/dl-linux-tarball.bash
Executable file
15
tests/dl-linux-tarball.bash
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash -eu
|
||||||
|
#
|
||||||
|
# This script checks the MD5 sum of /tmp/linux-3.0.tar.gz and downloads
|
||||||
|
# a fresh copy if its incorrect or the file is missing.
|
||||||
|
|
||||||
|
TGZ=/tmp/linux-3.0.tar.gz
|
||||||
|
|
||||||
|
MD5_ACTUAL="$(md5sum $TGZ | cut -f1 -d' ')"
|
||||||
|
MD5_WANT="f7e6591d86a9dbe123dfd1a0be054e7f"
|
||||||
|
|
||||||
|
if [[ $MD5_ACTUAL != $MD5_WANT ]]; then
|
||||||
|
echo "Downloading linux-3.0.tar.gz"
|
||||||
|
wget -nv --show-progress -c -O $TGZ \
|
||||||
|
https://cdn.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.gz
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user