1
1
mirror of https://github.com/mgree/ffs.git synced 2024-07-14 23:00:24 +03:00
ffs/tests/submount_error.sh
Michael Greenberg 6ed74ee0c7
Timing support (#46)
Benchmarks, in two flavors: real-world benchmarks and synthetic microbenchmarks.

`--time` flag for benchmarking output on stderr.

Using R to generate pretty graphs. Some overhaul of build scripts and artifacts, with the hope of simplifying the release system.
2021-07-29 17:55:53 -07:00

63 lines
967 B
Bash
Executable File

#!/bin/sh
#
# from https://github.com/mgree/ffs/issues/42
fail() {
echo FAILED: $1
if [ "$MNT" ]
then
umount "$D"/single
rm -r "$D"
fi
exit 1
}
TESTS="$(pwd)"
TIMEOUT="$(cd ../utils; pwd)/timeout"
D=$(mktemp -d)
cp ../json/single.json "$D"/single.json
cd "$D"
ffs -i single.json &
PID=$!
sleep 2
case $(ls) in
(single*single.json) ;;
(*) fail ls1;;
esac
cd single
case $(ls) in
(onlyone) ;;
(*) fail ls2;;
esac
cp ../single.json .
"$TIMEOUT" -t 3 -l single.timeout ffs -i single.json 2>single.err
NESTEDSTATUS=$?
[ -f single.timeout ] && fail timeout
[ -s single.err ] || fail error
rm single.err
[ $NESTEDSTATUS -eq 1 ] || fail status
case $(ls) in
(onlyone*single.json) ;;
(*) fail ls3;;
esac
cd "$D"
case $(ls) in
(single*single.json) ;;
(*) fail ls4;;
esac
sleep 1
umount single || fail umount
sleep 1
kill -0 $PID >/dev/null 2>&1 && fail process
cd "$TESTS"
rm -r "$D" || fail mount