Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCoreMacroStabilityTests.cs =================================================================== diff -u -r5735 -r5737 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCoreMacroStabilityTests.cs (.../MultiCoreMacroStabilityTests.cs) (revision 5735) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCoreMacroStabilityTests.cs (.../MultiCoreMacroStabilityTests.cs) (revision 5737) @@ -33,88 +33,185 @@ public class MultiCoreMacroStabilityTests { private const string mapTestFiles = @"TestFiles\"; + private const string outputBase = "Output"; + private const string calcBase = "Cores"; - [Test, Category(Categories.MultiCore)] - [Category(Categories.WorkInProgress)] //Error: The AnalyseType is set to AdaptGeometry in the input, however the geometry was not adapted in any location. Either set the AnalysisType to NoAdaptation or increase the required safety factor. - [TestCase(1)] - [TestCase(2)] - [TestCase(4)] - [TestCase(8)] - [TestCase(18)] - public void DebugDesignAdaptionWithXmlInputFile(int maxCores) + [TestFixture] + public class MultiCoreDesignBishopGridTests { - const string calcBase = "DebugDesignAdaptionWithXmlInputFile"; - const string inputFilename = "DesignBishopGrid1Core.xml"; - const string outputBase = "OutputDesignBishopGrid1Core"; - TestMultiCoreStability(maxCores, calcBase, inputFilename, outputBase, 8); + private const string workDir = @"MultiCoreDesignBishopGridTests\"; + + [OneTimeSetUp] + public void Init() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + DebugDesignAdaptionWithXmlInputFile(1); + } + + [OneTimeTearDown] + public void Cleanup() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + } + + [Test, Category(Categories.MultiCore)] + [Category(Categories.WorkInProgress)] //Error: The AnalyseType is set to AdaptGeometry in the input, however the geometry was not adapted in any location. Either set the AnalysisType to NoAdaptation or increase the required safety factor. + [TestCase(2)] + [TestCase(4)] + [TestCase(8)] + [TestCase(18)] + public void DebugDesignAdaptionWithXmlInputFile(int maxCores) + { + const string inputFilename = "DesignBishopGrid1Core.xml"; + TestMultiCoreStability(maxCores, workDir, inputFilename, 8); + } } - [Test, Category(Categories.MultiCore)] - [TestCase(1)] - [TestCase(4)] - [TestCase(16)] - public void DesignBishopWithScenariosForHeadPl3CalculatesCorrect(int maxCores) + [TestFixture] + public class MultiCoreDesignBishopWithScenariosPl3 { - const string calcBase = "DesignBishopWithScenariosForHeadPl3CalculatesCorrect"; - const string inputFilename = "InputFileMultiCoreTestForScenario.xml"; - const string outputBase = "OutputFileMultiCoreTestForScenario"; - TestMultiCoreStability(maxCores, calcBase, inputFilename, outputBase, 18); + private const string workDir = @"MultiCoreDesignBishopWithScenariosPl3\"; + + [OneTimeSetUp] + public void Init() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + DesignBishopWithScenariosForHeadPl3CalculatesCorrect(1); + } + + [OneTimeTearDown] + public void Cleanup() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + } + + [Test, Category(Categories.MultiCore)] + [TestCase(4)] + [TestCase(16)] + public void DesignBishopWithScenariosForHeadPl3CalculatesCorrect(int maxCores) + { + const string inputFilename = "InputFileMultiCoreTestForScenario.xml"; + TestMultiCoreStability(maxCores, workDir, inputFilename, 18); + } } - [Test, Category(Categories.MultiCore)] - [TestCase(1)] - [TestCase(4)] - [TestCase(16)] - public void DesignBishopWithOneScenariosForHeadPl3CalculatesCorrect(int maxCores) + [TestFixture] + public class MultiCoreDesignBishopOneScenarioPl3 { - const string calcBase = "DesignBishopWithScenariosForHeadPl3CalculatesCorrect"; - const string inputFilename = "InputFileMultiCoreTestForScenario.xml"; - const string outputBase = "OutputFileMultiCoreTestForScenario"; - TestMultiCoreStability(maxCores, calcBase, inputFilename, outputBase, 9, true); + private const string workDir = @"MultiCoreDesignBishopOneScenarioPl3\"; + + [OneTimeSetUp] + public void Init() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + DesignBishopWithOneScenariosForHeadPl3CalculatesCorrect(1); + } + + [OneTimeTearDown] + public void Cleanup() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + } + + [Test, Category(Categories.MultiCore)] + [TestCase(4)] + [TestCase(16)] + public void DesignBishopWithOneScenariosForHeadPl3CalculatesCorrect(int maxCores) + { + const string inputFilename = "InputFileMultiCoreTestForScenario.xml"; + TestMultiCoreStability(maxCores, workDir, inputFilename, 9, true); + } } - [Test, Category(Categories.MultiCore)] - [Category(Categories.WorkInProgress)] //Error: The AnalyseType is set to AdaptGeometry in the input, however the geometry was not adapted in any location. Either set the AnalysisType to NoAdaptation or increase the required safety factor. - [TestCase(1)] - [TestCase(4)] - [TestCase(16)] - public void DesignBishopAdaptionWithScenariosForHeadPl3CalculatesCorrect(int maxCores) + [TestFixture] + public class MultiCoreAdaptBishopWithScenariosPl3 { - const string calcBase = "DesignBishopAdaptionWithScenariosForHeadPl3CalculatesCorrect"; - const string inputFilename = "InputFileMultiCoreTestForScenarioAdaption.xml"; - const string outputBase = "OutputFileMultiCoreTestForScenariosAdaption"; - TestMultiCoreStability(maxCores, calcBase, inputFilename, outputBase, 14); + private const string workDir = @"MultiCoreAdaptBishopWithScenariosPl3\"; + + [OneTimeSetUp] + public void Init() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + DesignBishopAdaptionWithScenariosForHeadPl3CalculatesCorrect(1); + } + + [OneTimeTearDown] + public void Cleanup() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + } + + [Test, Category(Categories.MultiCore)] + [Category(Categories.WorkInProgress)] //Error: The AnalyseType is set to AdaptGeometry in the input, however the geometry was not adapted in any location. Either set the AnalysisType to NoAdaptation or increase the required safety factor. + [TestCase(4)] + [TestCase(16)] + public void DesignBishopAdaptionWithScenariosForHeadPl3CalculatesCorrect(int maxCores) + { + const string inputFilename = "InputFileMultiCoreTestForScenarioAdaption.xml"; + TestMultiCoreStability(maxCores, workDir, inputFilename, 14); + } } - [Test, Category(Categories.MultiCore)] - [Category(Categories.WorkInProgress)] //Error: The AnalyseType is set to AdaptGeometry in the input, however the geometry was not adapted in any location. Either set the AnalysisType to NoAdaptation or increase the required safety factor. - [TestCase(1)] - [TestCase(4)] - [TestCase(16)] - public void DesignBishopAdaptionWithOneScenarioForHeadPl3CalculatesCorrect(int maxCores) + [TestFixture] + public class MultiCoreAdaptBishopOneScenarioPl3 { - const string calcBase = "DesignBishopAdaptionWithOneScenarioForHeadPl3CalculatesCorrect"; - const string inputFilename = "InputFileMultiCoreTestForScenarioAdaption.xml"; - const string outputBase = "OutputFileMultiCoreTestForOneScenarioAdaption"; - TestMultiCoreStability(maxCores, calcBase, inputFilename, outputBase, 7, true); + private const string workDir = @"MultiCoreAdaptBishopOneScenarioPl3\"; + + [OneTimeSetUp] + public void Init() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + DesignBishopAdaptionWithOneScenarioForHeadPl3CalculatesCorrect(1); + } + + [OneTimeTearDown] + public void Cleanup() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + } + + [Test, Category(Categories.MultiCore)] + [Category(Categories.WorkInProgress)] //Error: The AnalyseType is set to AdaptGeometry in the input, however the geometry was not adapted in any location. Either set the AnalysisType to NoAdaptation or increase the required safety factor. + [TestCase(4)] + [TestCase(16)] + public void DesignBishopAdaptionWithOneScenarioForHeadPl3CalculatesCorrect(int maxCores) + { + const string inputFilename = "InputFileMultiCoreTestForScenarioAdaption.xml"; + TestMultiCoreStability(maxCores, workDir, inputFilename, 7, true); + } } - [Test, Category("MultiCore")] - [TestCase(1)] - [TestCase(16)] - [TestCase(23)] - public void LargeInsideBishopNoAdaptionGridCalculatesCorrect(int maxCores) + [TestFixture] + public class MultiCoreDesignLargeBishopTests { - const string calcBase = "LargeInsideBishopNoAdaptionGridCalculatesCorrect"; - const string inputFilename = "LargeInsideBishopNoAdaptionGrid.xml"; - const string outputBase = "OutputLargeInsideBishopNoAdaptionGrid"; - TestMultiCoreStability(maxCores, calcBase, inputFilename, outputBase, 724, false, false); + private const string workDir = @"MultiCoreDesignLargeBishopTests\"; + + [OneTimeSetUp] + public void Init() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + LargeInsideBishopNoAdaptionGridCalculatesCorrect(1); + } + + [OneTimeTearDown] + public void Cleanup() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + } + + [Test, Category("MultiCore")] + [TestCase(16)] + [TestCase(23)] + public void LargeInsideBishopNoAdaptionGridCalculatesCorrect(int maxCores) + { + const string inputFilename = "LargeInsideBishopNoAdaptionGrid.xml"; + TestMultiCoreStability(maxCores, workDir, inputFilename, 724, false, false); + } } - private static void TestMultiCoreStability(int maxCores, string calcBase, string inputFilename, string outputBase, + private static void TestMultiCoreStability(int maxCores, string workDir, string inputFilename, int expectedResults, bool justOneScenario = false, bool expectedNoErrors = true) { - const string workDir = @"TestMultiCoreDesignStability\"; string calcDir = workDir + calcBase + maxCores; string outputFilename = Path.Combine(calcDir, outputBase + maxCores + ".xml"); if (maxCores > 1) Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalMultiCoreTests.cs =================================================================== diff -u -r5733 -r5737 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalMultiCoreTests.cs (.../OperationalMultiCoreTests.cs) (revision 5733) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalMultiCoreTests.cs (.../OperationalMultiCoreTests.cs) (revision 5737) @@ -36,38 +36,71 @@ public class OperationalMultiCoreTests { private const string mapTestFiles = @"TestFiles\"; + private const string outputBase = "Output"; + private const string calcBase = "Cores"; - [Test, Category(Categories.MultiCore)] - [Category(Categories.WorkInProgress)] // expected real results should be 16, but only 8 are found - [TestCase(1)] - [TestCase(10)] - [TestCase(24)] - public void TestMultiCoreOperationalBeeSwarmWithXmlInputFile(int maxCores) + [TestFixture] + public class MultiCoreOperationalBeeSwarmTests { - const string calcBase = "MultiCoreOperationalBeeSwarm"; - const string inputFilename = "InputForDebuggingBeeSwarm.xml"; - const string outputBase = "OutputForDebuggingBeeSwarm"; - TestMultiCoreOperational(maxCores, calcBase, inputFilename, outputBase, 8, 16, 16); + private const string workDir = @"MultiCoreOperationalBeeSwarmTests\"; + + [OneTimeSetUp] + public void Init() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + MultiCoreOperationalBeeSwarmWithXmlInputFile(1); + } + + [OneTimeTearDown] + public void Cleanup() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + } + + [Test, Category(Categories.MultiCore)] + [Category(Categories.WorkInProgress)] // expected real results should be 16, but only 8 are found + [TestCase(10)] + [TestCase(24)] + public void MultiCoreOperationalBeeSwarmWithXmlInputFile(int maxCores) + { + const string inputFilename = "InputForDebuggingBeeSwarm.xml"; + TestMultiCoreOperational(maxCores, workDir, inputFilename, 8, 16, 16); + } } - [Test, Category(Categories.MultiCore)] - [TestCase(1)] - [TestCase(2)] - [TestCase(4)] - [TestCase(8)] - [TestCase(18)] - public void MultiCoreOperationalBishopGridWithXmlInputFile(int maxCores) + [TestFixture] + public class MultiCoreOperationalBishopGridTests { - const string calcBase = "MultiCoreOperationalBishopGrid"; - const string inputFilename = "OperationalBishopGrid1Core.xml"; - const string outputBase = "OutputForOperationalBishopGrid"; - TestMultiCoreOperational(maxCores, calcBase, inputFilename, outputBase, 8, 16, 16); + private const string workDir = @"MultiCoreOperationalBishopGridTests\"; + + [OneTimeSetUp] + public void Init() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + MultiCoreOperationalBishopGridWithXmlInputFile(1); + } + + [OneTimeTearDown] + public void Cleanup() + { + GeneralHelper.RemoveTestWorkingDirectory(workDir); + } + + [Test, Category(Categories.MultiCore)] + // [TestCase(2)] + // [TestCase(4)] + // [TestCase(8)] + [TestCase(18)] + public void MultiCoreOperationalBishopGridWithXmlInputFile(int maxCores) + { + const string inputFilename = "OperationalBishopGrid1Core.xml"; + TestMultiCoreOperational(maxCores, workDir, inputFilename, 8, 16, 16); + } } - private static void TestMultiCoreOperational(int maxCores, string calcBase, string inputFilename, string outputBase, + private static void TestMultiCoreOperational(int maxCores, string workDir, string inputFilename, int expectedTimeSeries, int expectedResults, int expectedRealResults) { - const string workDir = @"TestMultiCoreOperational\"; string calcDir = workDir + calcBase + maxCores; string outputFilename = Path.Combine(calcDir, outputBase + maxCores + ".xml"); if (maxCores > 1) @@ -81,12 +114,12 @@ string outputCopy1Core = Path.Combine(calcDir, outputBase + "1.xml"); File.Copy(outputFilename1Core, outputCopy1Core, true); output1Core = DamXmlSerialization.LoadOutputFromXmlFile(outputCopy1Core); + GeneralHelper.CompareOutput(output1Core, outputMultiCore); } else { - output1Core = RunOperationalMultiCoreWithXmlInputFile(1, calcDir1Core, inputFilename, outputFilename1Core); + Assert.Fail("File not found: " + outputFilename1Core); } - GeneralHelper.CompareOutput(output1Core, outputMultiCore); } else { @@ -95,7 +128,7 @@ CheckNumberOfRealResults(output1Core, expectedResults, expectedRealResults); } } - + private static Output RunOperationalMultiCoreWithXmlInputFile(int maxCores, string calcDir, string inputFilename, string outputFilename) { if (Directory.Exists(calcDir)) @@ -142,4 +175,4 @@ Assert.That(numberOfRealResults, Is.EqualTo(expectedNumberOfRealResults)); }); } -} \ No newline at end of file +} \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/GeneralHelper.cs =================================================================== diff -u -r5729 -r5737 --- DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/GeneralHelper.cs (.../GeneralHelper.cs) (revision 5729) +++ DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/GeneralHelper.cs (.../GeneralHelper.cs) (revision 5737) @@ -239,5 +239,14 @@ ComparisonResult result = compare.Compare(expected, actual); Assert.That(result.Differences, Is.Empty, "Differences found read/write Output object"); } + + public static void RemoveTestWorkingDirectory(string testWorkingFolder) + { + if (Directory.Exists(testWorkingFolder)) + { + const bool recursive = true; + Directory.Delete(testWorkingFolder, recursive); + } + } } \ No newline at end of file