From: Arvin Schnell Date: Wed, 24 Apr 2013 09:46:05 +0000 (+0200) Subject: - added testcase for xattrs with empty value X-Git-Tag: v0.1.3~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9293a48bde4c968561d3e3ee209985299e9b11ac;p=thirdparty%2Fsnapper.git - added testcase for xattrs with empty value --- diff --git a/testsuite-real/.gitignore b/testsuite-real/.gitignore index 34910597..cf19d1ad 100644 --- a/testsuite-real/.gitignore +++ b/testsuite-real/.gitignore @@ -13,3 +13,4 @@ error3 error4 xattrs1 xattrs2 +xattrs3 diff --git a/testsuite-real/Makefile.am b/testsuite-real/Makefile.am index 75851612..b183fb77 100644 --- a/testsuite-real/Makefile.am +++ b/testsuite-real/Makefile.am @@ -9,7 +9,7 @@ INCLUDES = -I$(top_srcdir) LDADD = ../snapper/libsnapper.la if HAVE_XATTRS -TMP_XATST = xattrs1 xattrs2 +TMP_XATST = xattrs1 xattrs2 xattrs3 endif noinst_SCRIPTS = run-all @@ -37,6 +37,7 @@ error4_SOURCES = error4.cc common.h common.cc xattrs1_SOURCES = xattrs1.cc xattrs_utils.cc xattrs_utils.h common.h common.cc xattrs2_SOURCES = xattrs2.cc xattrs_utils.cc xattrs_utils.h common.h common.cc +xattrs3_SOURCES = xattrs3.cc xattrs_utils.cc xattrs_utils.h common.h common.cc EXTRA_DIST = $(noinst_SCRIPTS) diff --git a/testsuite-real/run-all b/testsuite-real/run-all index 3253960a..0f9b6eda 100755 --- a/testsuite-real/run-all +++ b/testsuite-real/run-all @@ -37,3 +37,4 @@ run error4 test -x xattrs1 && run xattrs1 test -x xattrs2 && run xattrs2 +test -x xattrs3 && run xattrs3 diff --git a/testsuite-real/xattrs3.cc b/testsuite-real/xattrs3.cc new file mode 100644 index 00000000..4b6b1206 --- /dev/null +++ b/testsuite-real/xattrs3.cc @@ -0,0 +1,41 @@ + +#include +#include + +#include "common.h" +#include "xattrs_utils.h" + +using namespace std; + +int +main() +{ + setup(); + + run_command("touch foo"); + run_command("touch bar"); + + xattr_create("user.empty", "", SUBVOLUME "/foo"); + xattr_create("user.empty", "not-yet", SUBVOLUME "/bar"); + + first_snapshot(); + + xattr_replace("user.empty", "not-anymore", SUBVOLUME "/foo"); + xattr_replace("user.empty", "", SUBVOLUME "/bar"); + + second_snapshot(); + + undo(); + + check_undo_statistics(0, 2, 0); + + check_xa_undo_statistics(0, 2, 0); + + check_undo_errors(0, 0, 0); + + check_first(); + + cleanup(); + + exit(EXIT_SUCCESS); +}