diff --git a/.gitignore b/.gitignore index 4fbf33a65..cae796cd6 100644 --- a/.gitignore +++ b/.gitignore @@ -88,4 +88,6 @@ tools/dotnet/* tools/dotnet-dev-win-x64.latest.exe tests/xunit_reports tests/xunit_coreclr_reports +tests/nunit_reports +tests/nunit_coreclr_reports tests/new_test.exe diff --git a/tests/cleanup/cleanup1/cleanup1.cs b/tests/cleanup/cleanup1/cleanup1.cs index 86c2ea985..7bffc224e 100644 --- a/tests/cleanup/cleanup1/cleanup1.cs +++ b/tests/cleanup/cleanup1/cleanup1.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace cleanup1 { public class cleanup1 { - [Fact] + [Test] public void T1() { TrinityServer server = new TrinityServer(); diff --git a/tests/cleanup/cleanup1/cleanup1.csproj b/tests/cleanup/cleanup1/cleanup1.csproj index 0cf971f50..facefefe0 100644 --- a/tests/cleanup/cleanup1/cleanup1.csproj +++ b/tests/cleanup/cleanup1/cleanup1.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/cleanup/cleanup1/cleanup1_coreclr.csproj b/tests/cleanup/cleanup1/cleanup1_coreclr.csproj index 12cce8d44..83666080b 100644 --- a/tests/cleanup/cleanup1/cleanup1_coreclr.csproj +++ b/tests/cleanup/cleanup1/cleanup1_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/cleanup/cleanup1/packages.config b/tests/cleanup/cleanup1/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/cleanup/cleanup1/packages.config +++ b/tests/cleanup/cleanup1/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/cleanup/cleanup2/cleanup2.cs b/tests/cleanup/cleanup2/cleanup2.cs index 13384aaed..782f64fa4 100644 --- a/tests/cleanup/cleanup2/cleanup2.cs +++ b/tests/cleanup/cleanup2/cleanup2.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace cleanup2 { public class cleanup2 { - [Fact] + [Test] public void StartServerTwice() { TrinityServer server = new TrinityServer(); diff --git a/tests/cleanup/cleanup2/cleanup2.csproj b/tests/cleanup/cleanup2/cleanup2.csproj index da0edc37c..51dde5036 100644 --- a/tests/cleanup/cleanup2/cleanup2.csproj +++ b/tests/cleanup/cleanup2/cleanup2.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/cleanup/cleanup2/cleanup2_coreclr.csproj b/tests/cleanup/cleanup2/cleanup2_coreclr.csproj index fee4f91fa..2d47ff96e 100644 --- a/tests/cleanup/cleanup2/cleanup2_coreclr.csproj +++ b/tests/cleanup/cleanup2/cleanup2_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/cleanup/cleanup2/packages.config b/tests/cleanup/cleanup2/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/cleanup/cleanup2/packages.config +++ b/tests/cleanup/cleanup2/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/cleanup/cleanup3/cleanup3.cs b/tests/cleanup/cleanup3/cleanup3.cs index 1b9036450..cab328680 100644 --- a/tests/cleanup/cleanup3/cleanup3.cs +++ b/tests/cleanup/cleanup3/cleanup3.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace cleanup3 { public class cleanup3 { - [Fact] + [Test] public void T1() { Global.LocalStorage.ResetStorage(); diff --git a/tests/cleanup/cleanup3/cleanup3.csproj b/tests/cleanup/cleanup3/cleanup3.csproj index 8b9567c3e..90d86baa2 100644 --- a/tests/cleanup/cleanup3/cleanup3.csproj +++ b/tests/cleanup/cleanup3/cleanup3.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/cleanup/cleanup3/cleanup3_coreclr.csproj b/tests/cleanup/cleanup3/cleanup3_coreclr.csproj index 3b398b529..b8a5955e2 100644 --- a/tests/cleanup/cleanup3/cleanup3_coreclr.csproj +++ b/tests/cleanup/cleanup3/cleanup3_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/cleanup/cleanup3/packages.config b/tests/cleanup/cleanup3/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/cleanup/cleanup3/packages.config +++ b/tests/cleanup/cleanup3/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/cleanup/cleanup4/cleanup4.cs b/tests/cleanup/cleanup4/cleanup4.cs index b9a2f0b07..07b8139d1 100644 --- a/tests/cleanup/cleanup4/cleanup4.cs +++ b/tests/cleanup/cleanup4/cleanup4.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace cleanup4 { public class cleanup4 { - [Fact] + [Test] public void AllocateLocalStorageTwice() { Global.LocalStorage.ResetStorage(); diff --git a/tests/cleanup/cleanup4/cleanup4.csproj b/tests/cleanup/cleanup4/cleanup4.csproj index 6063f53c7..a9b33faf0 100644 --- a/tests/cleanup/cleanup4/cleanup4.csproj +++ b/tests/cleanup/cleanup4/cleanup4.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/cleanup/cleanup4/cleanup4_coreclr.csproj b/tests/cleanup/cleanup4/cleanup4_coreclr.csproj index e5f97d1a9..952c0add1 100644 --- a/tests/cleanup/cleanup4/cleanup4_coreclr.csproj +++ b/tests/cleanup/cleanup4/cleanup4_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/cleanup/cleanup4/packages.config b/tests/cleanup/cleanup4/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/cleanup/cleanup4/packages.config +++ b/tests/cleanup/cleanup4/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/cleanup/cleanup5/cleanup5.cs b/tests/cleanup/cleanup5/cleanup5.cs index b8b1a9742..b1e2867d4 100644 --- a/tests/cleanup/cleanup5/cleanup5.cs +++ b/tests/cleanup/cleanup5/cleanup5.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,10 +12,9 @@ namespace cleanup5 { public class cleanup5 { - [Theory] - [InlineData(10)] - [InlineData(50)] - [InlineData(100)] + [TestCase(10)] + [TestCase(50)] + [TestCase(100)] public void InitUninitStressTest(int count) { for (int i=0; i + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/cleanup/cleanup5/cleanup5_coreclr.csproj b/tests/cleanup/cleanup5/cleanup5_coreclr.csproj index 4a2e94624..51419daaf 100644 --- a/tests/cleanup/cleanup5/cleanup5_coreclr.csproj +++ b/tests/cleanup/cleanup5/cleanup5_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/cleanup/cleanup5/packages.config b/tests/cleanup/cleanup5/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/cleanup/cleanup5/packages.config +++ b/tests/cleanup/cleanup5/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/config/config1/config1.cs b/tests/config/config1/config1.cs index 3f57318a7..ced00d2ff 100644 --- a/tests/config/config1/config1.cs +++ b/tests/config/config1/config1.cs @@ -5,7 +5,7 @@ using System.Threading; using System.Threading.Tasks; using System.IO; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -13,37 +13,37 @@ namespace config1 { public class config1 { - [Fact] + [Test] public void save_config_no_exception() { TrinityConfig.SaveConfig(); } - [Fact] + [Test] public void save_config_no_exception_2() { TrinityConfig.SaveConfig("test2.xml"); } - [Fact] + [Test] public void load_config_no_exception() { TrinityConfig.LoadConfig(); } - [Fact] + [Test] public void load_config_no_exception_2() { TrinityConfig.LoadConfig("test2.xml"); } - [Fact] + [Test] // https://github.com/Microsoft/GraphEngine/issues/22 public void can_set_non_accessible_storage_root() { TrinityConfig.StorageRoot = "Y:"; } - [Fact] + [Test] public void saves_2_0_config_format() { TrinityConfig.SaveConfig("test.xml"); - Assert.True(File.ReadAllText("test.xml").Contains("ConfigVersion=\"2.0\"")); + Assert.That(File.ReadAllText("test.xml").Contains("ConfigVersion=\"2.0\"")); } } } diff --git a/tests/config/config1/config1.csproj b/tests/config/config1/config1.csproj index 6fe029e0d..8beb50d17 100644 --- a/tests/config/config1/config1.csproj +++ b/tests/config/config1/config1.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/config/config1/config1_coreclr.csproj b/tests/config/config1/config1_coreclr.csproj index 9f87e833a..f39090bd9 100644 --- a/tests/config/config1/config1_coreclr.csproj +++ b/tests/config/config1/config1_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/config/config1/packages.config b/tests/config/config1/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/config/config1/packages.config +++ b/tests/config/config1/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/convert_to_nunit.sh b/tests/convert_to_nunit.sh new file mode 100755 index 000000000..7f8926a7b --- /dev/null +++ b/tests/convert_to_nunit.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +find . -name 'packages.config' \ + -not -path './packages.config' \ + -not -path './template/standalone/packages.config' \ + -not -path './minimal/*' \ + -not -path './minimal-tsl/*' \ + | while read line +do + project_dir=$(dirname "$line") + project_name=$(basename "$project_dir") + find "$project_dir" -name "*.cs" -not -path '*AssemblyInfo.cs' -not -path '*/obj/*.cs' | xargs sed -i -f xunit2nunit.sed + sed "s/test_name/$project_name/g" template/standalone/test_name.csproj > "${project_dir}/${project_name}.csproj" + sed "s/test_name/$project_name/g" template/standalone/test_name_coreclr.csproj > "${project_dir}/${project_name}_coreclr.csproj" + cp template/standalone/packages.config "$project_dir/" + echo $project_name +done + diff --git a/tests/icall/icall1/icall1.cs b/tests/icall/icall1/icall1.cs index 99eff22d9..e63d55585 100644 --- a/tests/icall/icall1/icall1.cs +++ b/tests/icall/icall1/icall1.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall1 { public class icall1 { - [Fact] + [Test] public void icall_committedindex() { var val = Global.LocalStorage.CommittedIndexMemory; diff --git a/tests/icall/icall1/icall1.csproj b/tests/icall/icall1/icall1.csproj index 92e4c3cf1..74bd56cd5 100644 --- a/tests/icall/icall1/icall1.csproj +++ b/tests/icall/icall1/icall1.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall1/icall1_coreclr.csproj b/tests/icall/icall1/icall1_coreclr.csproj index 41586353e..74ebdee7b 100644 --- a/tests/icall/icall1/icall1_coreclr.csproj +++ b/tests/icall/icall1/icall1_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall1/packages.config b/tests/icall/icall1/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall1/packages.config +++ b/tests/icall/icall1/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall10/icall10.cs b/tests/icall/icall10/icall10.cs index 0ffaa9c46..8ff8ffbd2 100644 --- a/tests/icall/icall10/icall10.cs +++ b/tests/icall/icall10/icall10.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall10 { public class icall10 { - [Fact] + [Test] public void icall_config_storagecapacity_get() { var val = TrinityConfig.StorageCapacity; diff --git a/tests/icall/icall10/icall10.csproj b/tests/icall/icall10/icall10.csproj index 38685b5ad..77585e805 100644 --- a/tests/icall/icall10/icall10.csproj +++ b/tests/icall/icall10/icall10.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall10/icall10_coreclr.csproj b/tests/icall/icall10/icall10_coreclr.csproj index 4bfe620dd..babec31c0 100644 --- a/tests/icall/icall10/icall10_coreclr.csproj +++ b/tests/icall/icall10/icall10_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall10/packages.config b/tests/icall/icall10/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall10/packages.config +++ b/tests/icall/icall10/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall11/icall11.cs b/tests/icall/icall11/icall11.cs index dee936e87..e6a2e69ae 100644 --- a/tests/icall/icall11/icall11.cs +++ b/tests/icall/icall11/icall11.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall11 { public class icall11 { - [Fact] + [Test] public void icall_config_readonly_get() { var val = TrinityConfig.ReadOnly; diff --git a/tests/icall/icall11/icall11.csproj b/tests/icall/icall11/icall11.csproj index ac93eb262..6917fad4f 100644 --- a/tests/icall/icall11/icall11.csproj +++ b/tests/icall/icall11/icall11.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall11/icall11_coreclr.csproj b/tests/icall/icall11/icall11_coreclr.csproj index a4ee00d07..d253edd4f 100644 --- a/tests/icall/icall11/icall11_coreclr.csproj +++ b/tests/icall/icall11/icall11_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall11/packages.config b/tests/icall/icall11/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall11/packages.config +++ b/tests/icall/icall11/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall12/icall12.cs b/tests/icall/icall12/icall12.cs index 28d798bc7..83bd17604 100644 --- a/tests/icall/icall12/icall12.cs +++ b/tests/icall/icall12/icall12.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall12 { public class icall12 { - [Fact] + [Test] public void icall_config_trunkcount_get() { var val = TrinityConfig.TrunkCount; diff --git a/tests/icall/icall12/icall12.csproj b/tests/icall/icall12/icall12.csproj index 302533df4..94ff9070a 100644 --- a/tests/icall/icall12/icall12.csproj +++ b/tests/icall/icall12/icall12.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall12/icall12_coreclr.csproj b/tests/icall/icall12/icall12_coreclr.csproj index 8c879744e..30fe04a40 100644 --- a/tests/icall/icall12/icall12_coreclr.csproj +++ b/tests/icall/icall12/icall12_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall12/packages.config b/tests/icall/icall12/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall12/packages.config +++ b/tests/icall/icall12/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall2/icall2.cs b/tests/icall/icall2/icall2.cs index 40aae31e5..ef958aa88 100644 --- a/tests/icall/icall2/icall2.cs +++ b/tests/icall/icall2/icall2.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall2 { public class icall2 { - [Fact] + [Test] public void icall_committedtrunk() { var val = Global.LocalStorage.CommittedTrunkMemory; diff --git a/tests/icall/icall2/icall2.csproj b/tests/icall/icall2/icall2.csproj index f2ade24ff..4900c0f6c 100644 --- a/tests/icall/icall2/icall2.csproj +++ b/tests/icall/icall2/icall2.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall2/icall2_coreclr.csproj b/tests/icall/icall2/icall2_coreclr.csproj index 6a921a974..e63af4465 100644 --- a/tests/icall/icall2/icall2_coreclr.csproj +++ b/tests/icall/icall2/icall2_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall2/packages.config b/tests/icall/icall2/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall2/packages.config +++ b/tests/icall/icall2/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall3/icall3.cs b/tests/icall/icall3/icall3.cs index 90be9fcd4..01a80a668 100644 --- a/tests/icall/icall3/icall3.cs +++ b/tests/icall/icall3/icall3.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall3 { public class icall3 { - [Fact] + [Test] public void icall_cellcount() { var val = Global.LocalStorage.CellCount; diff --git a/tests/icall/icall3/icall3.csproj b/tests/icall/icall3/icall3.csproj index fd800380a..d59e7b1db 100644 --- a/tests/icall/icall3/icall3.csproj +++ b/tests/icall/icall3/icall3.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall3/icall3_coreclr.csproj b/tests/icall/icall3/icall3_coreclr.csproj index 57019df87..536d16052 100644 --- a/tests/icall/icall3/icall3_coreclr.csproj +++ b/tests/icall/icall3/icall3_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall3/packages.config b/tests/icall/icall3/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall3/packages.config +++ b/tests/icall/icall3/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall4/icall4.cs b/tests/icall/icall4/icall4.cs index 98a48742b..9028a49ee 100644 --- a/tests/icall/icall4/icall4.cs +++ b/tests/icall/icall4/icall4.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall4 { public class icall4 { - [Fact] + [Test] public void icall_totalcommittedmemory() { var val = Global.LocalStorage.TotalCommittedMemory; diff --git a/tests/icall/icall4/icall4.csproj b/tests/icall/icall4/icall4.csproj index 243e4f680..ecba28ead 100644 --- a/tests/icall/icall4/icall4.csproj +++ b/tests/icall/icall4/icall4.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall4/icall4_coreclr.csproj b/tests/icall/icall4/icall4_coreclr.csproj index a951126fb..02ef919d6 100644 --- a/tests/icall/icall4/icall4_coreclr.csproj +++ b/tests/icall/icall4/icall4_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall4/packages.config b/tests/icall/icall4/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall4/packages.config +++ b/tests/icall/icall4/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall5/icall5.cs b/tests/icall/icall5/icall5.cs index c67d6468c..ea3f626ee 100644 --- a/tests/icall/icall5/icall5.cs +++ b/tests/icall/icall5/icall5.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall5 { public class icall5 { - [Fact] + [Test] public void icall_addcell() { var val = Global.LocalStorage.AddCell(0, new byte[128], 0, 128, 0); diff --git a/tests/icall/icall5/icall5.csproj b/tests/icall/icall5/icall5.csproj index bef7552b5..7c0ba3a29 100644 --- a/tests/icall/icall5/icall5.csproj +++ b/tests/icall/icall5/icall5.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall5/icall5_coreclr.csproj b/tests/icall/icall5/icall5_coreclr.csproj index 0fd79f3d6..13579c8bc 100644 --- a/tests/icall/icall5/icall5_coreclr.csproj +++ b/tests/icall/icall5/icall5_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall5/packages.config b/tests/icall/icall5/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall5/packages.config +++ b/tests/icall/icall5/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall6/icall6.cs b/tests/icall/icall6/icall6.cs index c04f4b179..e7ee3743f 100644 --- a/tests/icall/icall6/icall6.cs +++ b/tests/icall/icall6/icall6.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall6 { public class icall6 { - [Fact] + [Test] public void icall_loadcell() { byte[] content; diff --git a/tests/icall/icall6/icall6.csproj b/tests/icall/icall6/icall6.csproj index f26ba65cc..a481249c7 100644 --- a/tests/icall/icall6/icall6.csproj +++ b/tests/icall/icall6/icall6.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall6/icall6_coreclr.csproj b/tests/icall/icall6/icall6_coreclr.csproj index 2459bcd8e..91274a8dd 100644 --- a/tests/icall/icall6/icall6_coreclr.csproj +++ b/tests/icall/icall6/icall6_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall6/packages.config b/tests/icall/icall6/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall6/packages.config +++ b/tests/icall/icall6/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall7/icall7.cs b/tests/icall/icall7/icall7.cs index 7e8bbd867..bbd990df0 100644 --- a/tests/icall/icall7/icall7.cs +++ b/tests/icall/icall7/icall7.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall7 { public class icall7 { - [Fact] + [Test] public void icall_instantiate_local_storage() { var storage = Global.LocalStorage; diff --git a/tests/icall/icall7/icall7.csproj b/tests/icall/icall7/icall7.csproj index d0f27eff5..399da148c 100644 --- a/tests/icall/icall7/icall7.csproj +++ b/tests/icall/icall7/icall7.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall7/icall7_coreclr.csproj b/tests/icall/icall7/icall7_coreclr.csproj index 4a79c0be0..50c9e6ff0 100644 --- a/tests/icall/icall7/icall7_coreclr.csproj +++ b/tests/icall/icall7/icall7_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall7/packages.config b/tests/icall/icall7/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall7/packages.config +++ b/tests/icall/icall7/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall8/icall8.cs b/tests/icall/icall8/icall8.cs index 8dfdebaa0..b4b19b603 100644 --- a/tests/icall/icall8/icall8.cs +++ b/tests/icall/icall8/icall8.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall8 { public class icall8 { - [Fact] + [Test] public void icall_config_storageroot_get() { var val = TrinityConfig.StorageRoot; diff --git a/tests/icall/icall8/icall8.csproj b/tests/icall/icall8/icall8.csproj index 144ca9759..f67b4691d 100644 --- a/tests/icall/icall8/icall8.csproj +++ b/tests/icall/icall8/icall8.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall8/icall8_coreclr.csproj b/tests/icall/icall8/icall8_coreclr.csproj index 252697365..b13ef3f11 100644 --- a/tests/icall/icall8/icall8_coreclr.csproj +++ b/tests/icall/icall8/icall8_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall8/packages.config b/tests/icall/icall8/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall8/packages.config +++ b/tests/icall/icall8/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/icall/icall9/icall9.cs b/tests/icall/icall9/icall9.cs index 2316ea34f..1f1bab110 100644 --- a/tests/icall/icall9/icall9.cs +++ b/tests/icall/icall9/icall9.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace icall9 { public class icall9 { - [Fact] + [Test] public void icall_config_storageroot_set() { TrinityConfig.StorageRoot = "."; diff --git a/tests/icall/icall9/icall9.csproj b/tests/icall/icall9/icall9.csproj index 21a32b4a8..aa2723ca4 100644 --- a/tests/icall/icall9/icall9.csproj +++ b/tests/icall/icall9/icall9.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/icall/icall9/icall9_coreclr.csproj b/tests/icall/icall9/icall9_coreclr.csproj index 81a58128a..828cd4582 100644 --- a/tests/icall/icall9/icall9_coreclr.csproj +++ b/tests/icall/icall9/icall9_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/icall/icall9/packages.config b/tests/icall/icall9/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/icall/icall9/packages.config +++ b/tests/icall/icall9/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/misc/misc1/misc1.cs b/tests/misc/misc1/misc1.cs index c20fb8a35..d5dddbeed 100644 --- a/tests/misc/misc1/misc1.cs +++ b/tests/misc/misc1/misc1.cs @@ -5,7 +5,7 @@ using System.Threading; using System.Threading.Tasks; using System.IO; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -13,11 +13,11 @@ namespace misc1 { public class misc1 { - [Fact] + [Test] public void global_myassemblypath_is_functional() { var path = Global.MyAssemblyPath; - Assert.True(Directory.GetFileSystemEntries(path).Any(_ => _.Contains("misc1"))); + Assert.That(Directory.GetFileSystemEntries(path).Any(_ => _.Contains("misc1"))); } } } diff --git a/tests/misc/misc1/misc1.csproj b/tests/misc/misc1/misc1.csproj index fc204dd12..14fbda70f 100644 --- a/tests/misc/misc1/misc1.csproj +++ b/tests/misc/misc1/misc1.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/misc/misc1/misc1_coreclr.csproj b/tests/misc/misc1/misc1_coreclr.csproj index 2777e1c35..5c2808594 100644 --- a/tests/misc/misc1/misc1_coreclr.csproj +++ b/tests/misc/misc1/misc1_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/misc/misc1/packages.config b/tests/misc/misc1/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/misc/misc1/packages.config +++ b/tests/misc/misc1/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/nunit_tools/nunit_meta_runner/CommandLineOptions.cs b/tests/nunit_tools/nunit_meta_runner/CommandLineOptions.cs new file mode 100755 index 000000000..84c8dcb2c --- /dev/null +++ b/tests/nunit_tools/nunit_meta_runner/CommandLineOptions.cs @@ -0,0 +1,39 @@ +using CommandLine; +using CommandLine.Text; + +namespace NUnitMetaRunner +{ + class CommandLineOptions + { + [Option('r', "runner", Required = true, + HelpText = "The path to the runner for the test assembly.")] + public string RunnerPath { get; set; } + + [Option('t', "timeout", Required = false, DefaultValue = -1, + HelpText = "Set timeout for each test case in milliseconds.")] + public int Timeout { get; set; } + + [Option('d', "resultDirectory", Required = true, + HelpText = "Set the directory to put the results.")] + public string ResultDirPath { get; set; } + + [Option('a', "assembly", Required = true, + HelpText = "The path to the test assembly.")] + public string AssemblyPath { get; set; } + + [Option('o', "options", Required = false, DefaultValue = "", + HelpText = "The command line arguments to be passed to the runner.")] + public string RunnerOptions { get; set; } + + [Option('s', "seed", Required = false, + HelpText = "The random seed to use for the tests.")] + public int? RandomSeed { get; set; } + + [HelpOption] + public string GetUsage() + { + return HelpText.AutoBuild(this, + (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current)); + } + } +} diff --git a/tests/nunit_tools/nunit_meta_runner/NuGet.config b/tests/nunit_tools/nunit_meta_runner/NuGet.config new file mode 100644 index 000000000..7be9c71ec --- /dev/null +++ b/tests/nunit_tools/nunit_meta_runner/NuGet.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/nunit_tools/nunit_meta_runner/Program.cs b/tests/nunit_tools/nunit_meta_runner/Program.cs new file mode 100755 index 000000000..96efb6336 --- /dev/null +++ b/tests/nunit_tools/nunit_meta_runner/Program.cs @@ -0,0 +1,186 @@ +using System; +using System.IO; +using System.Linq; +using System.Text; +using System.Reflection; +using System.Runtime.Loader; +using System.Collections.Generic; +using System.Diagnostics; +using System.Reflection.Metadata; +using System.Xml; +using System.Xml.Linq; +using CommandLine; +using CommandLine.Text; +using NUnitLite; +using NUnit.Framework.Api; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +using NUnitLiteNetCoreTest.ResultAggregator; + +// preloading dependencies +using Trinity; +using NUnit.Framework; + +namespace NUnitMetaRunner +{ + class Program + { + public static int Main(string[] args) + { + var options = new CommandLineOptions(); + if (!CommandLine.Parser.Default.ParseArguments(args, options)) + { + return 1; + } + + var runnerPath = Path.GetFullPath(options.RunnerPath); + var resultDirRoot = Path.GetFullPath(options.ResultDirPath); + var assemblyPath = Path.GetFullPath(options.AssemblyPath); + var runnerOptions = options.RunnerOptions; + var timeout = options.Timeout; + var randomSeed = options.RandomSeed ?? new Random().Next(); + + // NOTE(leasunhy): this may fail silently if some of the dependencies are not preloaded! + // In that case, no tests can be discovered in `assembly`. + var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath); + + var rootTestSuite = GetITest(assembly, runnerOptions); + var allTests = GetDecendentTests(rootTestSuite).ToList(); + + Console.WriteLine("Discovered tests:"); + foreach (var test in allTests) + { + Console.WriteLine(test.FullName); + } + + var resultDirPath = Path.Combine(resultDirRoot, rootTestSuite.Name); + if (!Directory.Exists(resultDirPath)) + Directory.CreateDirectory(resultDirPath); + + for (int i = 0; i < allTests.Count; ++i) + { + var test = allTests[i]; + var testName = test.FullName; + var testResultPath = Path.Combine(resultDirPath, $"{i}.xml"); + try + { + var startTime = DateTime.UtcNow; + var process = CreateProcessForTest(runnerPath, assemblyPath, testResultPath, + randomSeed, runnerOptions, testName); + bool timedOut = false; + if (!process.WaitForExit(timeout < 0 ? Int32.MaxValue : timeout)) + { + Console.WriteLine($"Test {testName} has timed out."); + process.Kill(); + process.WaitForExit(); + timedOut = true; + } + var endTime = DateTime.UtcNow; + + Console.WriteLine(process.StandardOutput.ReadToEnd()); + + if (process.ExitCode != 0) + { + using (var stream = new FileStream(testResultPath, FileMode.Create)) + using (var writer = new StreamWriter(stream)) + { + var result = CreateFailedResultForTestCase(test, startTime, endTime, + message: timedOut ? $"Test exceeded Timeout value of {timeout}ms" : null); + var xmlDoc = ConstructXmlDocumentForAbnormalExit(test, result); + writer.WriteLine(xmlDoc); + } + } + } + catch (Exception e) + { + Console.Error.WriteLine(e.Message); + } + } + + var xmlDocs = Directory.EnumerateFiles(resultDirPath) + .Where(f => Path.GetExtension(f) == ".xml") + .Select(XDocument.Load) + .ToList(); + if (xmlDocs.Count != allTests.Count) + { + Console.Error.WriteLine($"Warning: {allTests.Count} tests should be run in {rootTestSuite.Name}, " + + $"but only {xmlDocs.Count} result files are found."); + } + + var aggregated = ResultAggregator.Aggregate(xmlDocs); + var resultFile = Path.Combine(resultDirRoot, rootTestSuite.Name + ".xml"); + using (var output = new StreamWriter(new FileStream(resultFile, FileMode.Create))) + { + aggregated.Save(output); + } + return 0; + } + + private static Process CreateProcessForTest(string runnerPath, string assemblyPath, string testResultPath, + int randomSeed, string runnerOptions, string testName) + { + var commandLineOptions = new List(); + commandLineOptions.Add($"\"{runnerPath}\""); + commandLineOptions.Add($"\"{assemblyPath}\""); + commandLineOptions.Add(runnerOptions); + commandLineOptions.Add($"--test={testName}"); + commandLineOptions.Add($"--result=\"{testResultPath}\""); + commandLineOptions.Add($"--seed=\"{randomSeed}\""); + + var startInfo = new ProcessStartInfo(); + startInfo.FileName = "dotnet"; + startInfo.Arguments = string.Join(" ", commandLineOptions); + startInfo.UseShellExecute = false; + startInfo.RedirectStandardOutput = true; + + return Process.Start(startInfo); + } + + private static ITest GetITest(Assembly assembly, string commandLineOptions) + { + // we should control what `options` holds + var options = new NUnitLiteOptions(commandLineOptions.Split(' ')); + var builder = new DefaultTestAssemblyBuilder(); + var runSettings = TextRunner.MakeRunSettings(options); + return builder.Build(assembly, runSettings); + } + + private static IEnumerable GetDecendentTests(ITest root) + { + if (root.IsSuite) + return root.Tests.SelectMany(GetDecendentTests); + return new []{root}; + } + + private static string ConstructXmlDocumentForAbnormalExit(ITest test, TestCaseResult caseResult) + { + TestResult currentResult = caseResult; + ITest currentTest = test; + while (currentTest.Parent != null) + { + var suiteResult = new TestSuiteResult((TestSuite)currentTest.Parent); + suiteResult.AddResult(currentResult); + currentResult = suiteResult; + currentTest = currentTest.Parent; + } + var node = currentResult.ToXml(true); + var res = @" + +" + node.OuterXml + @""; + return res; + } + + private static TestCaseResult CreateFailedResultForTestCase(ITest test, DateTime startTime, + DateTime endTime, string message = null) + { + var caseResult = new TestCaseResult((TestMethod)test); + var result = new ResultState(TestStatus.Failed, FailureSite.Test); + caseResult.SetResult(result, message); + caseResult.StartTime = startTime; + caseResult.EndTime = endTime; + caseResult.Duration = endTime.Subtract(startTime).TotalSeconds; + return caseResult; + } + } +} diff --git a/tests/nunit_tools/nunit_meta_runner/ResultAggregator/NodeInfos.cs b/tests/nunit_tools/nunit_meta_runner/ResultAggregator/NodeInfos.cs new file mode 100755 index 000000000..b61c4cd02 --- /dev/null +++ b/tests/nunit_tools/nunit_meta_runner/ResultAggregator/NodeInfos.cs @@ -0,0 +1,105 @@ +using System; +using System.Xml.Linq; + +namespace NUnitLiteNetCoreTest.ResultAggregator +{ + internal interface INodeInfo + { + DateTime StartTime { get; } + DateTime EndTime { get; } + double Duration { get; } + int WarningCount { get; } + int AssertCount { get; } + int TotalTestCount { get; } + int PassedTestCount { get; } + int InconclusiveTestCount { get; } + int FailedTestCount { get; } + int SkippedTestCount { get; } + } + + internal class TestCaseInfo : INodeInfo + { + public DateTime StartTime { get; } + public DateTime EndTime { get; } + public double Duration { get; } + public int WarningCount { get; } + public int AssertCount { get; } + public int TotalTestCount { get; } + + public int PassedTestCount { get; } = 0; + public int InconclusiveTestCount { get; } = 0; + public int FailedTestCount { get; } = 0; + public int SkippedTestCount { get; } = 0; + + public TestCaseInfo(XElement element) + { + StartTime = DateTime.Parse(element.Attribute("start-time").Value); + EndTime = DateTime.Parse(element.Attribute("end-time").Value); + Duration = double.Parse(element.Attribute("duration").Value); + //WarningCount = int.Parse(element.Attribute("warnings").Value); + // TODO: how are warnings related to test-case? + WarningCount = 0; + AssertCount = int.Parse(element.Attribute("asserts").Value); + TotalTestCount = 1; + + var result = element.Attribute("result").Value; + switch (result) + { + case "Passed": + PassedTestCount = 1; + break; + case "Inconclusive": + InconclusiveTestCount = 1; + break; + case "Failed": + FailedTestCount = 1; + break; + case "Skipped": + SkippedTestCount = 1; + break; + default: + throw new NotSupportedException($"result = {result}"); + } + } + } + + internal class TestSuiteInfo : INodeInfo + { + public DateTime StartTime { get; } + public DateTime EndTime { get; } + public double Duration { get; } + public int WarningCount { get; } + public int AssertCount { get; } + public int TotalTestCount { get; } + public int PassedTestCount { get; } + public int InconclusiveTestCount { get; } + public int FailedTestCount { get; } + public int SkippedTestCount { get; } + + public TestSuiteInfo(XElement element) + { + StartTime = DateTime.Parse(element.Attribute("start-time").Value); + EndTime = DateTime.Parse(element.Attribute("end-time").Value); + Duration = double.Parse(element.Attribute("duration").Value); + WarningCount = int.Parse(element.Attribute("warnings").Value); + AssertCount = int.Parse(element.Attribute("asserts").Value); + TotalTestCount = int.Parse(element.Attribute("total").Value); + PassedTestCount = int.Parse(element.Attribute("total").Value); + InconclusiveTestCount = int.Parse(element.Attribute("inconclusive").Value); + FailedTestCount = int.Parse(element.Attribute("failed").Value); + SkippedTestCount = int.Parse(element.Attribute("skipped").Value); + } + } + + internal class NodeInfoFactory + { + public static INodeInfo GetInfoFor(XElement element) + { + if (element.Name.LocalName == "test-case") + return new TestCaseInfo(element); + if (element.Name.LocalName == "test-suite") + return new TestSuiteInfo(element); + throw new NotSupportedException($"Can't get info for an element of unknown type: {element.Name.LocalName}"); + } + } +} diff --git a/tests/nunit_tools/nunit_meta_runner/ResultAggregator/ResultAggregator.cs b/tests/nunit_tools/nunit_meta_runner/ResultAggregator/ResultAggregator.cs new file mode 100755 index 000000000..2127a07f3 --- /dev/null +++ b/tests/nunit_tools/nunit_meta_runner/ResultAggregator/ResultAggregator.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml.Linq; + +namespace NUnitLiteNetCoreTest.ResultAggregator +{ + public static class ResultAggregator + { + public static XDocument Aggregate(IEnumerable resDocs) + { + if (resDocs == null) throw new ArgumentNullException(nameof(resDocs)); + var documentList = resDocs.ToList(); + if (!documentList.Any()) throw new ArgumentException("Argument is empty", nameof(resDocs)); + + var pivot = new XDocument(documentList.First()); + var suites = documentList.SelectMany(a => a.Elements("test-run")) + .GroupBy(e => e.Attribute("fullname").Value) + .Select(g => AggregateElements(g, "TestRun")) + .ToList(); + pivot.Elements("test-run").Remove(); + foreach (var e in suites) + pivot.Add(e); + return pivot; + } + + class NodeType + { + public string TypeName { get; set; } + public string[] ChildNodeTypes { get; set; } + public bool HasChildTestCases { get; set; } + public Action Hook { get; set; } = null; + } + + private static readonly Dictionary NodeTypes = new[] { + new NodeType { TypeName = "TestRun", HasChildTestCases = false, ChildNodeTypes = new [] { "Assembly" }, + Hook = e => e.Elements("filter").Elements().Remove()}, + new NodeType { TypeName = "Assembly", HasChildTestCases = false, ChildNodeTypes = new [] { "TestSuite" }}, + new NodeType { TypeName = "TestSuite", HasChildTestCases = false, ChildNodeTypes = new [] { "TestFixture" }}, + new NodeType { TypeName = "TestFixture", HasChildTestCases = true, ChildNodeTypes = new [] { "ParameterizedMethod", "Theory" }}, + new NodeType { TypeName = "ParameterizedMethod", HasChildTestCases = true, ChildNodeTypes = new string[] {}}, + new NodeType { TypeName = "Theory", HasChildTestCases = true, ChildNodeTypes = new string[] {}}, + }.ToDictionary(nt => nt.TypeName); + + private static XElement AggregateElements(IEnumerable elements, string elementType) + { + var elementList = elements.ToList(); + var pivot = new XElement(elementList.First()); + Debug.Assert(elementList.All(a => a.Name == pivot.Name)); + + var nodeType = NodeTypes[elementType]; + + if (nodeType.ChildNodeTypes.Length > 0) + { + var newChildSuites = nodeType.ChildNodeTypes + .SelectMany(tn => GetChildSuites(tn, elementList)) + .ToList(); + pivot.Elements("test-suite").Remove(); + foreach (var suite in newChildSuites) + pivot.Add(suite); + } + + if (nodeType.HasChildTestCases) + { + var testcases = elementList.SelectMany(f => f.Elements("test-case")).ToList(); + pivot.Elements("test-case").Remove(); + foreach (var e in testcases) + pivot.Add(e); + } + + AggregateAttributes(pivot); + nodeType.Hook?.Invoke(pivot); + return pivot; + } + + private static void AggregateAttributes(XElement parent) + { + var children = parent.Elements("test-suite").Concat(parent.Elements("test-case")); + var infos = children.Select(NodeInfoFactory.GetInfoFor).ToList(); + int total, failed, passed, skipped; + parent.SetAttributeValue("total", total = infos.Sum(i => i.TotalTestCount)); + parent.SetAttributeValue("passed", passed = infos.Sum(i => i.PassedTestCount)); + parent.SetAttributeValue("warnings", infos.Sum(i => i.WarningCount)); + parent.SetAttributeValue("inconclusive", infos.Sum(i => i.InconclusiveTestCount)); + parent.SetAttributeValue("skipped", skipped = infos.Sum(i => i.SkippedTestCount)); + parent.SetAttributeValue("failed", failed = infos.Sum(i => i.FailedTestCount)); + parent.SetAttributeValue("asserts", infos.Sum(i => i.AssertCount)); + parent.SetAttributeValue("duration", infos.Sum(i => i.Duration)); + parent.SetAttributeValue("start-time", infos.Min(i => i.StartTime).ToString("u")); + parent.SetAttributeValue("end-time", infos.Max(i => i.EndTime).ToString("u")); + + // TODO(leasunhy): aggregate - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/storage/storage1/storage1_coreclr.csproj b/tests/storage/storage1/storage1_coreclr.csproj index e4a1c0ff3..a7e5c6164 100644 --- a/tests/storage/storage1/storage1_coreclr.csproj +++ b/tests/storage/storage1/storage1_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/storage/storage2/packages.config b/tests/storage/storage2/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/storage/storage2/packages.config +++ b/tests/storage/storage2/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/storage/storage2/storage2.cs b/tests/storage/storage2/storage2.cs index e98f656d3..8d1abd197 100644 --- a/tests/storage/storage2/storage2.cs +++ b/tests/storage/storage2/storage2.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -13,12 +13,11 @@ namespace storage2 { public class storage2 { - [Theory] - [InlineData(10, 314, 333, 7)] - [InlineData(100, 2, 65, 34)] - [InlineData(1000, 8124, 16, 1)] - [InlineData(10000, 999, 0, 233)] - [InlineData(100000, 1, 1560, 12)] + [TestCase(10, 314, 333, 7)] + [TestCase(100, 2, 65, 34)] + [TestCase(1000, 8124, 16, 1)] + [TestCase(10000, 999, 0, 233)] + [TestCase(100000, 1, 1560, 12)] public void T1(int cellCount, int s1, int s2, byte v) { byte[] buff = new byte[s1]; @@ -33,9 +32,9 @@ public void T1(int cellCount, int s1, int s2, byte v) byte[] out_buf = null; Global.LocalStorage.LoadCell(i, out out_buf); Assert.NotNull(out_buf); - Assert.Equal(s1, out_buf.Length); + Assert.AreEqual(s1, out_buf.Length); foreach(var b in out_buf) - Assert.Equal(v, b); + Assert.AreEqual(v, b); } Random rand = new Random(); @@ -53,10 +52,10 @@ public void T1(int cellCount, int s1, int s2, byte v) byte[] out_buf = null; Global.LocalStorage.LoadCell(i, out out_buf); Assert.NotNull(out_buf); - Assert.InRange(out_buf.Length, Math.Min(1, s2), Math.Max(1, s2)); + Assert.That(out_buf.Length, Is.InRange(Math.Min(1, s2), Math.Max(1, s2))); for(int j=0;j + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/storage/storage2/storage2_coreclr.csproj b/tests/storage/storage2/storage2_coreclr.csproj index 055fb50c3..16cc5dbf2 100644 --- a/tests/storage/storage2/storage2_coreclr.csproj +++ b/tests/storage/storage2/storage2_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/storage/storage3/packages.config b/tests/storage/storage3/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/storage/storage3/packages.config +++ b/tests/storage/storage3/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/storage/storage3/storage3.cs b/tests/storage/storage3/storage3.cs index 759728780..aabfaeb7b 100644 --- a/tests/storage/storage3/storage3.cs +++ b/tests/storage/storage3/storage3.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace storage3 { public class storage3 { - [Fact] + [Test] public void T1() { for (int i = 0; i < 256; i++) @@ -24,7 +24,7 @@ public void T1() Global.LocalStorage.RemoveCell(i); } - Assert.Equal(0, (int)Global.LocalStorage.CellCount); + Assert.AreEqual(0, (int)Global.LocalStorage.CellCount); } } } diff --git a/tests/storage/storage3/storage3.csproj b/tests/storage/storage3/storage3.csproj index 3a97763ce..0b6971383 100644 --- a/tests/storage/storage3/storage3.csproj +++ b/tests/storage/storage3/storage3.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/storage/storage3/storage3_coreclr.csproj b/tests/storage/storage3/storage3_coreclr.csproj index 12e0e4d48..9345fb065 100644 --- a/tests/storage/storage3/storage3_coreclr.csproj +++ b/tests/storage/storage3/storage3_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/storage/storage4/packages.config b/tests/storage/storage4/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/storage/storage4/packages.config +++ b/tests/storage/storage4/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/storage/storage4/storage4.cs b/tests/storage/storage4/storage4.cs index 39342d2c6..9ec46700d 100644 --- a/tests/storage/storage4/storage4.cs +++ b/tests/storage/storage4/storage4.cs @@ -8,7 +8,7 @@ using System.Runtime.ExceptionServices; using Trinity; using System.Globalization; -using Xunit; +using NUnit.Framework; using Trinity.Storage; namespace storage4 @@ -603,32 +603,31 @@ public WorkerProfile(int workerId, long op_per_iteration, int iterationCount, Li public class storage4 { - [Theory] - [InlineData(32771, true, 128, 1<<16, false, 20000, 20000, 2 << 20, false)] - [InlineData(25168, false, 511, 2<<16, false, 30000, 200, 1 << 20, false)] - [InlineData(496827356, true, 315, 1<<15, false, 20, 200000, 1 << 20, false)] - [InlineData(9486, false, 7, 3<<16, false, 50000, 1000, 1 << 20, false)] - [InlineData(67691, true, 916, 1<<13, false, 1000, 50000, 1 << 20, false)] - [InlineData(459, false, 617, 1<<20, false, 10000, 5000, 1 << 20, false)] - - [InlineData(32771, true, 128, 1<<16, true, 20000, 20000, 2 << 20, false)] - [InlineData(25168, false, 511, 2<<16, true, 30000, 200, 2 << 20, false)] - [InlineData(496827356, true, 315, 1<<15, true, 20, 2000000, 2 << 20, false)] - [InlineData(9486, false, 7, 3<<16, true, 50000, 10000, 2 << 20, false)] - [InlineData(67691, true, 916, 1<<13, true, 10000, 50000, 2 << 20, false)] - [InlineData(459, false, 617, 1<<20, true, 10000, 100000, 2 << 20, false)] - - [InlineData(32771, true, 128, 1<<16, false, 20000, 20000, 1 << 13, true)] - [InlineData(25168, false, 511, 2<<16, false, 30000, 200, 1 << 12, true)] - [InlineData(496827356, true, 315, 1<<15, false, 20, 2000000, 1 << 12, true)] - [InlineData(9486, false, 7, 1<<16, false, 50000, 10000, 1 << 12, true)] - [InlineData(67691, true, 916, 1<<13, false, 10000, 50000, 1 << 13, true)] - [InlineData(459, false, 617, 1<<20, false, 10000, 100000, 1 << 13, true)] + [TestCase(32771, true, 128, 1<<16, false, 20000, 20000, 2 << 20, false)] + [TestCase(25168, false, 511, 2<<16, false, 30000, 200, 1 << 20, false)] + [TestCase(496827356, true, 315, 1<<15, false, 20, 200000, 1 << 20, false)] + [TestCase(9486, false, 7, 3<<16, false, 50000, 1000, 1 << 20, false)] + [TestCase(67691, true, 916, 1<<13, false, 1000, 50000, 1 << 20, false)] + [TestCase(459, false, 617, 1<<20, false, 10000, 5000, 1 << 20, false)] + + [TestCase(32771, true, 128, 1<<16, true, 20000, 20000, 2 << 20, false)] + [TestCase(25168, false, 511, 2<<16, true, 30000, 200, 2 << 20, false)] + [TestCase(496827356, true, 315, 1<<15, true, 20, 2000000, 2 << 20, false)] + [TestCase(9486, false, 7, 3<<16, true, 50000, 10000, 2 << 20, false)] + [TestCase(67691, true, 916, 1<<13, true, 10000, 50000, 2 << 20, false)] + [TestCase(459, false, 617, 1<<20, true, 10000, 100000, 2 << 20, false)] + + [TestCase(32771, true, 128, 1<<16, false, 20000, 20000, 1 << 13, true)] + [TestCase(25168, false, 511, 2<<16, false, 30000, 200, 1 << 12, true)] + [TestCase(496827356, true, 315, 1<<15, false, 20, 2000000, 1 << 12, true)] + [TestCase(9486, false, 7, 1<<16, false, 50000, 10000, 1 << 12, true)] + [TestCase(67691, true, 916, 1<<13, false, 10000, 50000, 1 << 13, true)] + [TestCase(459, false, 617, 1<<20, false, 10000, 100000, 1 << 13, true)] public void TestCMemTrunk(int random_seed, bool thread_cell_range_overlap, int cell_size, int max_lo_size, bool pause_defrag, int iter_cnt, long ops_cnt, int max_cell_count, bool single_trunk) { Global.LocalStorage.ResetStorage(); Test t = new Test(random_seed, thread_cell_range_overlap, cell_size, max_lo_size, pause_defrag, iter_cnt, ops_cnt, max_cell_count, single_trunk); - Assert.True(t.Run()); + Assert.That(t.Run()); } } } diff --git a/tests/storage/storage4/storage4.csproj b/tests/storage/storage4/storage4.csproj index 0c36a166c..07be93cbe 100644 --- a/tests/storage/storage4/storage4.csproj +++ b/tests/storage/storage4/storage4.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/storage/storage4/storage4_coreclr.csproj b/tests/storage/storage4/storage4_coreclr.csproj index e71cf2d4a..a380e55cb 100644 --- a/tests/storage/storage4/storage4_coreclr.csproj +++ b/tests/storage/storage4/storage4_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/storage/storage5/packages.config b/tests/storage/storage5/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/storage/storage5/packages.config +++ b/tests/storage/storage5/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/storage/storage5/storage5.cs b/tests/storage/storage5/storage5.cs index 39db5736f..ff72f9ed6 100644 --- a/tests/storage/storage5/storage5.cs +++ b/tests/storage/storage5/storage5.cs @@ -5,7 +5,7 @@ using System.Threading; using System.Threading.Tasks; using System.Diagnostics; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -13,10 +13,9 @@ namespace storage5 { public class storage5 { - [Theory] - [InlineData(100, 314, 7)] - [InlineData(1000, 6736, 65)] - [InlineData(100000, 23, 255)] + [TestCase(100, 314, 7)] + [TestCase(1000, 6736, 65)] + [TestCase(100000, 23, 255)] public unsafe void T1(int cellCount, int cellSize, byte content) { Global.LocalStorage.ResetStorage(); @@ -41,14 +40,14 @@ public unsafe void T1(int cellCount, int cellSize, byte content) Console.WriteLine("Save cells done (after warm-up), took {0}", sw.ElapsedMilliseconds); byte[] cell; - Assert.Equal(TrinityErrorCode.E_SUCCESS, Global.LocalStorage.LoadCell(cellCount - 1, out cell)); + Assert.AreEqual(TrinityErrorCode.E_SUCCESS, Global.LocalStorage.LoadCell(cellCount - 1, out cell)); Console.WriteLine("cell size: {0}\n", cell.Length); - Assert.Equal(cellSize, cell.Length); + Assert.AreEqual(cellSize, cell.Length); for (int i = 0; i < cellSize; i++) { - Assert.Equal(content, cell[i]); + Assert.AreEqual(content, cell[i]); } sw.Restart(); @@ -64,7 +63,7 @@ public unsafe void T1(int cellCount, int cellSize, byte content) } sw.Stop(); Console.WriteLine("Iteration (cold): {0} \t {1}", garbage, sw.ElapsedMilliseconds); - Assert.Equal(garbage_expected, garbage); + Assert.AreEqual(garbage_expected, garbage); sw.Restart(); id = 0; @@ -78,14 +77,14 @@ public unsafe void T1(int cellCount, int cellSize, byte content) } sw.Stop(); Console.WriteLine("Iteration (warm): {0} \t {1}", garbage, sw.ElapsedMilliseconds); - Assert.Equal(garbage_expected, garbage); + Assert.AreEqual(garbage_expected, garbage); var cells = from c in Global.LocalStorage where c.CellId < cellCount / 2 select c; foreach (var c in cells) { - Assert.True(c.CellId < cellCount / 2); + Assert.That(c.CellId < cellCount / 2); } long __count = 0; @@ -103,8 +102,8 @@ public unsafe void T1(int cellCount, int cellSize, byte content) ++id; } } - Assert.Equal(garbage_expected, garbage); - Assert.Equal((ulong)__count, (ulong)Global.LocalStorage.CellCount); + Assert.AreEqual(garbage_expected, garbage); + Assert.AreEqual((ulong)__count, (ulong)Global.LocalStorage.CellCount); } } } diff --git a/tests/storage/storage5/storage5.csproj b/tests/storage/storage5/storage5.csproj index d4aedf747..9af09e874 100644 --- a/tests/storage/storage5/storage5.csproj +++ b/tests/storage/storage5/storage5.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/storage/storage5/storage5_coreclr.csproj b/tests/storage/storage5/storage5_coreclr.csproj index 304e4c927..920b67554 100644 --- a/tests/storage/storage5/storage5_coreclr.csproj +++ b/tests/storage/storage5/storage5_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/storage/storage6/packages.config b/tests/storage/storage6/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/storage/storage6/packages.config +++ b/tests/storage/storage6/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/storage/storage6/storage6.cs b/tests/storage/storage6/storage6.cs index 54abab480..d040118f6 100644 --- a/tests/storage/storage6/storage6.cs +++ b/tests/storage/storage6/storage6.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -13,11 +13,10 @@ namespace storage6 { public class storage6 { - [Theory] - [InlineData(1<<10, 8<<20, 4)] - [InlineData(1<<20, 8<<10, 4)] - [InlineData(1<<11, 8<<16, 24)] - [InlineData(1<<21, 8<<8, 24)] + [TestCase(1<<10, 8<<20, 4)] + [TestCase(1<<20, 8<<10, 4)] + [TestCase(1<<11, 8<<16, 24)] + [TestCase(1<<21, 8<<8, 24)] public void T1(int cellSize, int count, int tCount) { byte[] content = new byte[cellSize]; @@ -33,7 +32,7 @@ public void T1(int cellSize, int count, int tCount) for (int i = 0; i < count / tCount; ++i) { long id = (long)i + (pid * count / tCount); - Assert.Equal(TrinityErrorCode.E_SUCCESS, Global.LocalStorage.SaveCell(id, content)); + Assert.AreEqual(TrinityErrorCode.E_SUCCESS, Global.LocalStorage.SaveCell(id, content)); } }); @@ -48,7 +47,7 @@ public void T1(int cellSize, int count, int tCount) for (int i = count / tCount - 1; i >= 0; --i) { long id = (long)i + (pid * count / tCount); - Assert.Equal(TrinityErrorCode.E_SUCCESS, Global.LocalStorage.SaveCell(id, content)); + Assert.AreEqual(TrinityErrorCode.E_SUCCESS, Global.LocalStorage.SaveCell(id, content)); } }); diff --git a/tests/storage/storage6/storage6.csproj b/tests/storage/storage6/storage6.csproj index d2219bf86..8487b3f47 100644 --- a/tests/storage/storage6/storage6.csproj +++ b/tests/storage/storage6/storage6.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/storage/storage6/storage6_coreclr.csproj b/tests/storage/storage6/storage6_coreclr.csproj index 685b560f7..6174dfe0f 100644 --- a/tests/storage/storage6/storage6_coreclr.csproj +++ b/tests/storage/storage6/storage6_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/storage/storage7/packages.config b/tests/storage/storage7/packages.config index dc8fb90cb..fb72b47d3 100644 --- a/tests/storage/storage7/packages.config +++ b/tests/storage/storage7/packages.config @@ -1,11 +1,6 @@ - + - - - - - - - \ No newline at end of file + + diff --git a/tests/storage/storage7/storage7.cs b/tests/storage/storage7/storage7.cs index f809b518e..7a891e088 100644 --- a/tests/storage/storage7/storage7.cs +++ b/tests/storage/storage7/storage7.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,9 +12,8 @@ namespace storage7 { public class storage7 { - [Theory] - [InlineData(1027, 1<<20)] - [InlineData(2049, 1575984)] + [TestCase(1027, 1<<20)] + [TestCase(2049, 1575984)] public unsafe void T1(int buff_len, int count) { Global.LocalStorage.ResetStorage(); @@ -45,21 +44,21 @@ public unsafe void T1(int buff_len, int count) var after = Global.LocalStorage.CellCount; - Assert.Equal(before, after); + Assert.AreEqual(before, after); Console.WriteLine("Begin testing ..."); for (int i = 0; i < count; ++i) { - Assert.Equal(TrinityErrorCode.E_SUCCESS, Global.LocalStorage.LoadCell(i, out buf)); + Assert.AreEqual(TrinityErrorCode.E_SUCCESS, Global.LocalStorage.LoadCell(i, out buf)); fixed (byte* b = buf) { long* p = (long*)b; - Assert.Equal(buff_len, buf.Length); + Assert.AreEqual(buff_len, buf.Length); for (int j = 0; j < buf.Length / sizeof(long); ++j) { - Assert.Equal(p[j], (long)(i + j)); + Assert.AreEqual(p[j], (long)(i + j)); } } } diff --git a/tests/storage/storage7/storage7.csproj b/tests/storage/storage7/storage7.csproj index b9f41f5d8..f82b2323c 100644 --- a/tests/storage/storage7/storage7.csproj +++ b/tests/storage/storage7/storage7.csproj @@ -1,4 +1,4 @@ - + @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/storage/storage7/storage7_coreclr.csproj b/tests/storage/storage7/storage7_coreclr.csproj index 5cf7da632..3b0e6f027 100644 --- a/tests/storage/storage7/storage7_coreclr.csproj +++ b/tests/storage/storage7/storage7_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/template/standalone/packages.config b/tests/template/standalone/packages.config index a86c34cbf..fb72b47d3 100644 --- a/tests/template/standalone/packages.config +++ b/tests/template/standalone/packages.config @@ -2,10 +2,5 @@ - - - - - - - \ No newline at end of file + + diff --git a/tests/template/standalone/test_name.cs b/tests/template/standalone/test_name.cs index fa2fd765c..173f7963e 100644 --- a/tests/template/standalone/test_name.cs +++ b/tests/template/standalone/test_name.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Xunit; +using NUnit.Framework; using Trinity; using Trinity.Storage; @@ -12,7 +12,7 @@ namespace test_name { public class test_name { - [Fact] + [Test] public void T1() { } diff --git a/tests/template/standalone/test_name.csproj b/tests/template/standalone/test_name.csproj index 1057c15a8..4271e4f94 100644 --- a/tests/template/standalone/test_name.csproj +++ b/tests/template/standalone/test_name.csproj @@ -48,21 +48,8 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll diff --git a/tests/template/standalone/test_name_coreclr.csproj b/tests/template/standalone/test_name_coreclr.csproj index 5a7228005..7b3d5c86c 100644 --- a/tests/template/standalone/test_name_coreclr.csproj +++ b/tests/template/standalone/test_name_coreclr.csproj @@ -8,8 +8,7 @@ - - + diff --git a/tests/test.csproj b/tests/test.csproj index 4b6a280dc..492bdc10b 100644 --- a/tests/test.csproj +++ b/tests/test.csproj @@ -16,7 +16,7 @@ bin\Release\$(ProjectName).dll bin\Release\$(ProjectName).exe--> $(MSBuildProjectDirectory)\packages\NuGet.CommandLine.3.5.0\tools\NuGet - $(MSBuildProjectDirectory)\packages\xunit.runner.console.2.2.0\tools\xunit.console + $(MSBuildProjectDirectory)\packages\NUnit.ConsoleRunner.3.6.1\tools\nunit3-console @@ -34,10 +34,10 @@ ContinueOnError="false" Condition="Exists('$([System.IO.Path]::GetDirectoryName(%(Exe.Identity)))\bin\Release\$([System.IO.Path]::GetFileNameWithoutExtension(%(Exe.Identity))).exe')"/> - + - - + + diff --git a/tests/test_coreclr.csproj b/tests/test_coreclr.csproj index 82dfaf286..b1c99a4aa 100644 --- a/tests/test_coreclr.csproj +++ b/tests/test_coreclr.csproj @@ -8,12 +8,19 @@ + + $(MSBuildProjectDirectory)/nunit_tools/bin/nunit_meta_runner.dll + $(MSBuildProjectDirectory)/nunit_tools/bin/nunitlite-runner.dll + $(MSBuildProjectDirectory)/nunit_coreclr_reports + + + + ContinueOnError="false" /> + + + - + + - - + + - - - - + diff --git a/tests/tests.nunit b/tests/tests.nunit new file mode 100644 index 000000000..77bc9c555 --- /dev/null +++ b/tests/tests.nunit @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tests/tsl/tsl1/packages.config b/tests/tsl/tsl1/packages.config index a86c34cbf..fb72b47d3 100644 --- a/tests/tsl/tsl1/packages.config +++ b/tests/tsl/tsl1/packages.config @@ -2,10 +2,5 @@ - - - - - - - \ No newline at end of file + + diff --git a/tests/tsl/tsl1/test.cs b/tests/tsl/tsl1/tsl1.cs similarity index 54% rename from tests/tsl/tsl1/test.cs rename to tests/tsl/tsl1/tsl1.cs index 4c0e19f07..d0aa82cb2 100644 --- a/tests/tsl/tsl1/test.cs +++ b/tests/tsl/tsl1/tsl1.cs @@ -5,63 +5,59 @@ using System.Threading.Tasks; using Trinity; using Trinity.Storage; -using Xunit; +using NUnit.Framework; namespace tsl1 { public class simple_tsl_tests { - [Fact] + [Test] public void T1() { MyCell cell = new MyCell(); Assert.NotNull(cell); } - [Theory] - [InlineData(1)] - [InlineData(2)] - [InlineData(3)] + [TestCase(1)] + [TestCase(2)] + [TestCase(3)] public void T2(int i) { MyCell cell = new MyCell(i); - Assert.Equal(i, cell.A); + Assert.AreEqual(i, cell.A); } - [Theory] - [InlineData(1)] - [InlineData(2)] - [InlineData(3)] + [TestCase(1)] + [TestCase(2)] + [TestCase(3)] public void T3(long cell_id) { MyCell cell = new MyCell(cell_id); - Assert.Equal(cell_id, cell.CellID); + Assert.AreEqual(cell_id, cell.CellID); } - [Theory] - [InlineData(1, 2)] - [InlineData(2, 3)] - [InlineData(3, 4)] - [InlineData(1, 5)] - [InlineData(3, 2)] - [InlineData(6, 1)] + [TestCase(1, 2)] + [TestCase(2, 3)] + [TestCase(3, 4)] + [TestCase(1, 5)] + [TestCase(3, 2)] + [TestCase(6, 1)] public void T4(long cell_id, int x) { MyCell cell = new MyCell(cell_id, x); Global.LocalStorage.SaveMyCell(cell); var load_cell = Global.LocalStorage.LoadMyCell(cell_id); - Assert.Equal(cell_id, load_cell.CellID); - Assert.Equal(x, load_cell.A); + Assert.AreEqual(cell_id, load_cell.CellID); + Assert.AreEqual(x, load_cell.A); } - [Theory] - [InlineData(1, 2)] - [InlineData(2, 3)] - [InlineData(3, 4)] - [InlineData(1, 5)] - [InlineData(3, 2)] - [InlineData(6, 1)] + [TestCase(1, 2)] + [TestCase(2, 3)] + [TestCase(3, 4)] + [TestCase(1, 5)] + [TestCase(3, 2)] + [TestCase(6, 1)] public void T5(long cell_id, int x) { MyCell cell = new MyCell(cell_id, x); @@ -69,18 +65,17 @@ public void T5(long cell_id, int x) using (var accessor = Global.LocalStorage.UseMyCell(cell_id)) { - Assert.Equal(cell_id, accessor.CellID); - Assert.Equal(x, accessor.A); + Assert.AreEqual(cell_id, accessor.CellID); + Assert.AreEqual(x, accessor.A); } } - [Theory] - [InlineData(1, 2)] - [InlineData(2, 3)] - [InlineData(3, 4)] - [InlineData(1, 5)] - [InlineData(3, 2)] - [InlineData(6, 1)] + [TestCase(1, 2)] + [TestCase(2, 3)] + [TestCase(3, 4)] + [TestCase(1, 5)] + [TestCase(3, 2)] + [TestCase(6, 1)] public void T6(long cell_id, int x) { Global.LocalStorage.RemoveCell(cell_id); @@ -91,18 +86,17 @@ public void T6(long cell_id, int x) using (var accessor = Global.LocalStorage.UseMyCell(cell_id, Trinity.TSL.Lib.CellAccessOptions.CreateNewOnCellNotFound)) { - Assert.Equal(cell_id, accessor.CellID); - Assert.Equal(x, accessor.A); + Assert.AreEqual(cell_id, accessor.CellID); + Assert.AreEqual(x, accessor.A); } } - [Theory] - [InlineData(1, 2)] - [InlineData(2, 3)] - [InlineData(3, 4)] - [InlineData(1, 5)] - [InlineData(3, 2)] - [InlineData(6, 1)] + [TestCase(1, 2)] + [TestCase(2, 3)] + [TestCase(3, 4)] + [TestCase(1, 5)] + [TestCase(3, 2)] + [TestCase(6, 1)] public void T7(long cell_id, int x) { Global.LocalStorage.RemoveCell(cell_id); @@ -111,13 +105,12 @@ public void T7(long cell_id, int x) Global.LocalStorage.UseMyCell(cell_id, Trinity.TSL.Lib.CellAccessOptions.ThrowExceptionOnCellNotFound)); } - [Theory] - [InlineData(1, 2)] - [InlineData(2, 3)] - [InlineData(3, 4)] - [InlineData(1, 5)] - [InlineData(3, 2)] - [InlineData(6, 1)] + [TestCase(1, 2)] + [TestCase(2, 3)] + [TestCase(3, 4)] + [TestCase(1, 5)] + [TestCase(3, 2)] + [TestCase(6, 1)] public void T8(long cell_id, int x) { var cell = Global.LocalStorage.NewGenericCell("MyCell"); @@ -125,21 +118,20 @@ public void T8(long cell_id, int x) cell.SetField("A", x); Global.LocalStorage.SaveGenericCell(cell); - Assert.Equal(x, Global.LocalStorage.LoadMyCell(cell_id).A); + Assert.AreEqual(x, Global.LocalStorage.LoadMyCell(cell_id).A); } - [Theory] - [InlineData(1, 2)] - [InlineData(2, 3)] - [InlineData(3, 4)] - [InlineData(1, 5)] - [InlineData(3, 2)] - [InlineData(6, 1)] + [TestCase(1, 2)] + [TestCase(2, 3)] + [TestCase(3, 4)] + [TestCase(1, 5)] + [TestCase(3, 2)] + [TestCase(6, 1)] public void T9(long cell_id, int x) { Global.LocalStorage.SaveMyCell(cell_id, x); - Assert.Equal(x, Global.LocalStorage.LoadGenericCell(cell_id).GetField("A")); + Assert.AreEqual(x, Global.LocalStorage.LoadGenericCell(cell_id).GetField("A")); } } } diff --git a/tests/tsl/tsl1/tsl1.csproj b/tests/tsl/tsl1/tsl1.csproj index cc428c4b1..44c06c6b3 100644 --- a/tests/tsl/tsl1/tsl1.csproj +++ b/tests/tsl/tsl1/tsl1.csproj @@ -7,10 +7,9 @@ AnyCPU {0AE97FA8-E63E-48EA-8336-529FE0A9DBC0} Library - Properties tsl1 tsl1 - v4.5.2 + v4.6.1 512 @@ -49,30 +48,16 @@ ..\..\packages\GraphEngine.Core.1.0.8850\lib\Trinity.Core.dll True - - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - True - - - ..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - True - - - ..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - True + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll - - + - + diff --git a/tests/tsl/tsl1/test.tsl b/tests/tsl/tsl1/tsl1.tsl similarity index 100% rename from tests/tsl/tsl1/test.tsl rename to tests/tsl/tsl1/tsl1.tsl diff --git a/tests/tsl/tsl1/tsl1_coreclr.csproj b/tests/tsl/tsl1/tsl1_coreclr.csproj index 91163fa6f..7e909d5af 100644 --- a/tests/tsl/tsl1/tsl1_coreclr.csproj +++ b/tests/tsl/tsl1/tsl1_coreclr.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.0 @@ -8,9 +8,8 @@ - - - + + diff --git a/tests/xunit2nunit.sed b/tests/xunit2nunit.sed new file mode 100644 index 000000000..86710e9ae --- /dev/null +++ b/tests/xunit2nunit.sed @@ -0,0 +1,6 @@ +s@InlineData@TestCase@g +s@Fact@Test@g +s@using Xunit@using NUnit.Framework@g +s@Assert\.Equal@Assert.AreEqual@g +s@Assert\.True@Assert.That@g +/\[Theory\]/d