From 0b8d3214c7acdedd60754bbb81e06039435c0e27 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 17 Dec 2015 23:38:22 +0000 Subject: Replace mv command with rename(), and replace rm -r with rmdir /s/q on Windows. Fixes test/backupstorefix. --- test/backupstorefix/testbackupstorefix.cpp | 35 +++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'test/backupstorefix') diff --git a/test/backupstorefix/testbackupstorefix.cpp b/test/backupstorefix/testbackupstorefix.cpp index a39ca60a..e92be1bd 100644 --- a/test/backupstorefix/testbackupstorefix.cpp +++ b/test/backupstorefix/testbackupstorefix.cpp @@ -700,27 +700,32 @@ int test(int argc, const char *argv[]) // structure. // This will destroy or damage objects 18-1b and 58-5b, // some repairably. - #define RUN(x) TEST_THAT(system(x) == 0); - RUN("mv testfiles/0_0/backup/01234567/02/01/o00.rf " - "testfiles/0_0/backup/01234567/02/01/o00.rfw"); // 0x18 - RUN("mv testfiles/0_1/backup/01234567/02/01/o01.rf " - "testfiles/0_1/backup/01234567/02/01/o01.rfw"); // 0x19 + TEST_THAT(rename("testfiles/0_0/backup/01234567/02/01/o00.rf", + "testfiles/0_0/backup/01234567/02/01/o00.rfw") == 0); // 0x18 + TEST_THAT(rename("testfiles/0_1/backup/01234567/02/01/o01.rf", + "testfiles/0_1/backup/01234567/02/01/o01.rfw") == 0); // 0x19 //RUN("mv testfiles/0_2/backup/01234567/02/01/o02.rf " // "testfiles/0_0/backup/01234567/02/01/o02.rfw"); // 0x1a - RUN("mv testfiles/0_0/backup/01234567/02/01/o03.rf " - "testfiles/0_0/backup/01234567/02/01/o03.rfw"); // 0x1b - RUN("mv testfiles/0_0/backup/01234567/02/01/01/o00.rf " - "testfiles/0_0/backup/01234567/02/01/01/o00.rfw"); // 0x58 - RUN("mv testfiles/0_1/backup/01234567/02/01/01/o01.rf " - "testfiles/0_1/backup/01234567/02/01/01/o01.rfw"); // 0x59 + TEST_THAT(rename("testfiles/0_0/backup/01234567/02/01/o03.rf", + "testfiles/0_0/backup/01234567/02/01/o03.rfw") == 0); // 0x1b + TEST_THAT(rename("testfiles/0_0/backup/01234567/02/01/01/o00.rf", + "testfiles/0_0/backup/01234567/02/01/01/o00.rfw") == 0); // 0x58 + TEST_THAT(rename("testfiles/0_1/backup/01234567/02/01/01/o01.rf", + "testfiles/0_1/backup/01234567/02/01/01/o01.rfw") == 0); // 0x59 //RUN("mv testfiles/0_2/backup/01234567/02/01/01/o02.rf " // "testfiles/0_0/backup/01234567/02/01/01/o02.rfw"); // 0x5a - RUN("mv testfiles/0_0/backup/01234567/02/01/01/o03.rf " - "testfiles/0_0/backup/01234567/02/01/01/o03.rfw"); // 0x5b + TEST_THAT(rename("testfiles/0_0/backup/01234567/02/01/01/o03.rf", + "testfiles/0_0/backup/01234567/02/01/01/o03.rfw") == 0); // 0x5b // RUN("rm -r testfiles/0_1/backup/01234567/02/01"); + +# define RUN(x) TEST_THAT(system(x) == 0); +# ifdef WIN32 + RUN("rmdir /s/q testfiles\\0_2\\backup\\01234567\\02\\01"); +# else // !WIN32 RUN("rm -r testfiles/0_2/backup/01234567/02/01"); - #undef RUN -#endif // BOX_RELEASE_BUILD +# endif // WIN32 +# undef RUN +#endif // !BOX_RELEASE_BUILD // Fix it // ERROR: Object 0x44 is unattached. -- cgit v1.2.3