ceph/qa/workunits/fs/snaps/snaptest-0.sh
Yan, Zheng 16f7d7c71e qa/workunits/fs: fix expect_failure function in test scripts
The origin expect_failure function return 0 regardness of command's
return value.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
2016-07-15 09:11:49 +08:00

28 lines
445 B
Bash
Executable File

#!/bin/sh -x
expect_failure() {
if "$@"; then return 1; else return 0; fi
}
set -e
ceph mds set allow_new_snaps false
expect_failure mkdir .snap/foo
ceph mds set allow_new_snaps true --yes-i-really-mean-it
echo asdf > foo
mkdir .snap/foo
grep asdf .snap/foo/foo
rmdir .snap/foo
echo asdf > bar
mkdir .snap/bar
rm bar
grep asdf .snap/bar/bar
rmdir .snap/bar
rm foo
ceph mds set allow_new_snaps false
expect_failure mkdir .snap/baz
echo OK