aboutsummaryrefslogtreecommitdiff
path: root/tests/stress_tests/pjdfstest.bash
blob: a786e418ecdc91210612ccfb32a7c21d4f5f97e2 (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
#!/usr/bin/env bash
#
# Mount a gocryptfs filesystem in /var/tmp and run pjdfstest against it

set -eu

export TMPDIR=${TMPDIR:-/var/tmp}

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

pjdfstest_dir=$(realpath ../../../pjdfstest)
if [[ ! -x $pjdfstest_dir/pjdfstest ]]
then
	echo "$MYNAME: pjdfstest binary not found at $pjdfstest_dir/pjdfstest"
	echo "Please clone and build https://github.com/pjd/pjdfstest"
	exit 1
fi

# Backing directory + mountpoint
DIR=$(mktemp -d "$TMPDIR/$MYNAME.XXX")
MNT="$DIR.mnt"
mkdir "$MNT"

../../gocryptfs -q -init -extpass "echo test" -scryptn=10 "$DIR"
sudo ../../gocryptfs -q -extpass "echo test" -nosyslog -allow_other "$DIR" "$MNT"
cd "$MNT"

# Cleanup trap
trap "cd /tmp ; fuse-unmount -z $MNT" EXIT

echo "Starting pjdfstest"
sudo prove -r "$pjdfstest_dir/tests"