Skip to content

Commit f67c48a

Browse files
committed
Tests: remove output* files before a test is run (so we don't check stale files from a previous run if this one fails)
1 parent 305008f commit f67c48a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Main/Tests.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ bool TestRunner::executeTest(const fs::path& dir, const std::string& testName, s
7575
fs::path oldDir = fs::current_path();
7676
fs::current_path(dir);
7777

78+
// Remove previous output files
79+
for (const auto& file : fs::directory_iterator(fs::current_path()))
80+
{
81+
std::string fileName = file.path().filename().u8string();
82+
if (fileName.rfind("output",0) == 0)
83+
{
84+
// If filename starts with output, delete the file
85+
fs::remove(file.path());
86+
}
87+
}
88+
7889
ArmipsArguments settings;
7990
std::vector<std::string> errors;
8091
int expectedRetVal = 0;

0 commit comments

Comments
 (0)