diff options
Diffstat (limited to 'lib/libbe/tests')
| -rw-r--r-- | lib/libbe/tests/Makefile | 2 | ||||
| -rwxr-xr-x | lib/libbe/tests/be_create.sh | 9 | ||||
| -rw-r--r-- | lib/libbe/tests/target_prog.c | 11 |
3 files changed, 17 insertions, 5 deletions
diff --git a/lib/libbe/tests/Makefile b/lib/libbe/tests/Makefile index dfe49bd7f3e5..57e33b75aabc 100644 --- a/lib/libbe/tests/Makefile +++ b/lib/libbe/tests/Makefile @@ -20,6 +20,6 @@ CFLAGS+= -I${ZFSTOP}/lib/libspl/include/os/freebsd CFLAGS+= -I${SRCTOP}/sys CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include CFLAGS+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h -CFLAGS+= -DHAVE_ISSETUGID +CFLAGS+= -DHAVE_ISSETUGID -DHAVE_STRLCAT -DHAVE_STRLCPY .include <bsd.test.mk> diff --git a/lib/libbe/tests/be_create.sh b/lib/libbe/tests/be_create.sh index e1342368995d..e39ce1a0ccb4 100755 --- a/lib/libbe/tests/be_create.sh +++ b/lib/libbe/tests/be_create.sh @@ -174,6 +174,15 @@ libbe_create_body() # the child dataset should exist atf_check -o not-empty \ zfs list "${zpool}/ROOT/relative-snap/usr" + + # test empty BE creation. + atf_check $prog "${zpool}/ROOT" \ + empty \ + ignored \ + 0 + # the dataset should exist + atf_check -o not-empty \ + zfs list "${zpool}/ROOT/empty" } libbe_create_cleanup() diff --git a/lib/libbe/tests/target_prog.c b/lib/libbe/tests/target_prog.c index 4c79d1a30714..83ef68ab2890 100644 --- a/lib/libbe/tests/target_prog.c +++ b/lib/libbe/tests/target_prog.c @@ -27,6 +27,7 @@ #include <sys/cdefs.h> #include <be.h> +#include <string.h> /* * argv[1] = root boot environment (e.g. zroot/ROOT), @@ -36,15 +37,17 @@ */ int main(int argc, char *argv[]) { - libbe_handle_t *lbh; + libbe_handle_t *lbh; if (argc != 5) - return -1; + return (-1); - if ((lbh = libbe_init(argv[1])) == NULL) - return -1; + if ((lbh = libbe_init(argv[1])) == NULL) + return (-1); libbe_print_on_error(lbh, true); + if (strcmp(argv[2], "empty") == 0) + return (be_create_empty(lbh, argv[2])); return (be_create_depth(lbh, argv[2], argv[3], atoi(argv[4]))); } |
