mirror of
https://github.com/mgree/ffs.git
synced 2024-10-05 15:18:20 +03:00
7249ae95df
Add --pretty flag, tests, docs. Resolves #33.
32 lines
530 B
Bash
Executable File
32 lines
530 B
Bash
Executable File
#!/bin/sh
|
|
|
|
fail() {
|
|
echo FAILED: $1
|
|
if [ "$MNT" ]
|
|
then
|
|
umount "$MNT"
|
|
rmdir "$MNT"
|
|
rm "$OUT"
|
|
fi
|
|
exit 1
|
|
}
|
|
|
|
MNT=$(mktemp -d)
|
|
OUT=$(mktemp)
|
|
|
|
ffs -m "$MNT" --target json -o "$OUT" --pretty ../json/object.json &
|
|
PID=$!
|
|
sleep 2
|
|
|
|
echo mgree >"$MNT"/handle
|
|
|
|
umount "$MNT" || fail unmount
|
|
sleep 1
|
|
kill -0 $PID >/dev/null 2>&1 && fail process
|
|
|
|
[ "$(cat $OUT | wc -l)" -eq 6 ] || fail lines
|
|
grep '^\s*"handle": "mgree",$' "$OUT" >/dev/null 2>&1 || fail handle
|
|
|
|
rmdir "$MNT" || fail mount
|
|
rm "$OUT"
|