diff --git a/ReleaseNotes.tmp b/ReleaseNotes.tmp index 1567207ea..85684529c 100644 --- a/ReleaseNotes.tmp +++ b/ReleaseNotes.tmp @@ -1,10 +1,13 @@ Version [[version]] -#307 add -version to args -#305 add corclr_profiler_path support -#303 support for test cases and theories during track by test +#315 update nuget package (fix for VS2015) +#320 update packages (fix for VS2015) +#304 add switch to control timeout wait (feature) +#307 add -version to args (feature) +#305 add corclr_profiler_path support (feature) +#303 support for test cases and theories during track by test (feature) #295 exclude assembly by attribute (feature) #288 report (to console) if can't ready body of method (diag) -#287 fix crash +#287 fix crash (fix) #283 Add visited class/method to summary entity (feature) #274 Use thread based buffers for performance improvement (fix) diff --git a/main/.nuget/packages.config b/main/.nuget/packages.config index d4e7535e7..6a2daf408 100644 --- a/main/.nuget/packages.config +++ b/main/.nuget/packages.config @@ -5,6 +5,6 @@ - + \ No newline at end of file diff --git a/main/OpenCover.Console/Program.cs b/main/OpenCover.Console/Program.cs index c4098e08a..38918ff0f 100644 --- a/main/OpenCover.Console/Program.cs +++ b/main/OpenCover.Console/Program.cs @@ -240,7 +240,7 @@ private static void RunService(CommandLineParser parser, ActionFalse ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll - - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.dll + + False + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.dll False - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Mdb.dll + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Mdb.dll - - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Pdb.dll - True + + False + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Pdb.dll - - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Rocks.dll + + False + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Rocks.dll diff --git a/main/OpenCover.Extensions/packages.config b/main/OpenCover.Extensions/packages.config index 2c5e7c338..3423c8131 100644 --- a/main/OpenCover.Extensions/packages.config +++ b/main/OpenCover.Extensions/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/main/OpenCover.Framework/CommandLineParser.cs b/main/OpenCover.Framework/CommandLineParser.cs index ce54c626a..de34a7db1 100644 --- a/main/OpenCover.Framework/CommandLineParser.cs +++ b/main/OpenCover.Framework/CommandLineParser.cs @@ -80,6 +80,7 @@ public CommandLineParser(string[] arguments) EnablePerformanceCounters = false; TraceByTest = false; ServiceEnvironment = ServiceEnvironment.None; + ServiceStartTimeout = new TimeSpan(0, 0, 30); RegExFilters = false; Registration = Registration.Normal; PrintVersion = false; @@ -112,6 +113,7 @@ public string Usage() builder.AppendLine(" [-hideskipped:File|Filter|Attribute|MissingPdb|All,[File|Filter|Attribute|MissingPdb|All]]"); builder.AppendLine(" [-log:[Off|Fatal|Error|Warn|Info|Debug|Verbose|All]]"); builder.AppendLine(" [-service[:byname]]"); + builder.AppendLine(" [-servicestarttimeout:1m23s"); builder.AppendLine(" [-threshold:]"); builder.AppendLine(" [-enableperformancecounters]"); builder.AppendLine(" [-skipautoprops]"); @@ -221,6 +223,10 @@ public void ExtractAndValidateArguments() ServiceEnvironment = val; } break; + case "servicestarttimeout": + var timeoutValue = GetArgumentValue("servicestarttimeout"); + ServiceStartTimeout = ParseTimeoutValue(timeoutValue); + break; case "oldstyle": OldStyleInstrumentation = true; break; @@ -305,6 +311,43 @@ private static List ExtractSkipped(string skipped) return list.Distinct().ToList(); } + private TimeSpan ParseTimeoutValue(string timeoutValue) + { + var match = Regex.Match(timeoutValue, @"((?\d+)m)?((?\d+)s)?"); + if (match.Success) + { + int minutes = 0, seconds = 0; + + var minutesMatch = match.Groups["minutes"]; + if (minutesMatch.Success) + { + minutes = int.Parse(minutesMatch.Value); + } + + var secondsMatch = match.Groups["seconds"]; + if (secondsMatch.Success) + { + seconds = int.Parse(secondsMatch.Value); + } + + if (minutes == 0 && seconds == 0) + { + throw ExceptionForInvalidArgumentValue(timeoutValue, "servicestarttimeout"); + } + + return new TimeSpan(0, minutes, seconds); + } + else + { + throw ExceptionForInvalidArgumentValue(timeoutValue, "servicestarttimeout"); + } + } + + private static Exception ExceptionForInvalidArgumentValue(string argumentName, string argumentValue) + { + return new Exception(string.Format("Incorrect argument: {0} for {1}", argumentValue, argumentName)); + } + private void ValidateArguments() { if (PrintUsage || PrintVersion) return; @@ -436,6 +479,11 @@ private void ValidateArguments() /// public ServiceEnvironment ServiceEnvironment { get; private set; } + /// + /// Gets the timeout to wait for the service to start up + /// + public TimeSpan ServiceStartTimeout { get; private set; } + /// /// Use the old style of instrumentation that even though not APTCA friendly will /// work when - ngen install /Profile "mscorlib" - has been used diff --git a/main/OpenCover.Framework/OpenCover.Framework.csproj b/main/OpenCover.Framework/OpenCover.Framework.csproj index 4be8b0430..cec4d7b0a 100644 --- a/main/OpenCover.Framework/OpenCover.Framework.csproj +++ b/main/OpenCover.Framework/OpenCover.Framework.csproj @@ -64,18 +64,19 @@ False - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.dll + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.dll False - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Mdb.dll + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Mdb.dll False - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Pdb.dll + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Pdb.dll - - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Rocks.dll + + False + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Rocks.dll diff --git a/main/OpenCover.Framework/packages.config b/main/OpenCover.Framework/packages.config index 83b6de4e1..9f96e01ab 100644 --- a/main/OpenCover.Framework/packages.config +++ b/main/OpenCover.Framework/packages.config @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/main/OpenCover.Gendarme.Signer/OpenCover.Gendarme.Signer.csproj b/main/OpenCover.Gendarme.Signer/OpenCover.Gendarme.Signer.csproj index 61fd1fc7c..7582c303e 100644 --- a/main/OpenCover.Gendarme.Signer/OpenCover.Gendarme.Signer.csproj +++ b/main/OpenCover.Gendarme.Signer/OpenCover.Gendarme.Signer.csproj @@ -42,18 +42,19 @@ False - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.dll + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.dll - - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Mdb.dll + + False + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Mdb.dll False - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Pdb.dll + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Pdb.dll False - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Rocks.dll + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Rocks.dll diff --git a/main/OpenCover.Gendarme.Signer/packages.config b/main/OpenCover.Gendarme.Signer/packages.config index 32856a726..14bfa355e 100644 --- a/main/OpenCover.Gendarme.Signer/packages.config +++ b/main/OpenCover.Gendarme.Signer/packages.config @@ -1,5 +1,5 @@  - + diff --git a/main/OpenCover.Integration.Test/OpenCover.Integration.Test.csproj b/main/OpenCover.Integration.Test/OpenCover.Integration.Test.csproj index 52d4bcc73..99d9c130c 100644 --- a/main/OpenCover.Integration.Test/OpenCover.Integration.Test.csproj +++ b/main/OpenCover.Integration.Test/OpenCover.Integration.Test.csproj @@ -37,9 +37,9 @@ False ..\packages\log4net.2.0.3\lib\net40-full\log4net.dll - + False - ..\packages\Moq.4.2.1502.0911\lib\net40\Moq.dll + ..\packages\Moq.4.2.1507.0118\lib\net40\Moq.dll False diff --git a/main/OpenCover.Integration.Test/packages.config b/main/OpenCover.Integration.Test/packages.config index ce21aecd7..c144bcc52 100644 --- a/main/OpenCover.Integration.Test/packages.config +++ b/main/OpenCover.Integration.Test/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/main/OpenCover.NugetPackage/OpenCover.nuspec b/main/OpenCover.NugetPackage/OpenCover.nuspec index f0c9aa395..0cd4571a6 100644 --- a/main/OpenCover.NugetPackage/OpenCover.nuspec +++ b/main/OpenCover.NugetPackage/OpenCover.nuspec @@ -16,26 +16,26 @@ Code-Coverage Reporting Testing TDD Utility - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + @@ -61,4 +61,4 @@ - \ No newline at end of file + diff --git a/main/OpenCover.Specs/Packaging.feature b/main/OpenCover.Specs/Packaging.feature index d57a675f9..a53122dda 100644 --- a/main/OpenCover.Specs/Packaging.feature +++ b/main/OpenCover.Specs/Packaging.feature @@ -1,4 +1,4 @@ -Feature: Packaging +Feature: Packaging In order to avoid deployment issues As a software packager I want to be sure that opencover runs after installation @@ -15,8 +15,8 @@ Scenario: Run OpenCover after installing from zip file Scenario: Run OpenCover after installing from a nuget package Given I have a valid nugetpackage in the output folder And I unpack that package into a deployment folder - When I execute the deployed OpenCover against the x86 target application - And I execute the deployed OpenCover against the x64 target application + When I execute the deployed OpenCover against the x86 target application in subfolder tools + And I execute the deployed OpenCover against the x64 target application in subfolder tools Then the coverage results should be the same @msitag diff --git a/main/OpenCover.Specs/Packaging.feature.cs b/main/OpenCover.Specs/Packaging.feature.cs index 95a9a553c..9e7f704aa 100644 --- a/main/OpenCover.Specs/Packaging.feature.cs +++ b/main/OpenCover.Specs/Packaging.feature.cs @@ -1,9 +1,9 @@ -// ------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // // This code was generated by SpecFlow (http://www.specflow.org/). // SpecFlow Version:1.9.0.77 // SpecFlow Generator Version:1.9.0.0 -// Runtime Version:4.0.30319.18033 +// Runtime Version:4.0.30319.34014 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -32,8 +32,8 @@ public partial class PackagingFeature public virtual void FeatureSetup() { testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); - TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Packaging", "In order to avoid deployment issues\r\nAs a software packager\r\nI want to be sure th" + - "at opencover runs after installation", ProgrammingLanguage.CSharp, ((string[])(null))); + TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Packaging", "In order to avoid deployment issues\nAs a software packager\nI want to be sure that" + + " opencover runs after installation", ProgrammingLanguage.CSharp, ((string[])(null))); testRunner.OnFeatureStart(featureInfo); } @@ -102,9 +102,11 @@ public virtual void RunOpenCoverAfterInstallingFromANugetPackage() #line 17 testRunner.And("I unpack that package into a deployment folder", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 18 - testRunner.When("I execute the deployed OpenCover against the x86 target application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); + testRunner.When("I execute the deployed OpenCover against the x86 target application in subfolder " + + "tools", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line 19 - testRunner.And("I execute the deployed OpenCover against the x64 target application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); + testRunner.And("I execute the deployed OpenCover against the x64 target application in subfolder " + + "tools", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 20 testRunner.Then("the coverage results should be the same", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden diff --git a/main/OpenCover.Specs/Steps/PackagingSteps.cs b/main/OpenCover.Specs/Steps/PackagingSteps.cs index 927cd0f1d..e4358ef93 100644 --- a/main/OpenCover.Specs/Steps/PackagingSteps.cs +++ b/main/OpenCover.Specs/Steps/PackagingSteps.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.IO; using System.Linq; @@ -57,7 +57,7 @@ public void GivenIHaveAValidZipPackageInTheOutputFolder() ScenarioContext.Current["targetFolder"] = targetFolder; ScenarioContext.Current["targetOutput"] = targetOutput; } - + [Given(@"I (?:unzip|unpack) that package into a deployment folder")] public void GivenIUnzipThatPackageIntoADeploymentFolder() { @@ -66,7 +66,7 @@ public void GivenIUnzipThatPackageIntoADeploymentFolder() var zip = new ZipFile((string)ScenarioContext.Current["targetZip"]); zip.ExtractAll(folder); } - + [Given(@"I have a valid nugetpackage in the output folder")] public void GivenIHaveAValidNugetpackageInTheOutputFolder() { @@ -84,7 +84,7 @@ public void GivenIHaveAValidNugetpackageInTheOutputFolder() ScenarioContext.Current["targetFolder"] = targetFolder; ScenarioContext.Current["targetOutput"] = targetOutput; } - + [Given(@"I have a valid installer in the output folder")] public void GivenIHaveAValidInstallerInTheOutputFolder() { @@ -102,7 +102,7 @@ public void GivenIHaveAValidInstallerInTheOutputFolder() ScenarioContext.Current["targetFolder"] = targetFolder; ScenarioContext.Current["targetOutput"] = targetOutput; } - + [Given(@"I install that package into a deployment folder")] public void GivenIInstallThatPackageIntoADeploymentFolder() { @@ -119,9 +119,15 @@ public void GivenIInstallThatPackageIntoADeploymentFolder() ScenarioContext.Current["targetFolder"] = Path.Combine(folder, "[ApplicationFolderName]"); } - + [When(@"I execute the deployed OpenCover against the (x\d\d) target application")] public void WhenIExecuteTheDeployedOpenCoverAgainstTheXTargetApplication(string binFolder) + { + this.WhenIExecuteTheDeployedOpenCoverAgainstTheXTargetApplicationInSubfolder(binFolder, string.Empty); + } + + [When(@"I execute the deployed OpenCover against the (x\d\d) target application in subfolder (.*)")] + public void WhenIExecuteTheDeployedOpenCoverAgainstTheXTargetApplicationInSubfolder(string binFolder, string subfolder) { var folder = (string)ScenarioContext.Current["targetFolder"]; var output = (string)ScenarioContext.Current["targetOutput"]; @@ -131,7 +137,7 @@ public void WhenIExecuteTheDeployedOpenCoverAgainstTheXTargetApplication(string if (File.Exists(outputXml)) File.Delete(outputXml); - var openCover = Path.Combine(folder, "OpenCover.Console.exe"); + var openCover = Path.Combine(folder, subfolder, "OpenCover.Console.exe"); var target = Path.Combine(folder, string.Format(@"Samples\{0}\OpenCover.Simple.Target.exe", binFolder)); var startInfo = new ProcessStartInfo(openCover); startInfo.Arguments = string.Format(@"-register:user ""-target:{0}"" ""-output:{1}""", target, outputXml); @@ -140,7 +146,6 @@ public void WhenIExecuteTheDeployedOpenCoverAgainstTheXTargetApplication(string process.WaitForExit(); } - [Then(@"the coverage results should be the same")] public void ThenTheCoverageResultsShouldBeTheSame() { @@ -153,7 +158,7 @@ public void ThenTheCoverageResultsShouldBeTheSame() var outputXml86 = string.Format(@"{0}\{1}_{2}.{3}", Path.GetDirectoryName(output), Path.GetFileNameWithoutExtension(output), "x86", Path.GetExtension(output)); - + var outputXml64 = string.Format(@"{0}\{1}_{2}.{3}", Path.GetDirectoryName(output), Path.GetFileNameWithoutExtension(output), "x86", Path.GetExtension(output)); diff --git a/main/OpenCover.Test/Framework/CommandLineParserTests.cs b/main/OpenCover.Test/Framework/CommandLineParserTests.cs index 2a560a744..73ab1dcfe 100644 --- a/main/OpenCover.Test/Framework/CommandLineParserTests.cs +++ b/main/OpenCover.Test/Framework/CommandLineParserTests.cs @@ -32,6 +32,7 @@ public void ParserHasKnownDefaultArguments() Assert.IsFalse(parser.SkipAutoImplementedProperties); Assert.IsFalse(parser.RegExFilters); Assert.IsFalse(parser.PrintVersion); + Assert.AreEqual(new TimeSpan(0, 0, 30), parser.ServiceStartTimeout); } [Test] @@ -700,5 +701,37 @@ public void NoArguments_ThrowException() Assert.That(thrownException.Message, Contains.Substring("target")); Assert.That(thrownException.Message, Contains.Substring("required")); } + + [TestCase("20m", 20, 0, Description = "Minutes only")] + [TestCase("10s", 0, 10, Description = "Seconds only")] + [TestCase("20m10s", 20, 10, Description = "Minutes and Seconds" )] + [TestCase("150s", 2, 30, Description = "Seconds over a minute")] + public void HandlesServiceStartTimeout(string timeAsString, int expectedMinutes, int expectedSeconds) + { + // arrange + var parser = new CommandLineParser(new[] { "-servicestarttimeout:" + timeAsString, RequiredArgs }); + + // act + parser.ExtractAndValidateArguments(); + + // assert + Assert.That(parser.ServiceStartTimeout, Is.EqualTo(new TimeSpan(0, expectedMinutes, expectedSeconds))); + } + + [TestCase("10")] + [TestCase("NaNs")] + [TestCase("indifferenttext")] + public void InvalidServiceStartTimeoutThrowsException(string invalidTimeout) + { + // arrange + var parser = new CommandLineParser(new[] { "-servicestarttimeout:" + invalidTimeout, RequiredArgs }); + + // act + var thrownException = Assert.Throws(parser.ExtractAndValidateArguments); + + // assert + Assert.That(thrownException.Message, Contains.Substring("servicestarttimeout")); + Assert.That(thrownException.Message, Contains.Substring(invalidTimeout)); + } } } diff --git a/main/OpenCover.Test/OpenCover.Test.csproj b/main/OpenCover.Test/OpenCover.Test.csproj index bbf3d2de8..6abc8db8f 100644 --- a/main/OpenCover.Test/OpenCover.Test.csproj +++ b/main/OpenCover.Test/OpenCover.Test.csproj @@ -80,22 +80,23 @@ False - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.dll + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.dll - - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Mdb.dll - True + + False + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Mdb.dll False - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Pdb.dll + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Pdb.dll - - ..\packages\Mono.Cecil.0.9.6.0\lib\net40\Mono.Cecil.Rocks.dll + + False + ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Rocks.dll - + False - ..\packages\Moq.4.2.1502.0911\lib\net40\Moq.dll + ..\packages\Moq.4.2.1507.0118\lib\net40\Moq.dll False diff --git a/main/OpenCover.Test/packages.config b/main/OpenCover.Test/packages.config index 2aae61d83..b816e9705 100644 --- a/main/OpenCover.Test/packages.config +++ b/main/OpenCover.Test/packages.config @@ -3,8 +3,8 @@ - - + + diff --git a/main/cmdline/report_coverage.cmd b/main/cmdline/report_coverage.cmd index 4a5e5b0b1..c81f1c1fc 100644 --- a/main/cmdline/report_coverage.cmd +++ b/main/cmdline/report_coverage.cmd @@ -1 +1 @@ -..\..\..\main\packages\ReportGenerator.2.1.4.0\ReportGenerator.exe -reports:opencovertests.xml -targetdir:report \ No newline at end of file +..\..\..\main\packages\ReportGenerator.2.1.8.0\ReportGenerator.exe -reports:opencovertests.xml -targetdir:report \ No newline at end of file