diff options
author | Chris Wilson <chris+github@qwirx.com> | 2015-12-24 23:36:38 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2015-12-24 23:36:38 +0000 |
commit | 745a1e9243f074aadb2577d0b7a5d8f33efb15b5 (patch) | |
tree | e67f9cce3dda285980ba30e172a192a418bd2da3 /test | |
parent | 45943bd58e0d11eab967b3a15289c88121f33cf3 (diff) |
Fix recursive directory deletion on Windows.
Diffstat (limited to 'test')
-rw-r--r-- | test/bbackupd/testbbackupd.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp index 759b3987..888f8ea0 100644 --- a/test/bbackupd/testbbackupd.cpp +++ b/test/bbackupd/testbbackupd.cpp @@ -1610,7 +1610,11 @@ bool test_backup_pauses_when_store_is_full() // Delete a file and a directory TEST_THAT(::unlink("testfiles/TestDir1/spacetest/f1") == 0); +#ifdef WIN32 + TEST_THAT(::system("rd /s/q testfiles\\TestDir1\\spacetest\\d7") == 0); +#else TEST_THAT(::system("rm -rf testfiles/TestDir1/spacetest/d7") == 0); +#endif // The following files should be in the backup directory: // 00000001 -d---- 00002 (root) @@ -1721,7 +1725,12 @@ bool test_bbackupd_exclusions() TEST_THAT(unpack_files("spacetest1", "testfiles/TestDir1")); // Delete a file and a directory TEST_THAT(::unlink("testfiles/TestDir1/spacetest/f1") == 0); + +#ifdef WIN32 + TEST_THAT(::system("rd /s/q testfiles\\TestDir1\\spacetest\\d7") == 0); +#else TEST_THAT(::system("rm -rf testfiles/TestDir1/spacetest/d7") == 0); +#endif // We need to be OVER the limit, i.e. >24 blocks, or // BackupClientContext will mark us over limit immediately on @@ -3367,8 +3376,11 @@ bool test_delete_dir_change_attribute() // TODO FIXME dedent { // Delete a directory +#ifdef WIN32 + TEST_THAT(::system("rd /s/q testfiles\\TestDir1\\x1") == 0); +#else TEST_THAT(::system("rm -r testfiles/TestDir1/x1") == 0); - +#endif // Change attributes on an existing file. #ifdef WIN32 TEST_EQUAL(0, system("chmod 0423 testfiles/TestDir1/df9834.dsf")); @@ -3849,7 +3861,11 @@ bool test_restore_deleted_files() TEST_COMPARE(Compare_Same); TEST_THAT(::unlink("testfiles/TestDir1/f1.dat") == 0); +#ifdef WIN32 + TEST_THAT(::system("rd /s/q testfiles\\TestDir1\\x1") == 0); +#else TEST_THAT(::system("rm -r testfiles/TestDir1/x1") == 0); +#endif TEST_COMPARE(Compare_Different); bbackupd.RunSyncNow(); |