aboutsummaryrefslogtreecommitdiff
path: root/tests/len2elen.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/len2elen.sh')
-rwxr-xr-xtests/len2elen.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/len2elen.sh b/tests/len2elen.sh
new file mode 100755
index 0000000..e101277
--- /dev/null
+++ b/tests/len2elen.sh
@@ -0,0 +1,29 @@
+#!/bin/bash -eu
+#
+# Check plaintext file name length -> encrypted file name length relation
+#
+# Part of the gocryptfs test suite
+# https://nuetzlich.net/gocryptfs/
+
+NAME="x"
+LEN=0
+
+if [[ ! -f a/gocryptfs.conf ]] ; then
+ echo "fatal: must have gocryptfs dir 'a' mounted at 'b'"
+ exit 1
+fi
+if ! mountpoint b > /dev/null ; then
+ echo "fatal: must have gocryptfs dir 'a' mounted at 'b'"
+ exit 1
+fi
+
+rm -f b/*
+
+while [[ $LEN -le 255 ]]; do
+ touch b/$NAME || break
+ ELEN=$(ls a | wc -L)
+ echo $LEN $ELEN
+ rm b/$NAME
+ NAME="${NAME}x"
+ LEN=${#NAME}
+done