aboutsummaryrefslogtreecommitdiff
path: root/benchmark-reverse.bash
blob: 2cb1e949a7f19a28a458fff06fb2b589b8f31765 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash -eu

# Benchmark gocryptfs' reverse mode

cd "$(dirname "$0")"
MYNAME=$(basename "$0")
source tests/fuse-unmount.bash

# Download /tmp/linux-3.0.tar.gz
./tests/dl-linux-tarball.bash

cd /tmp
PLAIN=linux-3.0

SIZE=0
if [[ -d $PLAIN ]]; then
	SIZE=$(du -s --apparent-size $PLAIN | cut -f1)
fi


if [[ $SIZE -ne 412334 ]] ; then
	echo "Extracting linux-3.0.tar.gz"
	rm -Rf $PLAIN
	tar xf linux-3.0.tar.gz
fi

rm -f $PLAIN/.gocryptfs.reverse.conf
gocryptfs -q -init -reverse -extpass="echo test" -scryptn=10 $PLAIN

MNT=$(mktemp -d /tmp/linux-3.0.reverse.mnt.XXX)

# Cleanup trap
trap "rm -f $PLAIN/.gocryptfs.reverse.conf ; fuse-unmount -z $MNT ; rmdir $MNT" EXIT

# Mount
gocryptfs -q -reverse -extpass="echo test" $PLAIN $MNT

# Print elapsed wall time only
function etime {
	LC_ALL=C /usr/bin/time -f %e 2>&1 $@ > /dev/null
}

echo -n "LS: "
etime ls -lR $MNT