From 882f28a74b1d7e156b896b081a5ca367db027222 Mon Sep 17 00:00:00 2001 From: shahasad <43590019+shahasad@users.noreply.github.com> Date: Mon, 25 Nov 2019 15:26:09 -0800 Subject: [PATCH] Fix NuGet end to end tests for custom op dll (#2472) --- .../Microsoft.ML.OnnxRuntime.EndToEndTests.csproj | 2 +- .../test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs | 2 +- .../github/azure-pipelines/nuget/templates/cpu-mklml.yml | 6 ++++++ .../nuget/templates/cpu-nocontribops-arm64.yml | 9 ++++++++- .../github/azure-pipelines/nuget/templates/cpu.yml | 8 ++++++++ .../github/azure-pipelines/nuget/templates/gpu.yml | 4 ++++ .../azure-pipelines/nuget/templates/test_linux.yml | 6 ++++++ .../azure-pipelines/nuget/templates/test_macos.yml | 6 ++++++ .../github/azure-pipelines/nuget/templates/test_win.yml | 7 +++++++ 9 files changed, 47 insertions(+), 3 deletions(-) diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj index 6c5cc58b0f..e2ffae1c4c 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj +++ b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj @@ -23,7 +23,7 @@ - + Always false diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs index 5ad068127d..693c6e460a 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs +++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs @@ -575,7 +575,7 @@ namespace Microsoft.ML.OnnxRuntime.Tests } [Fact] - private void TestRegisterCustopOpLibrary() + private void TestRegisterCustomOpLibrary() { using (var option = new SessionOptions()) { diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-mklml.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-mklml.yml index 46638e86ee..cfec712e79 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-mklml.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-mklml.yml @@ -21,6 +21,8 @@ jobs: NuPackScript: | msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreatePackage /p:OrtPackageId=Microsoft.ML.OnnxRuntime.MKLML copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)\testdata + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata - job: 'Linux_CI_Dev' workspace: @@ -48,6 +50,8 @@ jobs: cd $(Build.BinariesDirectory)/linux-x64 zip -r linux-x64.zip linux-x64 cp $(Build.BinariesDirectory)/linux-x64/linux*.zip $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)/testdata + cp $(Build.BinariesDirectory)/Release/libcustom_op_library.so* $(Build.ArtifactStagingDirectory)/testdata ls -al $(Build.ArtifactStagingDirectory) displayName: 'Create Artifacts' - task: PublishPipelineArtifact@0 @@ -85,6 +89,8 @@ jobs: cd $(Build.BinariesDirectory) zip -r osx-x64.zip osx-x64 cp $(Build.BinariesDirectory)/osx-x64.zip $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)/testdata + cp $(Build.BinariesDirectory)/RelWithDebInfo/libcustom_op_library.dylib $(Build.ArtifactStagingDirectory)/testdata cd $cwd - job: NuGet_Packaging diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-nocontribops-arm64.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-nocontribops-arm64.yml index 607c6ea8ff..b08d18602e 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-nocontribops-arm64.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-nocontribops-arm64.yml @@ -20,7 +20,8 @@ jobs: NuPackScript: | msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreatePackage copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) - + mkdir $(Build.ArtifactStagingDirectory)\testdata + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata - template: ../../templates/win-x86-ci.yml parameters: @@ -36,6 +37,8 @@ jobs: cd $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\ ren *.nupkg win-x86.zip copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)\testdata + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata - template: ../../templates/win-ci-arm.yml parameters: @@ -81,6 +84,8 @@ jobs: cd $(Build.BinariesDirectory)/linux-x64 zip -r linux-x64.zip linux-x64 cp $(Build.BinariesDirectory)/linux-x64/linux*.zip $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)/testdata + cp $(Build.BinariesDirectory)/Release/libcustom_op_library.so* $(Build.ArtifactStagingDirectory)/testdata ls -al $(Build.ArtifactStagingDirectory) displayName: 'Create Artifacts' - task: PublishPipelineArtifact@0 @@ -111,6 +116,8 @@ jobs: cd $(Build.BinariesDirectory) zip -r osx-x64.zip osx-x64 cp $(Build.BinariesDirectory)/osx-x64.zip $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)/testdata + cp $(Build.BinariesDirectory)/RelWithDebInfo/libcustom_op_library.dylib $(Build.ArtifactStagingDirectory)/testdata cd $cwd - job: NuGet_Packaging diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/cpu.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/cpu.yml index 66b4cf284e..702a20254a 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/cpu.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/cpu.yml @@ -21,6 +21,8 @@ jobs: NuPackScript: | msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreatePackage copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)\testdata + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata - template: ../../templates/win-x86-ci.yml parameters: @@ -36,6 +38,8 @@ jobs: cd $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\ ren *.nupkg win-x86.zip copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)\testdata + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata - job: 'Linux_CI_Dev' workspace: @@ -60,6 +64,8 @@ jobs: cd $(Build.BinariesDirectory)/linux-x64 zip -r linux-x64.zip linux-x64 cp $(Build.BinariesDirectory)/linux-x64/linux*.zip $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)/testdata + cp $(Build.BinariesDirectory)/Release/libcustom_op_library.so* $(Build.ArtifactStagingDirectory)/testdata ls -al $(Build.ArtifactStagingDirectory) displayName: 'Create Artifacts' - task: PublishPipelineArtifact@0 @@ -90,6 +96,8 @@ jobs: cd $(Build.BinariesDirectory) zip -r osx-x64.zip osx-x64 cp $(Build.BinariesDirectory)/osx-x64.zip $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)/testdata + cp $(Build.BinariesDirectory)/RelWithDebInfo/libcustom_op_library.dylib $(Build.ArtifactStagingDirectory)/testdata cd $cwd - job: NuGet_Packaging diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/gpu.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/gpu.yml index 31d4327513..81914ad074 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/gpu.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/gpu.yml @@ -27,6 +27,8 @@ jobs: NuPackScript: | msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreatePackage /p:OrtPackageId=Microsoft.ML.OnnxRuntime.Gpu copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)\testdata + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata - job: 'Linux_CI_GPU_Dev' pool: $(AgentPoolLinux) @@ -48,6 +50,8 @@ jobs: cd $(Build.BinariesDirectory)/linux-x64 zip -r linux-x64.zip linux-x64 cp $(Build.BinariesDirectory)/linux-x64/linux*.zip $(Build.ArtifactStagingDirectory) + mkdir $(Build.ArtifactStagingDirectory)/testdata + cp $(Build.BinariesDirectory)/Release/libcustom_op_library.so* $(Build.ArtifactStagingDirectory)/testdata ls -al $(Build.ArtifactStagingDirectory) displayName: 'Create Artifacts' - task: PublishPipelineArtifact@0 diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/test_linux.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/test_linux.yml index 1071e5937a..5ca82e06a4 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/test_linux.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/test_linux.yml @@ -24,6 +24,12 @@ jobs: artifactName: 'drop-signed-nuget' targetPath: '$(Build.BinariesDirectory)/nuget-artifact' + - task: DownloadPipelineArtifact@0 + displayName: 'Download Linux CustomOp TestData' + inputs: + artifactName: 'drop-linux' + targetPath: '$(Build.BinariesDirectory)/testdata' + - template: get-nuget-package-version-as-variable.yml parameters: packageFolder: '$(Build.BinariesDirectory)/nuget-artifact' diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/test_macos.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/test_macos.yml index 347bc78ac1..f819526649 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/test_macos.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/test_macos.yml @@ -23,6 +23,12 @@ jobs: artifactName: 'drop-signed-nuget' targetPath: '$(Build.BinariesDirectory)/nuget-artifact' + - task: DownloadPipelineArtifact@0 + displayName: 'Download OsX CustomOp test data' + inputs: + artifactName: 'drop-osx' + targetPath: '$(Build.BinariesDirectory)/testdata' + - template: get-nuget-package-version-as-variable.yml parameters: packageFolder: '$(Build.BinariesDirectory)/nuget-artifact' diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml index 3d506a1ab0..e4fc8b2e2d 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml @@ -30,12 +30,19 @@ jobs: filename: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat' arguments: 'amd64' modifyEnvironment: true + - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact' inputs: artifactName: 'drop-signed-nuget' targetPath: '$(Build.BinariesDirectory)\nuget-artifact' + - task: DownloadPipelineArtifact@0 + displayName: 'Download Pipeline Artifact - testdata' + inputs: + artifactName: 'drop-nuget' + targetPath: '$(Build.BinariesDirectory)\testdata' + - template: get-nuget-package-version-as-variable.yml parameters: packageFolder: '$(Build.BinariesDirectory)\nuget-artifact'