1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-17 20:58:34 +02:00

Add chmod to make file removal after tests more reliable.

MacOS does not allow files to be removed recursively unless the owner has write and execute permissions on all the directories.

Some tests leave the permissions in a bad state so fix them up before trying to delete.
This commit is contained in:
David Steele 2021-01-24 15:48:32 -05:00
parent 04e84da0ef
commit ef2dc6d3f4
2 changed files with 7 additions and 3 deletions

View File

@ -701,7 +701,7 @@ sub end
containerRemove("test-$self->{iVmIdx}");
}
executeTest("rm -rf ${strHostTestPath}");
executeTest("chmod -R 700 ${strHostTestPath}/* 2>&1;rm -rf ${strHostTestPath}");
}
$bDone = true;

View File

@ -169,7 +169,9 @@ testBegin(const char *name)
// Clear out the test directory so the next test starts clean
char buffer[2048];
snprintf(buffer, sizeof(buffer), "%srm -rf %s/" "*", testContainer() ? "sudo " : "", testPath());
snprintf(
buffer, sizeof(buffer), "%schmod -R 700 %s/" "*;%srm -rf %s/" "*", testContainer() ? "sudo " : "", testPath(),
testContainer() ? "sudo " : "", testPath());
if (system(buffer) != 0)
{
@ -179,7 +181,9 @@ testBegin(const char *name)
}
// Clear out the data directory so the next test starts clean
snprintf(buffer, sizeof(buffer), "%srm -rf %s/" "*", testContainer() ? "sudo " : "", testDataPath());
snprintf(
buffer, sizeof(buffer), "%schmod -R 700 %s/" "*;%srm -rf %s/" "*", testContainer() ? "sudo " : "",
testDataPath(), testContainer() ? "sudo " : "", testDataPath());
if (system(buffer) != 0)
{