diff --git a/build.cake b/build.cake index 77c41a322..fdf8059e9 100644 --- a/build.cake +++ b/build.cake @@ -79,7 +79,7 @@ Task("Test") .IsDependentOn("Compile") .Does(() => { - var projects = GetFiles("./test/DotNetty.Common.Tests/*.csproj") + var projects = GetFiles("./test/**/*.csproj") - GetFiles("./test/**/*.Microbench.csproj") - GetFiles("./test/**/*.Performance.csproj"); @@ -88,7 +88,7 @@ Task("Test") DotNetCoreTest(project.FullPath, new DotNetCoreTestSettings { Configuration = configuration//, - //Verbosity = DotNetCoreVerbosity.Normal + //Verbose = false }); // if (IsRunningOnWindows()) diff --git a/build.ps1 b/build.ps1 index cd535b773..7bc2068b5 100644 --- a/build.ps1 +++ b/build.ps1 @@ -21,19 +21,19 @@ if (Get-Command dotnet -ErrorAction SilentlyContinue) { $FoundDotNetCliVersion = dotnet --version; } -#if($FoundDotNetCliVersion -ne $DotNetVersion) { -# $InstallPath = Join-Path $PSScriptRoot ".dotnet" -# if (!(Test-Path $InstallPath)) { -# mkdir -Force $InstallPath | Out-Null; -# } -# (New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1"); -# & $InstallPath\dotnet-install.ps1 -Channel preview -Version $DotNetVersion -InstallDir $InstallPath; - -# $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -# $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 - -# & dotnet --info -#} +if($FoundDotNetCliVersion -ne $DotNetVersion) { + $InstallPath = Join-Path $PSScriptRoot ".dotnet" + if (!(Test-Path $InstallPath)) { + mkdir -Force $InstallPath | Out-Null; + } + (New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1"); + & $InstallPath\dotnet-install.ps1 -Channel preview -Version $DotNetVersion -InstallDir $InstallPath; + + $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 + + & dotnet --info +} ########################################################################### # INSTALL CAKE diff --git a/test/DotNetty.Common.Tests/Internal/Logging/InternalLoggerFactoryTest.cs b/test/DotNetty.Common.Tests/Internal/Logging/InternalLoggerFactoryTest.cs index f59f22c3c..67234facb 100644 --- a/test/DotNetty.Common.Tests/Internal/Logging/InternalLoggerFactoryTest.cs +++ b/test/DotNetty.Common.Tests/Internal/Logging/InternalLoggerFactoryTest.cs @@ -4,23 +4,15 @@ namespace DotNetty.Common.Tests.Internal.Logging { using System; - using System.Runtime.CompilerServices; using DotNetty.Common.Internal.Logging; using DotNetty.Tests.Common; using Microsoft.Extensions.Logging; using Moq; using Xunit; - using Xunit.Abstractions; [CollectionDefinition(nameof(InternalLoggerFactoryTest), DisableParallelization = true)] public class InternalLoggerFactoryTest { - /*protected readonly ITestOutputHelper Output; - - public InternalLoggerFactoryTest(ITestOutputHelper output) - { - this.Output = output; - }*/ // todo: CodeContracts on CI //[Fact] //public void ShouldNotAllowNullDefaultFactory() @@ -42,7 +34,6 @@ public void ShouldGetInstance() [Fact] public void TestMockReturned() { - //Output.WriteLine("TestMockReturned, Pre:" + RuntimeHelpers.GetHashCode(InternalLoggerFactory.DefaultFactory)); Mock mock; using (SetupMockLogger(out mock)) { @@ -52,28 +43,20 @@ public void TestMockReturned() Assert.True(logger.TraceEnabled); mock.Verify(x => x.IsEnabled(LogLevel.Trace), Times.Once); - //Output.WriteLine("TestMockReturned, Finish:" + RuntimeHelpers.GetHashCode(InternalLoggerFactory.DefaultFactory)); } - //Output.WriteLine("TestMockReturned, Post:" + RuntimeHelpers.GetHashCode(InternalLoggerFactory.DefaultFactory)); - //Assert.True(false, "To See The Log"); } static IDisposable SetupMockLogger(out Mock loggerMock) { ILoggerFactory oldLoggerFactory = InternalLoggerFactory.DefaultFactory; - //Output.WriteLine($"SetupMockLogger,oldLoggerFactory={RuntimeHelpers.GetHashCode(oldLoggerFactory)}"); var loggerFactory = new LoggerFactory(); - //Output.WriteLine($"SetupMockLogger,loggerFactory={RuntimeHelpers.GetHashCode(loggerFactory)}"); var factoryMock = new Mock(MockBehavior.Strict); ILoggerProvider mockFactory = factoryMock.Object; loggerMock = new Mock(MockBehavior.Strict); loggerFactory.AddProvider(mockFactory); factoryMock.Setup(x => x.CreateLogger("mock")).Returns(loggerMock.Object); InternalLoggerFactory.DefaultFactory = loggerFactory; - return new Disposable(() => { - InternalLoggerFactory.DefaultFactory = oldLoggerFactory; - //Output.WriteLine($"SetupMockLogger,Dispose to={RuntimeHelpers.GetHashCode(oldLoggerFactory)}"); - }); + return new Disposable(() => InternalLoggerFactory.DefaultFactory = oldLoggerFactory); } } } \ No newline at end of file diff --git a/test/DotNetty.Common.Tests/Utilities/HashedWheelTimerTest.cs b/test/DotNetty.Common.Tests/Utilities/HashedWheelTimerTest.cs index b8e2a020a..440793dc0 100644 --- a/test/DotNetty.Common.Tests/Utilities/HashedWheelTimerTest.cs +++ b/test/DotNetty.Common.Tests/Utilities/HashedWheelTimerTest.cs @@ -54,7 +54,6 @@ public void TestScheduleTimeoutShouldRunAfterDelay() [Fact] // (timeout = 3000) public void TestStopTimer() { - //Output.WriteLine($"{System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(DotNetty.Common.Internal.Logging.InternalLoggerFactory.DefaultFactory)}"); var latch = new CountdownEvent(3); ITimer timerProcessed = new HashedWheelTimer(); for (int i = 0; i < 3; i++) @@ -78,7 +77,6 @@ public void TestStopTimer() } Thread.Sleep(1000); // sleep for a second Assert.NotEqual(0, timerUnprocessed.StopAsync().Result.Count); // Number of unprocessed timeouts should be greater than 0 - //Assert.True(false, "To See The Log"); } [Fact] // (timeout = 3000)