From 189cbdadf85c8f146cc8ead1629fcd34b23c4330 Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Tue, 26 May 2020 23:49:02 -0700 Subject: [PATCH 01/10] test new code coverage --- build/Codecoverage.proj | 4 ++-- build/Dependencies.props | 1 + test/Directory.Build.props | 3 ++- .../UnitTests.cs | 1 + .../TestPredictors.cs | 1 + .../RemoteExecutor.cs | 2 +- .../RemoteExecutorConsoleApp.cs | 4 +++- test/coverlet.runsettings | 18 ++++++++++++++++++ test/run-tests.proj | 2 +- 9 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 test/coverlet.runsettings diff --git a/build/Codecoverage.proj b/build/Codecoverage.proj index faa9b15c53..81ea96b06e 100644 --- a/build/Codecoverage.proj +++ b/build/Codecoverage.proj @@ -16,8 +16,8 @@ <_ReportGeneratorPath>$(PkgReportGenerator)\tools\net47\ReportGenerator.exe - - + + <_CodecovArgs Include="-f;$(BaseOutputPath)$(PlatformConfig)\coverage\Cobertura.xml" /> diff --git a/build/Dependencies.props b/build/Dependencies.props index 9024a0d840..9deedb96a9 100644 --- a/build/Dependencies.props +++ b/build/Dependencies.props @@ -44,6 +44,7 @@ 1.0.0-beta-62824-02 1.9.0 2.7.0 + 1.2.1 4.3.6 1.0.0-beta.19225.5 diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 68034bc2eb..3a08a785c8 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -27,7 +27,7 @@ - + @@ -35,6 +35,7 @@ + diff --git a/test/Microsoft.ML.CpuMath.UnitTests/UnitTests.cs b/test/Microsoft.ML.CpuMath.UnitTests/UnitTests.cs index 2b6045cdc8..949145dfcb 100644 --- a/test/Microsoft.ML.CpuMath.UnitTests/UnitTests.cs +++ b/test/Microsoft.ML.CpuMath.UnitTests/UnitTests.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using Microsoft.ML.Internal.CpuMath; using Microsoft.ML.TestFramework; diff --git a/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs b/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs index 4a70ce63d7..396ca3e120 100644 --- a/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs +++ b/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs @@ -25,6 +25,7 @@ namespace Microsoft.ML.RunTests using TestLearners = TestLearnersBase; using Microsoft.ML.TestFrameworkCommon; using Microsoft.ML.TestFrameworkCommon.Attributes; + using System.Diagnostics; /// /// Tests using maml commands (IDV) functionality. diff --git a/test/Microsoft.ML.TestFramework/RemoteExecutor.cs b/test/Microsoft.ML.TestFramework/RemoteExecutor.cs index 39775b4be1..c23a307c72 100644 --- a/test/Microsoft.ML.TestFramework/RemoteExecutor.cs +++ b/test/Microsoft.ML.TestFramework/RemoteExecutor.cs @@ -26,7 +26,7 @@ public static class RemoteExecutor public static readonly string HostRunner = Path.GetFullPath(@"RemoteExecutorConsoleApp.exe"); private static readonly string _extraParameter = ""; #else - public static readonly string HostRunner = Process.GetCurrentProcess().MainModule.FileName; + public static readonly string HostRunner = "dotnet.exe"; private static readonly string _extraParameter = TestConsoleApp; #endif /// A timeout (milliseconds) after which a wait on a remote operation should be considered a failure. diff --git a/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs b/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs index 13adabd9f6..da3dbb39fe 100644 --- a/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs +++ b/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs @@ -17,6 +17,8 @@ class Program { static int Main(string[] args) { + //Debugger.Launch(); + if (args.Length < 4) { Console.Error.WriteLine("Usage: {0} assemblyName typeName methodName exceptionFile [additionalArgs]", typeof(Program).GetTypeInfo().Assembly.GetName().Name); @@ -110,7 +112,7 @@ static int Main(string[] args) catch (PlatformNotSupportedException) { } - + return exitCode; } diff --git a/test/coverlet.runsettings b/test/coverlet.runsettings new file mode 100644 index 0000000000..75f5f83f1f --- /dev/null +++ b/test/coverlet.runsettings @@ -0,0 +1,18 @@ + + + + + + + opencover + [*]Microsoft.ML.*Contracts*,[*]Microsoft.ML.Internal.Utilities*,[*]Microsoft.ML.Data.VBuffer* + [Microsoft.ML.*]* + Obsolete,ExcludeFromCodeCoverage + $(RepoRoot)src\Microsoft.ML.OnnxConverter\OnnxMl.cs,$(RepoRoot)src\Microsoft.ML.TensorFlow\TensorFlow\Buffer.cs,$(RepoRoot)src\Microsoft.ML.TensorFlow\TensorFlow\Tensor.cs,$(RepoRoot)src\Microsoft.ML.TensorFlow\TensorFlow\Tensorflow.cs + true + true + + + + + \ No newline at end of file diff --git a/test/run-tests.proj b/test/run-tests.proj index ee827ef41c..5da2929f7a 100644 --- a/test/run-tests.proj +++ b/test/run-tests.proj @@ -10,7 +10,7 @@ + Properties="VSTestNoBuild=true;VSTestBlame=true;VSTestCollect=XPlat Code Coverage;VSTestSetting=$(MSBuildThisFileDirectory)\coverlet.runsettings" /> From a6fb2bcd82485bf4cd004b74f865aad0ef49e745 Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Wed, 27 May 2020 10:08:28 -0700 Subject: [PATCH 02/10] change coverage path --- build/Codecoverage.proj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Codecoverage.proj b/build/Codecoverage.proj index 81ea96b06e..b38de95b17 100644 --- a/build/Codecoverage.proj +++ b/build/Codecoverage.proj @@ -16,8 +16,8 @@ <_ReportGeneratorPath>$(PkgReportGenerator)\tools\net47\ReportGenerator.exe - - + + <_CodecovArgs Include="-f;$(BaseOutputPath)$(PlatformConfig)\coverage\Cobertura.xml" /> From c66440ccc188d0933a42cf64edda40e2f5102f67 Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Wed, 27 May 2020 15:25:03 -0700 Subject: [PATCH 03/10] fix failure --- test/Directory.Build.props | 3 ++- test/Microsoft.ML.CpuMath.UnitTests/UnitTests.cs | 1 - test/Microsoft.ML.Predictor.Tests/TestPredictors.cs | 1 - test/Microsoft.ML.TestFramework/RemoteExecutor.cs | 2 +- test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs | 3 --- 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 3a08a785c8..a8d99633c4 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -27,7 +27,8 @@ - + + diff --git a/test/Microsoft.ML.CpuMath.UnitTests/UnitTests.cs b/test/Microsoft.ML.CpuMath.UnitTests/UnitTests.cs index 949145dfcb..2b6045cdc8 100644 --- a/test/Microsoft.ML.CpuMath.UnitTests/UnitTests.cs +++ b/test/Microsoft.ML.CpuMath.UnitTests/UnitTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; using Microsoft.ML.Internal.CpuMath; using Microsoft.ML.TestFramework; diff --git a/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs b/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs index 396ca3e120..4a70ce63d7 100644 --- a/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs +++ b/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs @@ -25,7 +25,6 @@ namespace Microsoft.ML.RunTests using TestLearners = TestLearnersBase; using Microsoft.ML.TestFrameworkCommon; using Microsoft.ML.TestFrameworkCommon.Attributes; - using System.Diagnostics; /// /// Tests using maml commands (IDV) functionality. diff --git a/test/Microsoft.ML.TestFramework/RemoteExecutor.cs b/test/Microsoft.ML.TestFramework/RemoteExecutor.cs index c23a307c72..7ac44c13f1 100644 --- a/test/Microsoft.ML.TestFramework/RemoteExecutor.cs +++ b/test/Microsoft.ML.TestFramework/RemoteExecutor.cs @@ -26,7 +26,7 @@ public static class RemoteExecutor public static readonly string HostRunner = Path.GetFullPath(@"RemoteExecutorConsoleApp.exe"); private static readonly string _extraParameter = ""; #else - public static readonly string HostRunner = "dotnet.exe"; + public static readonly string HostRunner = "dotnet"; private static readonly string _extraParameter = TestConsoleApp; #endif /// A timeout (milliseconds) after which a wait on a remote operation should be considered a failure. diff --git a/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs b/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs index da3dbb39fe..99ead67bb6 100644 --- a/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs +++ b/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs @@ -17,8 +17,6 @@ class Program { static int Main(string[] args) { - //Debugger.Launch(); - if (args.Length < 4) { Console.Error.WriteLine("Usage: {0} assemblyName typeName methodName exceptionFile [additionalArgs]", typeof(Program).GetTypeInfo().Assembly.GetName().Name); @@ -112,7 +110,6 @@ static int Main(string[] args) catch (PlatformNotSupportedException) { } - return exitCode; } From 3aa52de69e13af86e030018093aadb6067e95aec Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Wed, 27 May 2020 16:59:12 -0700 Subject: [PATCH 04/10] try test code coverage --- build/Dependencies.props | 1 - test/Directory.Build.props | 23 ++--------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/build/Dependencies.props b/build/Dependencies.props index 9deedb96a9..903b984a40 100644 --- a/build/Dependencies.props +++ b/build/Dependencies.props @@ -43,7 +43,6 @@ 1.0.0-beta-62824-02 1.9.0 - 2.7.0 1.2.1 4.3.6 1.0.0-beta.19225.5 diff --git a/test/Directory.Build.props b/test/Directory.Build.props index a8d99633c4..792fbb4406 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -27,15 +27,14 @@ - - + + - @@ -56,22 +55,4 @@ - - - true - - true - true - true - opencover - $(BaseOutputPath)$(PlatformConfig)\coverage\$(MSBuildProjectName).coverage - [Microsoft.ML.*]* - - [*]Microsoft.ML.*Contracts*,[*]Microsoft.ML.Internal.Utilities*,[*]Microsoft.ML.Data.VBuffer* - Obsolete,ExcludeFromCodeCoverage - $(RepoRoot)src\Microsoft.ML.OnnxConverter\OnnxMl.cs,$(RepoRoot)src\Microsoft.ML.TensorFlow\TensorFlow\Buffer.cs,$(RepoRoot)src\Microsoft.ML.TensorFlow\TensorFlow\Tensor.cs,$(RepoRoot)src\Microsoft.ML.TensorFlow\TensorFlow\Tensorflow.cs - - From 4136e385a7ad868e7beefe7e27675fac4dfa4d97 Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Thu, 28 May 2020 00:24:17 -0700 Subject: [PATCH 05/10] fix build --- build.proj | 13 +++++++++++++ test/Directory.Build.props | 1 - test/Microsoft.ML.TestFramework/RemoteExecutor.cs | 2 +- test/Microsoft.ML.Tests/OnnxConversionTest.cs | 3 +++ .../RemoteExecutorConsoleApp.cs | 1 + test/run-tests.proj | 7 ++++++- 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/build.proj b/build.proj index f7f3624679..1d95743b60 100644 --- a/build.proj +++ b/build.proj @@ -38,6 +38,7 @@ $(TraversalBuildDependsOn); DownloadExternalTestFiles; DownloadTensorflowMetaFiles; + DeleteTestHost; @@ -116,6 +117,18 @@ + + + + + + + + + + + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 792fbb4406..14a05ed538 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -28,7 +28,6 @@ - diff --git a/test/Microsoft.ML.TestFramework/RemoteExecutor.cs b/test/Microsoft.ML.TestFramework/RemoteExecutor.cs index 7ac44c13f1..39775b4be1 100644 --- a/test/Microsoft.ML.TestFramework/RemoteExecutor.cs +++ b/test/Microsoft.ML.TestFramework/RemoteExecutor.cs @@ -26,7 +26,7 @@ public static class RemoteExecutor public static readonly string HostRunner = Path.GetFullPath(@"RemoteExecutorConsoleApp.exe"); private static readonly string _extraParameter = ""; #else - public static readonly string HostRunner = "dotnet"; + public static readonly string HostRunner = Process.GetCurrentProcess().MainModule.FileName; private static readonly string _extraParameter = TestConsoleApp; #endif /// A timeout (milliseconds) after which a wait on a remote operation should be considered a failure. diff --git a/test/Microsoft.ML.Tests/OnnxConversionTest.cs b/test/Microsoft.ML.Tests/OnnxConversionTest.cs index b20b385ddf..68013677d9 100644 --- a/test/Microsoft.ML.Tests/OnnxConversionTest.cs +++ b/test/Microsoft.ML.Tests/OnnxConversionTest.cs @@ -1181,6 +1181,9 @@ public void OneHotHashEncodingOnnxConversionTest() var onnxModelPath = GetOutputPath(onnxFileName); SaveOnnxModel(onnxModel, onnxModelPath, null); + //Free up memory for x86 test + GC.Collect(); + if (IsOnnxRuntimeSupported()) { // Evaluate the saved ONNX model using the data used to train the ML.NET pipeline. diff --git a/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs b/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs index 99ead67bb6..559b84b044 100644 --- a/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs +++ b/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs @@ -110,6 +110,7 @@ static int Main(string[] args) catch (PlatformNotSupportedException) { } + return exitCode; } diff --git a/test/run-tests.proj b/test/run-tests.proj index 5da2929f7a..235f1402f2 100644 --- a/test/run-tests.proj +++ b/test/run-tests.proj @@ -8,9 +8,14 @@ - + From a55a2e0f7368fb1d7781cfb33afddc239afd3a64 Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Thu, 28 May 2020 16:27:31 -0700 Subject: [PATCH 06/10] try new file filters --- build/Codecoverage.proj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Codecoverage.proj b/build/Codecoverage.proj index b38de95b17..a77d8218e2 100644 --- a/build/Codecoverage.proj +++ b/build/Codecoverage.proj @@ -16,8 +16,8 @@ <_ReportGeneratorPath>$(PkgReportGenerator)\tools\net47\ReportGenerator.exe - - + + <_CodecovArgs Include="-f;$(BaseOutputPath)$(PlatformConfig)\coverage\Cobertura.xml" /> From d7e608f20f85be97abb18f3f4433310685652dbb Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Thu, 28 May 2020 18:48:27 -0700 Subject: [PATCH 07/10] fix coverage report path --- build/Codecoverage.proj | 2 +- test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs | 2 +- test/coverlet.runsettings | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/Codecoverage.proj b/build/Codecoverage.proj index a77d8218e2..826d9c8b1f 100644 --- a/build/Codecoverage.proj +++ b/build/Codecoverage.proj @@ -20,7 +20,7 @@ - <_CodecovArgs Include="-f;$(BaseOutputPath)$(PlatformConfig)\coverage\Cobertura.xml" /> + <_CodecovArgs Include="-f;$(BaseOutputPath)$(PlatformConfig)\coverage\coverage.opencover.xml" /> <_CodecovArgs Include="--required" /> diff --git a/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs b/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs index 559b84b044..13adabd9f6 100644 --- a/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs +++ b/test/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs @@ -110,7 +110,7 @@ static int Main(string[] args) catch (PlatformNotSupportedException) { } - + return exitCode; } diff --git a/test/coverlet.runsettings b/test/coverlet.runsettings index 75f5f83f1f..7d3ce8b280 100644 --- a/test/coverlet.runsettings +++ b/test/coverlet.runsettings @@ -15,4 +15,4 @@ - \ No newline at end of file + From 19902f5316fb544902c7d245b9cfae7ad6a5a902 Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Thu, 28 May 2020 19:01:49 -0700 Subject: [PATCH 08/10] fix coverage report path --- build/Codecoverage.proj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/Codecoverage.proj b/build/Codecoverage.proj index 826d9c8b1f..03595f7ca8 100644 --- a/build/Codecoverage.proj +++ b/build/Codecoverage.proj @@ -16,11 +16,11 @@ <_ReportGeneratorPath>$(PkgReportGenerator)\tools\net47\ReportGenerator.exe - - + + - <_CodecovArgs Include="-f;$(BaseOutputPath)$(PlatformConfig)\coverage\coverage.opencover.xml" /> + <_CodecovArgs Include="-f;$(BaseOutputPath)$(PlatformConfig)\coverage\Cobertura.xml" /> <_CodecovArgs Include="--required" /> From 4b5a213863fe82fa80939ff374ff295aab457a73 Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Fri, 29 May 2020 15:10:06 -0700 Subject: [PATCH 09/10] try remove GC.Collect --- test/Microsoft.ML.Tests/OnnxConversionTest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/Microsoft.ML.Tests/OnnxConversionTest.cs b/test/Microsoft.ML.Tests/OnnxConversionTest.cs index 68013677d9..b54b1beaf8 100644 --- a/test/Microsoft.ML.Tests/OnnxConversionTest.cs +++ b/test/Microsoft.ML.Tests/OnnxConversionTest.cs @@ -1181,8 +1181,6 @@ public void OneHotHashEncodingOnnxConversionTest() var onnxModelPath = GetOutputPath(onnxFileName); SaveOnnxModel(onnxModel, onnxModelPath, null); - //Free up memory for x86 test - GC.Collect(); if (IsOnnxRuntimeSupported()) { From 6ec975954ad19c1806e2b6770b468f8381a5edf4 Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Fri, 29 May 2020 16:12:46 -0700 Subject: [PATCH 10/10] remove unnecessary new line --- test/Microsoft.ML.Tests/OnnxConversionTest.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/Microsoft.ML.Tests/OnnxConversionTest.cs b/test/Microsoft.ML.Tests/OnnxConversionTest.cs index b54b1beaf8..b20b385ddf 100644 --- a/test/Microsoft.ML.Tests/OnnxConversionTest.cs +++ b/test/Microsoft.ML.Tests/OnnxConversionTest.cs @@ -1181,7 +1181,6 @@ public void OneHotHashEncodingOnnxConversionTest() var onnxModelPath = GetOutputPath(onnxFileName); SaveOnnxModel(onnxModel, onnxModelPath, null); - if (IsOnnxRuntimeSupported()) { // Evaluate the saved ONNX model using the data used to train the ML.NET pipeline.