From: Ondrej Kozina Date: Wed, 27 Feb 2013 12:31:23 +0000 (+0100) Subject: - add test to check XA revert on TYPE and CREATE changes in between two snapshots X-Git-Tag: v0.1.3~18^2~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b015efe98e8e87cbb7f355b0125493841f825338;p=thirdparty%2Fsnapper.git - add test to check XA revert on TYPE and CREATE changes in between two snapshots --- diff --git a/testsuite-real/xattrs2.cc b/testsuite-real/xattrs2.cc new file mode 100644 index 00000000..4b85bbc9 --- /dev/null +++ b/testsuite-real/xattrs2.cc @@ -0,0 +1,59 @@ +#include + +#include "common.h" +#include "xattrs_utils.h" + +using namespace std; + +int +main() +{ + setup(); + + run_command("mkdir first"); + run_command("touch second"); + run_command("touch delete-me"); + + run_command("ln -s first first-link"); + + // TODO: test on btrfs! + // security namespace is curently supported for dirs and links on ext4 + xattr_create("security.aaa", "aaa-value", "/testsuite/first"); + xattr_create("security.bbb", "aaa-value", "/testsuite/second"); + xattr_create("security.ccc", "ccc-value", "/testsuite/first-link"); + xattr_create("user.aaa", "aaa-value", "/testsuite/delete-me"); + + first_snapshot(); + + // change type of 'first', preserve security.aaa xa + run_command("rmdir first"); + run_command("touch first"); + xattr_create("security.aaa", "aaa-value", "/testsuite/first"); + + // change type of 'second', remove security.bbb xa + run_command("rm second"); + run_command("mkdir second"); + + run_command("rm delete-me"); + + second_snapshot(); + + undo(); + + check_undo_statistics(1, 2, 0); + + // NOTE: this test is about to fail on btrfs since the undochange cmd is implemented + // differently on it + + // the both XAs, related to 'first' and 'second' have to be recreated on undochange cmd + // the deleted file needs to have it's XA recreated as well on undochange + check_xa_undo_statistics(3, 0, 0); + + check_undo_errors(0, 0, 0); + + check_first(); + + cleanup(); + + exit(EXIT_SUCCESS); +}