From 8f2c55fb04ffa0ed25e95696b4a8c5c464523f4d Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 9 Nov 2016 15:54:41 -0600 Subject: [PATCH 1/3] Changed render tests and designer support test to always output to the artifacts/tests folder and modify the relative paths within so they don't fail on CI. Fixed CI to fail if tests fail (got turned off when OpenCover was added accidentally). --- build.cake | 24 +++++++++++++------ .../Avalonia.DesignerSupport.TestApp.csproj | 4 ++-- .../Avalonia.DesignerSupport.Tests.csproj | 10 ++++++-- .../DesignerSupportTests.cs | 4 ++-- .../Avalonia.Cairo.RenderTests.csproj | 4 ++-- .../Avalonia.Direct2D1.RenderTests.csproj | 8 ++++--- .../Avalonia.Skia.RenderTests.csproj | 6 ++--- tests/Avalonia.RenderTests/TestBase.cs | 6 ++--- 8 files changed, 42 insertions(+), 24 deletions(-) diff --git a/build.cake b/build.cake index a3d7cf64d2..e902c5d24e 100644 --- a/build.cake +++ b/build.cake @@ -662,11 +662,9 @@ Task("Run-Unit-Tests") if (isRunningOnWindows) { - var windowsTests = GetFiles("./tests/Avalonia.DesignerSupport.Tests/bin/" + dirSuffix + "/*.Tests.dll") + - GetFiles("./tests/Avalonia.LeakTests/bin/" + dirSuffix + "/*.LeakTests.dll") + - GetFiles("./tests/Avalonia.RenderTests/bin/" + dirSuffix + "/*.RenderTests.dll"); + var leakTests = GetFiles("./tests/Avalonia.LeakTests/bin/" + dirSuffix + "/*.LeakTests.dll"); - unitTests.AddRange(windowsTests); + unitTests.AddRange(leakTests); } var toolPath = (isPlatformAnyCPU || isPlatformX86) ? @@ -688,20 +686,32 @@ Task("Run-Unit-Tests") .WithFilter("-[Avalonia.*]OmniXaml.* -[Avalonia.*]Glass.*") .WithFilter("-[Avalonia.HtmlRenderer]TheArtOfDev.HtmlRenderer.* +[Avalonia.HtmlRenderer]TheArtOfDev.HtmlRenderer.Avalonia.* -[Avalonia.ReactiveUI]*"); - foreach(var test in unitTests) + openCoverSettings.ReturnTargetCodeOffset = 0; + + foreach(var test in unitTests.Where(testFile => FileExists(testFile))) { CopyDirectory(test.GetDirectory(), testsRoot); } + var testsInDirectoryToRun = new List(); + if(isRunningOnWindows) + { + testsInDirectoryToRun.AddRange(GetFiles("./artifacts/tests/*Tests.dll")); + } + else + { + testsInDirectoryToRun.AddRange(GetFiles("./artifacts/tests/*.UnitTests.dll")); + } + if(isRunningOnWindows) { OpenCover(context => { - context.XUnit2(unitTests.Select(test => testsRoot.GetFilePath(test).FullPath), xUnitSettings); + context.XUnit2(testsInDirectoryToRun, xUnitSettings); }, openCoverOutput, openCoverSettings); } else { - XUnit2(unitTests.Select(test => test.FullPath), xUnitSettings); + XUnit2(testsInDirectoryToRun, xUnitSettings); } }); diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj index 49d7f44102..3519590080 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj +++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj @@ -18,7 +18,7 @@ true full false - bin\Debug\ + ..\..\artifacts\tests\ DEBUG;TRACE prompt 4 @@ -27,7 +27,7 @@ AnyCPU pdbonly true - bin\Release\ + ..\..\artifacts\tests\ TRACE prompt 4 diff --git a/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj b/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj index 7a1c1207ce..97dfda5967 100644 --- a/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj +++ b/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj @@ -16,7 +16,7 @@ true full false - bin\Debug\ + ..\..\artifacts\tests\ DEBUG;TRACE prompt 4 @@ -24,7 +24,7 @@ pdbonly true - bin\Release\ + ..\..\artifacts\tests\ TRACE prompt 4 @@ -69,6 +69,12 @@ + + + {f1381f98-4d24-409a-a6c5-1c5b1e08bb08} + Avalonia.DesignerSupport.TestApp + +