This commit is contained in:
암냥 2026-06-23 09:56:21 +09:00
commit 5625d6bd14
11 changed files with 821 additions and 0 deletions

20
tests/test.sh Normal file
View file

@ -0,0 +1,20 @@
#!/bin/sh
set -eu
bin="${GERBERA_BIN:-./build/gerbera}"
work="${TMPDIR:-/tmp}/gerbera-test-$$"
mkdir "$work"
trap 'rm -rf "$work"' EXIT HUP INT TERM
printf 'Array-based encryption test\n\000\001\377' > "$work/plain.bin"
"$bin" encrypt "$work/plain.bin" "$work/encrypted.gerbera" 'test-password'
"$bin" decrypt "$work/encrypted.gerbera" "$work/decrypted.bin" 'test-password'
cmp "$work/plain.bin" "$work/decrypted.bin"
if "$bin" decrypt "$work/encrypted.gerbera" "$work/wrong.bin" 'wrong-password'; then
echo "wrong password unexpectedly succeeded" >&2
exit 1
fi
test ! -e "$work/wrong.bin"
echo "All tests passed."