Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define a set of GlobalFixtures for the unittests.
Currently these clear the AnalysisDataService & AlgorithmManager when their tearDownWorld() methods are called, which ensures that all workspaces placed in these singletons are cleared up before the end of main. If this it not done then the process hangs on MSVC while trying to delete a Workspace2D, which contains an OpenMP loop in its destructor and omp is not allowed to be called on Windows outside of main. Refs #8216
- Loading branch information
1 parent
63296e3
commit f564331
Showing
18 changed files
with
132 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/TearDownWorld.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#ifndef TEARDOWNWORLD_H_ | ||
#define TEARDOWNWORLD_H_ | ||
/** | ||
Copyright © 2007-9 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid>. | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
#include <cxxtest/GlobalFixture.h> | ||
|
||
// This file defines a set of CxxTest::GlobalFixture classes that | ||
// are used to control various aspects of the global test setUp and tearDown | ||
// process | ||
|
||
/** | ||
* Defines a CxxTest::GlobalFixture that clears the AlgorithmManager | ||
* when its tearDownWorld() method is called. | ||
*/ | ||
class ClearAlgorithmManager : public CxxTest::GlobalFixture | ||
{ | ||
bool tearDownWorld(); | ||
}; | ||
|
||
//----------------------------------------------------------------------------- | ||
|
||
/** | ||
* Defines a CxxTest::GlobalFixture that clears the AnalysisDataService | ||
* when its tearDownWorld() method is called. | ||
*/ | ||
class ClearADS : public CxxTest::GlobalFixture | ||
{ | ||
bool tearDownWorld(); | ||
}; | ||
|
||
|
||
#endif // TEARDOWNWORLD_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//----------------------------------------------------------------------------- | ||
// Includes | ||
//----------------------------------------------------------------------------- | ||
#include "MantidTestHelpers/TearDownWorld.h" | ||
#include "MantidAPI/AlgorithmManager.h" | ||
#include "MantidAPI/AnalysisDataService.h" | ||
|
||
namespace | ||
{ | ||
/// Define single ClearAlgorithmManager object | ||
ClearAlgorithmManager clearAlgManager; | ||
/// Definition of ClearADS object; | ||
ClearADS clearADS; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
// ClearAlgorithmManager | ||
//----------------------------------------------------------------------------- | ||
/// @return True to indicate success of the tear down process | ||
bool ClearAlgorithmManager::tearDownWorld() | ||
{ | ||
Mantid::API::AlgorithmManager::Instance().clear(); | ||
return true; | ||
} | ||
|
||
|
||
//----------------------------------------------------------------------------- | ||
// ClearADS | ||
//----------------------------------------------------------------------------- | ||
|
||
/// @return True to indicate success of the tear down process | ||
bool ClearADS::tearDownWorld() | ||
{ | ||
Mantid::API::AnalysisDataService::Instance().clear(); | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters