Skip to content

Commit

Permalink
Mono compatibility verification.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb committed Sep 19, 2016
1 parent d86eb6e commit ee02d4c
Show file tree
Hide file tree
Showing 46 changed files with 288 additions and 133 deletions.
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ src\.nuget\NuGet.exe install FAKE -ConfigFile src\.nuget\Nuget.Config -OutputDir

src\.nuget\NuGet.exe install NUnit.Console -ConfigFile src\.nuget\Nuget.Config -OutputDirectory src\packages\FAKE -ExcludeVersion -Version 3.2.1
src\.nuget\NuGet.exe install xunit.runner.console -ConfigFile src\.nuget\Nuget.Config -OutputDirectory src\packages\FAKE -ExcludeVersion -Version 2.0.0
src\.nuget\NuGet.exe install NBench.Runner -OutputDirectory src\packages -ExcludeVersion -Version 0.3.0
src\.nuget\NuGet.exe install NBench.Runner -OutputDirectory src\packages -ExcludeVersion -Version 0.3.1
src\.nuget\NuGet.exe install Microsoft.SourceBrowser -OutputDirectory src\packages -ExcludeVersion

if not exist src\packages\SourceLink.Fake\tools\SourceLink.fsx (
Expand Down
53 changes: 24 additions & 29 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,6 @@ Target "Build" <| fun _ ->
|> MSBuildRelease "" "Rebuild"
|> ignore

Target "BuildMono" <| fun _ ->

!!"src/Akka.sln"
|> MSBuild "" "Rebuild" [("Configuration","Release Mono")]
|> ignore

//--------------------------------------------------------------------------------
// Build the docs
Target "Docs" <| fun _ ->
Expand Down Expand Up @@ -157,7 +151,7 @@ Target "AzureDocsDeploy" (fun _ ->
pushToAzure docDir azureUrl "stable" azureKey 3
pushToAzure docDir azureUrl release.NugetVersion azureKey 3
if(not canPush) then
printfn "Missing required paraments to push docs to Azure. Run build HelpDocs to find out!"
printfn "Missing required parameters to push docs to Azure. Run build HelpDocs to find out!"

)

Expand Down Expand Up @@ -241,6 +235,19 @@ Target "BuildRelease" DoNothing
// Tests targets
//--------------------------------------------------------------------------------

//--------------------------------------------------------------------------------
// Filter out assemblies which can't run on Linux, Mono, .NET Core, etc...

open Fake.EnvironmentHelper
let filterPlatformSpecificAssemblies (assembly:string) =
match assembly with
| assembly when (assembly.Contains("Sqlite") && isMono) -> false
| assembly when (assembly.Contains(".API") && isMono) -> false
| assembly when (assembly.Contains("Akka.Remote.TestKit.Tests") && isMono) -> false
| assembly when (assembly.Contains("Akka.Persistence.TestKit.Tests") && isMono) -> false
| assembly when (assembly.Contains("Akka.Streams.Tests.TCK") && isMono) -> false
| _ -> true

//--------------------------------------------------------------------------------
// Clean test output

Expand All @@ -251,13 +258,16 @@ Target "CleanTests" <| fun _ ->

open Fake.Testing
Target "RunTests" <| fun _ ->
let xunitTestAssemblies = !! "src/**/bin/Release/*.Tests.dll" --
let xunitTestAssemblies = Seq.filter filterPlatformSpecificAssemblies (!! "src/**/bin/Release/*.Tests.dll" --
// Akka.Streams.Tests is referencing Akka.Streams.TestKit.Tests
"src/**/Akka.Streams.Tests/bin/Release/Akka.Streams.TestKit.Tests.dll" --
// Akka.Streams.Tests.Performance is referencing Akka.Streams.Tests and Akka.Streams.TestKit.Tests
"src/**/Akka.Streams.Tests.Performance/bin/Release/*.Tests.dll"
"src/**/Akka.Streams.Tests.Performance/bin/Release/*.Tests.dll")

let nunitTestAssemblies = Seq.filter filterPlatformSpecificAssemblies (!! "src/**/bin/Release/Akka.Streams.Tests.TCK.dll")

let nunitTestAssemblies = !! "src/**/bin/Release/Akka.Streams.Tests.TCK.dll"
// Debug output
xunitTestAssemblies |> Seq.iter (printfn "Executing: %s")

mkdir testOutput

Expand All @@ -268,35 +278,20 @@ Target "RunTests" <| fun _ ->
let runSingleAssembly assembly =
let assemblyName = Path.GetFileNameWithoutExtension(assembly)
xUnit2
(fun p -> { p with XmlOutputPath = Some (testOutput + @"\" + assemblyName + "_xunit.xml"); HtmlOutputPath = Some (testOutput + @"\" + assemblyName + "_xunit.HTML"); ToolPath = xunitToolPath; TimeOut = System.TimeSpan.FromMinutes 30.0; Parallel = ParallelMode.NoParallelization })
(fun p -> { p with XmlOutputPath = Some (testOutput @@ (assemblyName + "_xunit.xml")); HtmlOutputPath = Some (testOutput @@ (assemblyName + "_xunit.html")); ToolPath = xunitToolPath; TimeOut = System.TimeSpan.FromMinutes 30.0; Parallel = ParallelMode.NoParallelization; NoAppDomain = true; ForceTeamCity = true; })
(Seq.singleton assembly)

xunitTestAssemblies |> Seq.iter (runSingleAssembly)

let runNunitSingleAssembly assembly =
let assemblyName = Path.GetFileNameWithoutExtension(assembly)
NUnit3
(fun p -> { p with ToolPath = nunitToolPath; WorkingDir = testOutput})
(fun p -> { p with ToolPath = nunitToolPath; WorkingDir = testOutput; TeamCity = true;})
(Seq.singleton assembly)

printfn "Using NUnit runner: %s" nunitToolPath
nunitTestAssemblies |> Seq.iter (runNunitSingleAssembly)

Target "RunTestsMono" <| fun _ ->
let xunitTestAssemblies = !! "src/**/bin/Release Mono/*.Tests.dll"

mkdir testOutput

let xunitToolPath = findToolInSubPath "xunit.console.exe" "src/packages/xunit.runner.console*/tools"
printfn "Using XUnit runner: %s" xunitToolPath
let runSingleAssembly assembly =
let assemblyName = Path.GetFileNameWithoutExtension(assembly)
xUnit2
(fun p -> { p with XmlOutputPath = Some (testOutput + @"\" + assemblyName + "_xunit.xml"); HtmlOutputPath = Some (testOutput + @"\" + assemblyName + "_xunit.HTML"); ToolPath = xunitToolPath; TimeOut = System.TimeSpan.FromMinutes 30.0; Parallel = ParallelMode.NoParallelization })
(Seq.singleton assembly)

xunitTestAssemblies |> Seq.iter (runSingleAssembly)


(* Debug helper for troubleshooting an issue we had when we were running multi-node tests multiple times *)
Target "PrintMultiNodeTests" <| fun _ ->
Expand All @@ -309,7 +304,7 @@ Target "PrintMultiNodeTests" <| fun _ ->

Target "MultiNodeTests" <| fun _ ->
mkdir testOutput
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.exe" "bin/core/Akka.MultiNodeTestRunner*"
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.exe" (currentDirectory @@ "bin" @@ "core" @@ "Akka.MultiNodeTestRunner*")
let multiNodeTestAssemblies = !! "src/**/bin/Release/Akka.Remote.Tests.MultiNode.dll" ++
"src/**/bin/Release/Akka.Cluster.Tests.MultiNode.dll" ++
"src/**/bin/Release/Akka.Cluster.Tools.Tests.MultiNode.dll"
Expand Down Expand Up @@ -344,7 +339,7 @@ Target "NBench" <| fun _ ->

mkdir perfOutput
let nbenchTestPath = findToolInSubPath "NBench.Runner.exe" "src/packges/NBench.Runner*"
let nbenchTestAssemblies = !! testSearchPath
let nbenchTestAssemblies = Seq.filter filterPlatformSpecificAssemblies (!! testSearchPath)
printfn "Using NBench.Runner: %s" nbenchTestPath

let runNBench assembly =
Expand Down
7 changes: 3 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ mono $SCRIPT_PATH/src/.nuget/NuGet.exe update -self

mono $SCRIPT_PATH/src/.nuget/NuGet.exe install FAKE -OutputDirectory $SCRIPT_PATH/src/packages -ExcludeVersion -Version 4.16.1

mono $SCRIPT_PATH/src/.nuget/NuGet.exe install xunit.runners -OutputDirectory $SCRIPT_PATH/src/packages/FAKE -ExcludeVersion -Version 2.0.0
mono $SCRIPT_PATH/src/.nuget/NuGet.exe install nunit.runners -OutputDirectory $SCRIPT_PATH/src/packages/FAKE -ExcludeVersion -Version 2.6.4
mono $SCRIPT_PATH/src/.nuget/NuGet.exe install NUnit.Console -OutputDirectory $SCRIPT_PATH/src/packages/FAKE -ExcludeVersion -Version 3.0.0
mono $SCRIPT_PATH/src/.nuget/NuGet.exe install xunit.runner.console -OutputDirectory $SCRIPT_PATH/src/packages/FAKE -ExcludeVersion -Version 2.0.0
mono $SCRIPT_PATH/src/.nuget/NuGet.exe install NUnit.Console -OutputDirectory $SCRIPT_PATH/src/packages/FAKE -ExcludeVersion -Version 3.2.1

mono $SCRIPT_PATH/src/.nuget/NuGet.exe install NBench.Runner -OutputDirectory $SCRIPT_PATH/src/packages -ExcludeVersion -Version 0.3.0
mono $SCRIPT_PATH/src/.nuget/NuGet.exe install NBench.Runner -OutputDirectory $SCRIPT_PATH/src/packages -ExcludeVersion -Version 0.3.1


if ! [ -e $SCRIPT_PATH/src/packages/SourceLink.Fake/tools/SourceLink.fsx ] ; then
Expand Down
4 changes: 2 additions & 2 deletions src/Akka.sln
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.TestKit.Xunit", "contr
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DependencyInjection", "DependencyInjection", "{B1D10183-8FAE-4506-B935-403FCED89BDB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.DI.Core", "contrib\dependencyInjection\Akka.DI.Core\Akka.DI.Core.csproj", "{FDF09D18-B68E-4B95-B1F6-B89D9C6C3AE9}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.DI.Core", "contrib\dependencyinjection\Akka.DI.Core\Akka.DI.Core.csproj", "{FDF09D18-B68E-4B95-B1F6-B89D9C6C3AE9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Persistence", "Persistence", "{264C22A4-CAFC-41F6-B82C-4DDC5C196767}"
EndProject
Expand All @@ -164,7 +164,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TcpEchoService", "TcpEchoSe
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TcpEchoService.Server", "examples\TcpEchoService.Server\TcpEchoService.Server.csproj", "{825196A4-4B08-401F-8994-E2DB7C77A8B7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.DI.TestKit", "contrib\dependencyInjection\Akka.DI.TestKit\Akka.DI.TestKit.csproj", "{D8DB14A5-6147-4512-BF5C-683FDCA6190C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.DI.TestKit", "contrib\dependencyinjection\Akka.DI.TestKit\Akka.DI.TestKit.csproj", "{D8DB14A5-6147-4512-BF5C-683FDCA6190C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestKit", "TestKit", "{46116E52-BF96-4B76-8C81-2104C74487DF}"
EndProject
Expand Down
4 changes: 4 additions & 0 deletions src/core/Akka.API.Tests/CoreAPISpec.ApproveCore.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4929,6 +4929,10 @@ namespace Akka.Util
public override bool IsRight { get; }
public TB Value { get; }
}
public class static RuntimeDetector
{
public static readonly bool IsMono;
}
public class static StandardOutWriter
{
public static void Write(string message, System.Nullable<System.ConsoleColor> foregroundColor = null, System.Nullable<System.ConsoleColor> backgroundColor = null) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,11 @@ namespace Akka.Remote
void Remove(T resource);
void Reset();
}
public class static IpExtensions
{
public static System.Net.IPAddress MapToIPv4(this System.Net.IPAddress ipa) { }
public static System.Net.IPAddress MapToIPv6(this System.Net.IPAddress ipa) { }
}
public class static MessageSerializer
{
public static object Deserialize(Akka.Actor.ActorSystem system, SerializedMessage messageProtocol) { }
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Remote.TestKit/Conductor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Akka.Remote.TestKit
/// The conductor is the one orchestrating the test: it governs the
/// <see cref="Akka.Remote.TestKit.Controller"/>'s ports to which all
/// Players connect, it issues commands to their
/// <see cref="Akka.Remote.TestKit.NetworkFailureInjector"/> and provides support
/// <see cref="FailureInjectorTransportAdapter"/> and provides support
/// for barriers using the <see cref="Akka.Remote.TestKit.BarrierCoordinator"/>.
/// All of this is bundled inside the <see cref="TestConductor"/>
/// </summary>
Expand Down
10 changes: 9 additions & 1 deletion src/core/Akka.Remote.TestKit/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,15 @@ protected override void OnReceive(object message)

protected override void PostStop()
{
RemoteConnection.Shutdown(_connection);
try
{
RemoteConnection.Shutdown(_connection);
RemoteConnection.ReleaseAll().Wait(_settings.ConnectTimeout);
}
catch (Exception ex)
{
_log.Error(ex, "Error while terminating RemoteConnection.");
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/core/Akka.Remote.TestKit/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ public override void ChannelInactive(IChannelHandlerContext context)
Task.Factory.StartNew(() =>
{
RemoteConnection.Shutdown(context.Channel);
RemoteConnection.ReleaseAll(); // yep, let it run asynchronously.
}, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default);
context.FireChannelInactive();
}
Expand Down
5 changes: 3 additions & 2 deletions src/core/Akka.Remote.TestKit/RemoteConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using Akka.Remote.TestKit.Proto;
using Akka.Remote.Transport.Helios;
Expand Down Expand Up @@ -93,7 +94,7 @@ public static Task<IChannel> CreateConnection(Role role, IPEndPoint socketAddres
if (role == Role.Client)
{
var connection = new ClientBootstrap()
.Channel<TcpSocketChannel>()
.ChannelFactory(() => new TcpSocketChannel(socketAddress.AddressFamily))
.Option(ChannelOption.TcpNodelay, true)
.Group(GetClientWorkerPool(poolSize))
.Handler(new ActionChannelInitializer<TcpSocketChannel>(channel =>
Expand All @@ -107,7 +108,7 @@ public static Task<IChannel> CreateConnection(Role role, IPEndPoint socketAddres
{
var connection = new ServerBootstrap()
.Group(GetServerPool(poolSize), GetServerWorkerPool(poolSize))
.Channel<TcpServerSocketChannel>()
.ChannelFactory(() => new TcpServerSocketChannel(socketAddress.AddressFamily))
.ChildOption(ChannelOption.TcpNodelay, true)
.ChildHandler(new ActionChannelInitializer<TcpSocketChannel>(channel =>
{
Expand Down
8 changes: 4 additions & 4 deletions src/core/Akka.Remote.Tests/RemoteConfigSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Akka.Util.Internal;
using Xunit;
using System.Net;
using static Akka.Util.RuntimeDetector;

namespace Akka.Remote.Tests
{
Expand Down Expand Up @@ -70,8 +71,7 @@ public void Remoting_should_contain_correct_configuration_values_in_ReferenceCon
public void Remoting_should_be_able_to_parse_AkkaProtocol_related_config_elements()
{
var settings = new AkkaProtocolSettings(((RemoteActorRefProvider)((ExtendedActorSystem)Sys).Provider).RemoteSettings.Config);

//TODO fill this in when we add secure cookie support

Assert.Equal(typeof(DeadlineFailureDetector), Type.GetType(settings.TransportFailureDetectorImplementationClass));
Assert.Equal(TimeSpan.FromSeconds(4), settings.TransportHeartBeatInterval);
Assert.Equal(TimeSpan.FromSeconds(20), settings.TransportFailureDetectorConfig.GetTimeSpan("acceptable-heartbeat-pause"));
Expand Down Expand Up @@ -103,7 +103,7 @@ public void Remoting_should_contain_correct_heliosTCP_values_in_ReferenceConf()
[Fact]
public void When_remoting_works_in_Mono_ip_enforcement_should_be_defaulted_to_true()
{
HeliosTransportSettings.IsMono = true;
if (!IsMono) return; // skip IF NOT using Mono
var c = ((RemoteActorRefProvider)((ActorSystemImpl)Sys).Provider).RemoteSettings.Config.GetConfig("akka.remote.helios.tcp");
var s = new HeliosTransportSettings(c);

Expand All @@ -113,7 +113,7 @@ public void When_remoting_works_in_Mono_ip_enforcement_should_be_defaulted_to_tr
[Fact]
public void When_remoting_works_not_in_Mono_ip_enforcement_should_be_defaulted_to_false()
{
HeliosTransportSettings.IsMono = false;
if (IsMono) return; // skip IF using Mono
var c = ((RemoteActorRefProvider)((ActorSystemImpl)Sys).Provider).RemoteSettings.Config.GetConfig("akka.remote.helios.tcp");
var s = new HeliosTransportSettings(c);

Expand Down
Loading

0 comments on commit ee02d4c

Please sign in to comment.