2017-01-03 15:16:02 +01:00
|
|
|
#!/bin/bash -eu
|
|
|
|
|
|
|
|
# Benchmark gocryptfs' reverse mode
|
|
|
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
MYNAME=$(basename "$0")
|
2017-02-15 23:02:01 +01:00
|
|
|
source tests/fuse-unmount.bash
|
2017-01-03 15:16:02 +01:00
|
|
|
|
|
|
|
# Download /tmp/linux-3.0.tar.gz
|
|
|
|
./tests/dl-linux-tarball.bash
|
|
|
|
|
|
|
|
cd /tmp
|
|
|
|
PLAIN=linux-3.0
|
|
|
|
|
|
|
|
SIZE=0
|
|
|
|
if [[ -d $PLAIN ]]; then
|
2021-08-31 19:01:47 +02:00
|
|
|
SIZE=$(du -s --apparent-size "$PLAIN" | cut -f1)
|
2017-01-03 15:16:02 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $SIZE -ne 412334 ]] ; then
|
|
|
|
echo "Extracting linux-3.0.tar.gz"
|
2021-08-31 19:01:47 +02:00
|
|
|
rm -Rf "$PLAIN"
|
2017-01-03 15:16:02 +01:00
|
|
|
tar xf linux-3.0.tar.gz
|
|
|
|
fi
|
|
|
|
|
2021-08-31 19:01:47 +02:00
|
|
|
rm -f "$PLAIN/.gocryptfs.reverse.conf"
|
|
|
|
gocryptfs -q -init -reverse -extpass="echo test" -scryptn=10 "$PLAIN"
|
2017-01-03 15:16:02 +01:00
|
|
|
|
|
|
|
MNT=$(mktemp -d /tmp/linux-3.0.reverse.mnt.XXX)
|
|
|
|
|
|
|
|
# Cleanup trap
|
2020-04-13 13:09:27 +02:00
|
|
|
trap 'rm -f "$PLAIN/.gocryptfs.reverse.conf" ; fuse-unmount -z "$MNT" ; rmdir "$MNT"' EXIT
|
2017-01-03 15:16:02 +01:00
|
|
|
|
|
|
|
# Mount
|
2020-04-13 13:09:27 +02:00
|
|
|
gocryptfs -q -reverse -extpass="echo test" "$PLAIN" "$MNT"
|
2017-01-03 15:16:02 +01:00
|
|
|
|
2017-02-16 19:01:24 +01:00
|
|
|
# Execute command, discard all stdout output, print elapsed time
|
|
|
|
# (to stderr, unfortunately).
|
2021-08-31 19:01:47 +02:00
|
|
|
etime() {
|
2017-02-16 19:01:24 +01:00
|
|
|
# Make the bash builtin "time" print out only the elapse wall clock
|
|
|
|
# seconds
|
|
|
|
TIMEFORMAT=%R
|
|
|
|
time "$@" > /dev/null
|
2017-01-03 15:16:02 +01:00
|
|
|
}
|
|
|
|
|
2017-04-01 15:40:09 +02:00
|
|
|
echo -n "LS: "
|
2020-04-13 13:09:27 +02:00
|
|
|
etime ls -lR "$MNT"
|
2017-04-01 15:40:09 +02:00
|
|
|
echo -n "CAT: "
|
2020-04-13 13:09:27 +02:00
|
|
|
etime find "$MNT" -type f -exec cat {} +
|