From bb14d8e13133884ef843cd3ab41bc8c57ff9bec7 Mon Sep 17 00:00:00 2001 From: Roberto Perpuly Date: Fri, 5 Jun 2015 22:18:21 +0400 Subject: [PATCH] Fix re-running aborted FS watcher test If the test is interrupted and run again an assert is raised because the temporary fswatcher_test dir has had no chance to be deleted and still exists. Fix this by removing the dir before each test. --- tests/fswatcher/fswatchertest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/fswatcher/fswatchertest.cpp b/tests/fswatcher/fswatchertest.cpp index 2aaf600308..4abee9ef3f 100644 --- a/tests/fswatcher/fswatchertest.cpp +++ b/tests/fswatcher/fswatchertest.cpp @@ -476,6 +476,14 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FileSystemWatcherTestCase, void FileSystemWatcherTestCase::setUp() { wxLog::AddTraceMask(wxTRACE_FSWATCHER); + + // Before each test, remove the dir if it exists. + // It would exist if the previous test run was aborted. + wxString tmp = wxStandardPaths::Get().GetTempDir(); + wxFileName dir; + dir.AssignDir(tmp); + dir.AppendDir("fswatcher_test"); + dir.Rmdir(wxPATH_RMDIR_RECURSIVE); EventGenerator::Get().GetWatchDir(); }