void Module::RunModuleLevelTests(bool runCleanup) { // We want to run module level tests once only if // 1. we are in isolation mode and we are child process // 2. we are in non-isolation mode in which case we will run other tests in the parent process and so we should run module setup here if(!(Run::GetInstance().IsChild())) return; // Find and run moduleSetups if any exist for (size_t i = 0; i < m_tests.size(); i++) { Test *currentTest = m_tests[i]; if(currentTest->IsNewInterfaceTest()) { struct RegistrationInfo *r = (struct RegistrationInfo *) (currentTest->m_registration); if(ModuleSetupFixture == r->fixtureType) { if(!runCleanup) { currentTest->m_cleanupMode = TestSystem::Test::DeferredCleanup; // running ModuleSetups in isolation doesnt make any sense since // they are run for the module once anyways and any other test which // will run in isolation will get its ModuleSetup run in the child process currentTest->m_isolation = false; Run::GetInstance().ExecuteTest(currentTest, NULL, r->fixtureType); } else { Run::GetInstance().ExecuteDeferredCleanup(currentTest); } } } } }