From 92d79d3e94822359d458f90d62c31147dd3ca5e1 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 17 Dec 2015 16:32:41 +0000 Subject: [PATCH 1/6] Fix Linux build break --- .../MatterControl.AutomationTests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj b/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj index 62acf5146..51239cfc4 100644 --- a/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj +++ b/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj @@ -9,7 +9,7 @@ Properties MatterControl.AutomationTests MatterControl.AutomationTests - v4.6 + v4.5 512 @@ -117,4 +117,4 @@ --> - \ No newline at end of file + From b93d534a4d888c3d23ec407b5b111707147b6afd Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 17 Dec 2015 09:26:33 -0800 Subject: [PATCH 2/6] Extract console runner from program.cs - Remove automation tests from nunit project file - Add automation project file --- Tests/TestRunner/MatterControl.nunit | 4 -- .../TestRunner/MatterControlAutomation.nunit | 11 +++ .../TestRunner/NunitConsoleRunner.cs | 69 +++++++++++++++++++ Tests/TestRunner/TestRunner/Program.cs | 64 ++--------------- Tests/TestRunner/TestRunner/TestRunner.csproj | 1 + 5 files changed, 88 insertions(+), 61 deletions(-) create mode 100644 Tests/TestRunner/MatterControlAutomation.nunit create mode 100644 Tests/TestRunner/TestRunner/NunitConsoleRunner.cs diff --git a/Tests/TestRunner/MatterControl.nunit b/Tests/TestRunner/MatterControl.nunit index b1b86f346..a9c7fc8ae 100644 --- a/Tests/TestRunner/MatterControl.nunit +++ b/Tests/TestRunner/MatterControl.nunit @@ -1,15 +1,11 @@  - - - - diff --git a/Tests/TestRunner/MatterControlAutomation.nunit b/Tests/TestRunner/MatterControlAutomation.nunit new file mode 100644 index 000000000..e9806b8cc --- /dev/null +++ b/Tests/TestRunner/MatterControlAutomation.nunit @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Tests/TestRunner/TestRunner/NunitConsoleRunner.cs b/Tests/TestRunner/TestRunner/NunitConsoleRunner.cs new file mode 100644 index 000000000..dd51a5078 --- /dev/null +++ b/Tests/TestRunner/TestRunner/NunitConsoleRunner.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; + +namespace TestRunner +{ + public class NunitConsoleRunner + { + // Currently just running from the bin folder + private const string nunitPath = "NUnit-2.6.4"; + + private Uri siteBaseUri = new Uri("http://matterdata.azurewebsites.net/"); + + public void RunTests(string projectFilePath, string resultsFilePath) + { + if (File.Exists(resultsFilePath)) + { + File.Delete(resultsFilePath); + } + + string binPath = !Directory.Exists(nunitPath) ? null : Path.Combine(nunitPath, "bin\\nunit-console-x86.exe"); + + // Run the unit tests + if (!string.IsNullOrWhiteSpace(binPath) && File.Exists(binPath)) + { + Process process = new Process(); + process.StartInfo.Arguments = string.Format( + "{0} /xml:{1} /noshadow:true /config:Release", // /include:Agg.UI" // /include:MatterControl.UI2;Leveling" + projectFilePath, + resultsFilePath); + process.StartInfo.FileName = binPath; + process.StartInfo.UseShellExecute = true; + process.Start(); + + process.WaitForExit(); + } + } + + public Uri RunAndReport(string projectFilePath, string resultsFilePath) + { + RunTests(projectFilePath, resultsFilePath); + + Debugger.Launch(); + + // Post the results + if (!File.Exists(resultsFilePath)) + { + return null; + } + else + { + var uri = new Uri(siteBaseUri, "testresults/create/"); + + // Post the file to the server + var client = new WebClient(); + var bytes = client.UploadFile(uri, resultsFilePath); + + string reportID = UTF8Encoding.UTF8.GetString(bytes); + + // Launch the results + return new Uri(siteBaseUri, "testresults/details/" + reportID); + } + } + } +} diff --git a/Tests/TestRunner/TestRunner/Program.cs b/Tests/TestRunner/TestRunner/Program.cs index 7a51d463b..8301d3ddf 100644 --- a/Tests/TestRunner/TestRunner/Program.cs +++ b/Tests/TestRunner/TestRunner/Program.cs @@ -10,71 +10,21 @@ namespace TestRunner { class Program { - private const string outputFileName = "result.xml"; - - // Currently just running from the bin folder - private const string nunitPath = "NUnit-2.6.4"; - //private const string nunitPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "NUnit 2.6.3"); static void Main(string[] args) { - Uri siteBaseUri = new Uri(args[0]); + Uri siteBaseUri = new Uri("http://matterdata.azurewebsites.net/"); - //SimulateZipPost(); - //return; + var consoleRunner = new NunitConsoleRunner(); + var resultsUrl = consoleRunner.RunAndReport( + Path.GetFullPath("../../../MatterControl.nunit"), + Path.GetFullPath("results.xml")); - if (File.Exists(outputFileName)) + if(resultsUrl != null) { - File.Delete(outputFileName); - } - - string binPath = null; - - if (Directory.Exists(nunitPath)) - { - binPath = Path.Combine(nunitPath, "bin\\nunit-console-x86.exe"); - } - - // Run the unit tests - if (!string.IsNullOrWhiteSpace(binPath) && File.Exists(binPath)) - { - Process process = new Process(); - process.StartInfo.Arguments = string.Format( - "{0} /xml:{1} /noshadow:true /config:Release", // /include:Agg.UI" // /include:MatterControl.UI2;Leveling" - Path.GetFullPath("../../../MatterControl.nunit"), - Path.GetFullPath(outputFileName)); - process.StartInfo.FileName = binPath; - process.StartInfo.UseShellExecute = true; - process.Start(); - - process.WaitForExit(); - } - - // Post the results - if (File.Exists(outputFileName)) - { - var uri = new Uri(siteBaseUri, "testresults/create/"); - - // Post the file to the server - var client = new WebClient(); - var bytes = client.UploadFile(uri, outputFileName); - - string reportID = UTF8Encoding.UTF8.GetString(bytes); - // Launch the results - Process.Start(new Uri(siteBaseUri, "testresults/details/" + reportID).AbsoluteUri); + Process.Start(resultsUrl.AbsoluteUri); } } - - private static void SimulateZipPost(Uri baseUri) - { - var uri = new Uri(baseUri, "testresults/createfromzip/"); - - // Post the file to the server - var client = new WebClient(); - var bytes = client.UploadFile(uri, @"E:\sources\websites\matterdata\TestResult4.zip"); - - string reportID = System.Text.UTF8Encoding.UTF8.GetString(bytes); - } } } diff --git a/Tests/TestRunner/TestRunner/TestRunner.csproj b/Tests/TestRunner/TestRunner/TestRunner.csproj index e87787fb2..1bc44bace 100644 --- a/Tests/TestRunner/TestRunner/TestRunner.csproj +++ b/Tests/TestRunner/TestRunner/TestRunner.csproj @@ -41,6 +41,7 @@ + From db1d86a4aff88cd99e081349cf8b01060100a988 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 17 Dec 2015 12:20:41 -0800 Subject: [PATCH 3/6] Migrate test runner to build tools --- Tests/MatterControl.nunit | 13 ++++ Tests/MatterControlAutomation.nunit | 11 +++ Tests/TestRunner/MatterControl.nunit | 13 ---- .../TestRunner/MatterControlAutomation.nunit | 11 --- .../TestRunner/NunitConsoleRunner.cs | 69 ------------------- Tests/TestRunner/TestRunner/Program.cs | 30 -------- .../TestRunner/Properties/AssemblyInfo.cs | 36 ---------- Tests/TestRunner/TestRunner/TestRunner.csproj | 56 --------------- Tests/TestRunner/TestRunner/TestRunner.sln | 20 ------ 9 files changed, 24 insertions(+), 235 deletions(-) create mode 100644 Tests/MatterControl.nunit create mode 100644 Tests/MatterControlAutomation.nunit delete mode 100644 Tests/TestRunner/MatterControl.nunit delete mode 100644 Tests/TestRunner/MatterControlAutomation.nunit delete mode 100644 Tests/TestRunner/TestRunner/NunitConsoleRunner.cs delete mode 100644 Tests/TestRunner/TestRunner/Program.cs delete mode 100644 Tests/TestRunner/TestRunner/Properties/AssemblyInfo.cs delete mode 100644 Tests/TestRunner/TestRunner/TestRunner.csproj delete mode 100644 Tests/TestRunner/TestRunner/TestRunner.sln diff --git a/Tests/MatterControl.nunit b/Tests/MatterControl.nunit new file mode 100644 index 000000000..0b5237668 --- /dev/null +++ b/Tests/MatterControl.nunit @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Tests/MatterControlAutomation.nunit b/Tests/MatterControlAutomation.nunit new file mode 100644 index 000000000..eb0a3ede0 --- /dev/null +++ b/Tests/MatterControlAutomation.nunit @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Tests/TestRunner/MatterControl.nunit b/Tests/TestRunner/MatterControl.nunit deleted file mode 100644 index a9c7fc8ae..000000000 --- a/Tests/TestRunner/MatterControl.nunit +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/Tests/TestRunner/MatterControlAutomation.nunit b/Tests/TestRunner/MatterControlAutomation.nunit deleted file mode 100644 index e9806b8cc..000000000 --- a/Tests/TestRunner/MatterControlAutomation.nunit +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/Tests/TestRunner/TestRunner/NunitConsoleRunner.cs b/Tests/TestRunner/TestRunner/NunitConsoleRunner.cs deleted file mode 100644 index dd51a5078..000000000 --- a/Tests/TestRunner/TestRunner/NunitConsoleRunner.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Net; -using System.Text; - -namespace TestRunner -{ - public class NunitConsoleRunner - { - // Currently just running from the bin folder - private const string nunitPath = "NUnit-2.6.4"; - - private Uri siteBaseUri = new Uri("http://matterdata.azurewebsites.net/"); - - public void RunTests(string projectFilePath, string resultsFilePath) - { - if (File.Exists(resultsFilePath)) - { - File.Delete(resultsFilePath); - } - - string binPath = !Directory.Exists(nunitPath) ? null : Path.Combine(nunitPath, "bin\\nunit-console-x86.exe"); - - // Run the unit tests - if (!string.IsNullOrWhiteSpace(binPath) && File.Exists(binPath)) - { - Process process = new Process(); - process.StartInfo.Arguments = string.Format( - "{0} /xml:{1} /noshadow:true /config:Release", // /include:Agg.UI" // /include:MatterControl.UI2;Leveling" - projectFilePath, - resultsFilePath); - process.StartInfo.FileName = binPath; - process.StartInfo.UseShellExecute = true; - process.Start(); - - process.WaitForExit(); - } - } - - public Uri RunAndReport(string projectFilePath, string resultsFilePath) - { - RunTests(projectFilePath, resultsFilePath); - - Debugger.Launch(); - - // Post the results - if (!File.Exists(resultsFilePath)) - { - return null; - } - else - { - var uri = new Uri(siteBaseUri, "testresults/create/"); - - // Post the file to the server - var client = new WebClient(); - var bytes = client.UploadFile(uri, resultsFilePath); - - string reportID = UTF8Encoding.UTF8.GetString(bytes); - - // Launch the results - return new Uri(siteBaseUri, "testresults/details/" + reportID); - } - } - } -} diff --git a/Tests/TestRunner/TestRunner/Program.cs b/Tests/TestRunner/TestRunner/Program.cs deleted file mode 100644 index 8301d3ddf..000000000 --- a/Tests/TestRunner/TestRunner/Program.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text; -using System.Net; - -namespace TestRunner -{ - class Program - { - - static void Main(string[] args) - { - Uri siteBaseUri = new Uri("http://matterdata.azurewebsites.net/"); - - var consoleRunner = new NunitConsoleRunner(); - var resultsUrl = consoleRunner.RunAndReport( - Path.GetFullPath("../../../MatterControl.nunit"), - Path.GetFullPath("results.xml")); - - if(resultsUrl != null) - { - // Launch the results - Process.Start(resultsUrl.AbsoluteUri); - } - } - } -} diff --git a/Tests/TestRunner/TestRunner/Properties/AssemblyInfo.cs b/Tests/TestRunner/TestRunner/Properties/AssemblyInfo.cs deleted file mode 100644 index 0b46526fb..000000000 --- a/Tests/TestRunner/TestRunner/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TestRunner")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TestRunner")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("053add9e-15c5-4ca2-8669-88889e28ef32")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/TestRunner/TestRunner/TestRunner.csproj b/Tests/TestRunner/TestRunner/TestRunner.csproj deleted file mode 100644 index 1bc44bace..000000000 --- a/Tests/TestRunner/TestRunner/TestRunner.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Debug - AnyCPU - {33677C3F-145C-476B-A882-2A44179CDECB} - Exe - Properties - TestRunner - TestRunner - v4.0 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Tests/TestRunner/TestRunner/TestRunner.sln b/Tests/TestRunner/TestRunner/TestRunner.sln deleted file mode 100644 index 9ac51c74e..000000000 --- a/Tests/TestRunner/TestRunner/TestRunner.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRunner", "TestRunner.csproj", "{33677C3F-145C-476B-A882-2A44179CDECB}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {33677C3F-145C-476B-A882-2A44179CDECB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {33677C3F-145C-476B-A882-2A44179CDECB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {33677C3F-145C-476B-A882-2A44179CDECB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {33677C3F-145C-476B-A882-2A44179CDECB}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal From eb16cdc3e6f81895e0b4ac97a5da01a405602073 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 17 Dec 2015 12:21:55 -0800 Subject: [PATCH 4/6] Add release build tests for non-referenced assemblies --- .../MatterControl/ReleaseBuildTests.cs | 85 +++++++++++++++++-- 1 file changed, 80 insertions(+), 5 deletions(-) diff --git a/Tests/MatterControl.Tests/MatterControl/ReleaseBuildTests.cs b/Tests/MatterControl.Tests/MatterControl/ReleaseBuildTests.cs index b1b6c306f..91ed551f6 100644 --- a/Tests/MatterControl.Tests/MatterControl/ReleaseBuildTests.cs +++ b/Tests/MatterControl.Tests/MatterControl/ReleaseBuildTests.cs @@ -3,9 +3,11 @@ using NUnit.Framework; using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Linq; using System.Reflection; using System.Text; +using System.Xml.Linq; namespace MatterControl.Tests { @@ -22,7 +24,82 @@ namespace MatterControl.Tests #endif } - [Test, Category("ReleaseQuality")] + [Test, Category("ReleaseQuality")] + public void MatterControlKnownAssembliesAreOptimized() + { + // Rebuild at any time with rebuildDependencies() below + string knownAssemblies = @"MatterHackers.VectorMath.dll + AGG.dll + PlatfromAbstract.dll + MatterHackers.PolygonMesh.dll + MatterHackers.Csg.dll + clipper_library.dll + MatterHackers.Agg.UI.dll + Tesselate.dll + MatterHackers.DataConverters2D.dll + MatterHackers.RenderOpenGl.dll + RayTracer.dll + MatterHackers.DataConverters3D.dll + MatterHackers.Localizations.dll + MatterHackers.OpenGL.UI.dll + agg_platform_win32.dll + WindowsFileDialogs.dll + Community.CsharpSqlite.dll + MatterHackers.SerialPortCommunication.dll + MatterHackers.MatterControl.Pulgins.dll + MatterHackers.Agg.ImageProcessing.dll + MatterHackers.MarchingSquares.dll + GuiAutomation.dll + ../../../../bin/Release/MatterControlAuth.dll + ../../../../bin/Release/PictureCreator.dll + ../../../../bin/Release/PrintNotifications.dll + ../../../../bin/Release/CloudServices.dll + ../../../../bin/Release/X3GDriver.dll + ../../../../bin/Release/Mono.Nat.dll + ../../../../bin/Release/BrailBuilder.dll + TextCreator.dll"; + + foreach (string assemblyName in knownAssemblies.Split('\n').Select(s => s.Trim())) + { + var assemblyPath = Path.GetFullPath(assemblyName); + if (!File.Exists(assemblyPath)) + { + Console.WriteLine("Skipping missing file: " + assemblyPath); + continue; + } + + var assembly = Assembly.LoadFrom(assemblyPath); + +#if (!DEBUG) + IsAssemblyOptimized(assembly); +#endif + } + } + + private void rebuildDependencies() + { + // Update to point to resent buildagent results file + var elem = XElement.Load(@"C:\Data\Sources\MatterHackers\BuildAndDeployment\MatterControl\build_sln.xml"); + var items = elem.Descendants().Where(e => e.Name == "target" && "CopyFilesToOutputDirectory" == (string)e.Attribute("name")).SelectMany(e => e.Elements("message").Select(e2 => e2.Value.TrimEnd('.')).Where(s => s.Contains("Copying") && s.Contains(".dll"))); + + var referencedItems = new List(); + + foreach (var item in items) + { + var segments = System.Text.RegularExpressions.Regex.Split(item, "to \""); + + var relativeAssemblyName = segments[1].TrimEnd('"'); + + var assemblyName = Path.GetFileName(relativeAssemblyName); + + referencedItems.Add(assemblyName); + } + + Console.WriteLine(referencedItems); + } + + + [Test, Category("ReleaseQuality")] public void MatterControlDependenciesAreOptimized() { #if(!DEBUG) @@ -40,12 +117,10 @@ namespace MatterControl.Tests IsAssemblyOptimized(assembly); } } - - Console.WriteLine(string.Join("\r\n", matterControl.GetReferencedAssemblies().Select(a => a.Name).ToArray())); #endif - } + } - [Test, Category("ReleaseQuality")] + [Test, Category("ReleaseQuality")] public void ClassicDebugComplicationFlagTests() { #if(!DEBUG) From 665303d9adaf2079948108a6bc71cf04c8a21733 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 17 Dec 2015 12:26:30 -0800 Subject: [PATCH 5/6] Latest agg --- Submodules/agg-sharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index da60e2a60..00222e4a2 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit da60e2a608b257720e7a5a6019b66768ce789aaf +Subproject commit 00222e4a2c8d1882bc6c9e29072465fe30ec48af From 15aeeee99863e1546249918b9795583acfb39feb Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 17 Dec 2015 12:33:49 -0800 Subject: [PATCH 6/6] Add missing dependency --- Tests/MatterControl.Tests/MatterControl.Tests.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/MatterControl.Tests/MatterControl.Tests.csproj b/Tests/MatterControl.Tests/MatterControl.Tests.csproj index f5a43a957..fd1ad3d82 100644 --- a/Tests/MatterControl.Tests/MatterControl.Tests.csproj +++ b/Tests/MatterControl.Tests/MatterControl.Tests.csproj @@ -61,6 +61,8 @@ False + +