]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- added testcase for xattrs with empty value
authorArvin Schnell <aschnell@suse.de>
Wed, 24 Apr 2013 09:46:05 +0000 (11:46 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 24 Apr 2013 09:46:05 +0000 (11:46 +0200)
testsuite-real/.gitignore
testsuite-real/Makefile.am
testsuite-real/run-all
testsuite-real/xattrs3.cc [new file with mode: 0644]

index 349105970bd8a7f00ff0509934c9e81e8d84bb49..cf19d1addd37468df8ac7ed54747738fa5610bb4 100644 (file)
@@ -13,3 +13,4 @@ error3
 error4
 xattrs1
 xattrs2
+xattrs3
index 75851612db5218e103bcaa0f99fd26492afedf63..b183fb77b9e7a601eb174f54017f5f13a48d9a47 100644 (file)
@@ -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)
 
index 3253960ac5200d25d98ba1111e74f5e76bf8eb42..0f9b6edad112be2be78e63de29bcaebf0968eeef 100755 (executable)
@@ -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 (file)
index 0000000..4b6b120
--- /dev/null
@@ -0,0 +1,41 @@
+
+#include <stdlib.h>
+#include <iostream>
+
+#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);
+}