summaryrefslogtreecommitdiff
path: root/test/bbackupd
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-01-04 19:41:50 +0000
committerChris Wilson <chris+github@qwirx.com>2015-01-04 19:41:50 +0000
commit57081a4a47e9c1c66f3f6bb7eae3903892ce407d (patch)
tree795c9371afb637a75b305c6ac6d0fa2506d39dbf /test/bbackupd
parentefda4b302a2494017563e2c9d6c4ce3b0098c61d (diff)
Add test for hardlink handling.
Diffstat (limited to 'test/bbackupd')
-rw-r--r--test/bbackupd/testbbackupd.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp
index 25b00ef5..fa04c848 100644
--- a/test/bbackupd/testbbackupd.cpp
+++ b/test/bbackupd/testbbackupd.cpp
@@ -1742,6 +1742,39 @@ bool test_ssl_keepalives()
TEARDOWN();
}
+bool test_backup_hardlinked_files()
+{
+ SETUP_WITH_BBSTORED();
+
+ bbackupd.RunSyncNow();
+ TEST_COMPARE(Compare_Same);
+
+ // Create some hard links. First in the same directory:
+ TEST_THAT(link("testfiles/TestDir1/x1/dsfdsfs98.fd",
+ "testfiles/TestDir1/x1/hardlink1") == 0);
+ bbackupd.RunSyncNow();
+ TEST_COMPARE(Compare_Same);
+
+ // Now in a different directory
+ TEST_THAT(mkdir("testfiles/TestDir1/x2", 0755) == 0);
+ TEST_THAT(link("testfiles/TestDir1/x1/dsfdsfs98.fd",
+ "testfiles/TestDir1/x2/hardlink2") == 0);
+ bbackupd.RunSyncNow();
+ TEST_COMPARE(Compare_Same);
+
+ // Now delete one of them
+ TEST_THAT(unlink("testfiles/TestDir1/x1/dsfdsfs98.fd") == 0);
+ bbackupd.RunSyncNow();
+ TEST_COMPARE(Compare_Same);
+
+ // And another.
+ TEST_THAT(unlink("testfiles/TestDir1/x1/hardlink1") == 0);
+ bbackupd.RunSyncNow();
+ TEST_COMPARE(Compare_Same);
+
+ TEARDOWN();
+}
+
bool test_backup_pauses_when_store_is_full()
{
SETUP_WITHOUT_FILES();
@@ -4202,6 +4235,7 @@ int test(int argc, const char *argv[])
// TEST_THAT(test_replace_zero_byte_file_with_nonzero_byte_file());
TEST_THAT(test_backup_disappearing_directory());
TEST_THAT(test_ssl_keepalives());
+ TEST_THAT(test_backup_hardlinked_files());
TEST_THAT(test_backup_pauses_when_store_is_full());
TEST_THAT(test_bbackupd_exclusions());
TEST_THAT(test_bbackupd_uploads_files());