Fix target platform of managed OnnxRuntime dll and enable x86 .NET testing (#3056)

* WIP: Re-enable x86 .NET testing in Release pipelines

Enabling x86 testing will make sure that ORT packages doesn’t break x86 projects of customers

* Remove setting some env variables

* Comment out a test failing on x86 builds

* More changes

* Minor fix

* More changes

* More changes

* s

* s

* s

* Revert minor change

* More changes

* More changes

* More changes 2

* explicitly set platform target

* Delete bin and obj folders

* Clean output dirs

* Add back TargetFramwork

* Disable x86 .net framework tests

* Skip x86 tests in MKLML pipeline
This commit is contained in:
Hariharan Seshadri 2020-02-24 23:02:59 -08:00 committed by GitHub
parent b23b7f0fea
commit d7f2cdcc7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 54 additions and 19 deletions

View file

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework Condition="'$(TargetFramework)' == ''">netcoreapp2.1</TargetFramework>
<RuntimeIdentifier Condition="'$(TargetFramework)' == 'net461'">win-x64</RuntimeIdentifier>
<IsPackable>false</IsPackable>
<OnnxRuntimeCsharpRoot>$(MSBuildThisFileDirectory)..\..</OnnxRuntimeCsharpRoot>
<Platform>AnyCPU</Platform>

View file

@ -17,6 +17,11 @@ IF NOT "%4"=="" (
echo "Usage: runtest.bat LocalNuGetRepoPath TargetFramework TargetArch NuGetPackageVersion"
)
IF "%TargetArch%"=="x64" (
SET RuntimeIdentifier=win-x64
SET PlatformTarget=x64
)
IF "%TargetArch%"=="x86" (
SET dn="C:\Program Files (x86)\dotnet\dotnet"
SET RuntimeIdentifier=win-x86
@ -28,8 +33,13 @@ ECHO Target Framework is %TargetFramework%
REM Update if CUDA lib paths if set
SET PATH=%CUDA_PATH%\bin;%CUDNN_PATH%\bin;%PATH%
IF EXIST test\Microsoft.ML.OnnxRuntime.EndToEndTests\packages RMDIR /S /Q test\Microsoft.ML.OnnxRuntime.EndToEndTests\packages
IF EXIST test\Microsoft.ML.OnnxRuntime.EndToEndTests\bin RMDIR /S /Q test\Microsoft.ML.OnnxRuntime.EndToEndTests\bin
IF EXIST test\Microsoft.ML.OnnxRuntime.EndToEndTests\obj RMDIR /S /Q test\Microsoft.ML.OnnxRuntime.EndToEndTests\obj
@echo %CurrentOnnxRuntimeVersion%
%dn% restore test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --configfile .\Nuget.CSharp.config --no-cache --packages test\Microsoft.ML.OnnxRuntime.EndToEndTests --source https://api.nuget.org/v3/index.json --source %LocalNuGetRepo%
%dn% clean test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.csproj
%dn% restore test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --configfile .\Nuget.CSharp.config --no-cache --packages test\Microsoft.ML.OnnxRuntime.EndToEndTests\packages --source https://api.nuget.org/v3/index.json --source %LocalNuGetRepo%
IF NOT errorlevel 0 (
@echo "Failed to restore nuget packages for the test project"

View file

@ -577,7 +577,7 @@ namespace Microsoft.ML.OnnxRuntime.Tests
}
}
[Fact]
[SkipNonPackageTests]
private void TestRegisterCustomOpLibrary()
{
using (var option = new SessionOptions())
@ -1461,5 +1461,17 @@ namespace Microsoft.ML.OnnxRuntime.Tests
}
}
private class SkipNonPackageTests : FactAttribute
{
public SkipNonPackageTests()
{
var skipNonPackageTests = System.Environment.GetEnvironmentVariable("SKIPNONPACKAGETESTS");
if (skipNonPackageTests != null && skipNonPackageTests.Equals("ON"))
{
Skip = "Test skipped while testing the package as it is not within the scope";
}
}
}
}
}

View file

@ -173,3 +173,5 @@ jobs:
targetPath: '$(Build.ArtifactStagingDirectory)'
- template: test_all_os.yml
parameters:
Skipx86Tests: 'true'

View file

@ -126,6 +126,8 @@ jobs:
- template: test_win.yml
parameters:
AgentPool : 'Win-GPU-2019'
Skipx86Tests: 'true'
- template: test_linux.yml
parameters:
AgentPool : $(AgentPoolLinux)

View file

@ -1,8 +1,12 @@
# test NuGet package on Win, Linux and MacOS
parameters:
Skipx86Tests: 'false'
jobs:
- template: test_win.yml
parameters:
AgentPool : 'Win-CPU-2019'
Skipx86Tests : ${{ parameters.Skipx86Tests }}
- template: test_linux.yml
parameters:
AgentPool : $(AgentPoolLinux)

View file

@ -1,5 +1,6 @@
parameters:
AgentPool : 'Win-CPU'
Skipx86Tests: 'false'
jobs:
- job: NuGet_Test_Win
@ -13,6 +14,8 @@ jobs:
- group: ORT_TEST_DATA_SAS
- name: OnnxRuntimeBuildDirectory
value: '$(Build.BinariesDirectory)'
- name: SKIPNONPACKAGETESTS
value: 'ON'
steps:
- task: UsePythonVersion@0
@ -59,31 +62,36 @@ jobs:
parameters:
packageFolder: '$(Build.BinariesDirectory)\nuget-artifact'
# TODO: Add .Net Core AnyCPU test task
- script: |
@echo "Running Runtest.bat"
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact netcoreapp2.1 x64 $(NuGetPackageVersionNumber)
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Run End to End Test (C#) .Net Core'
displayName: 'Run End to End Test (C#) .Net Core x64'
- script: |
@echo "Running Runtest.bat"
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact netcoreapp2.1 x86 $(NuGetPackageVersionNumber)
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Run End to End Test (C#) .Net Core x86'
enabled: false
- ${{ if ne(parameters['Skipx86Tests'], 'true') }}:
- script: |
@echo "Running Runtest.bat"
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact netcoreapp2.1 x86 $(NuGetPackageVersionNumber)
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Run End to End Test (C#) .Net Core x86'
# TODO: Add .Net Framework AnyCPU test task
- script: |
@echo "Running Runtest.bat"
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact net461 x64 $(NuGetPackageVersionNumber)
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Run End to End Test (C#) .NetFramework'
displayName: 'Run End to End Test (C#) .NetFramework x64'
- script: |
@echo "Running Runtest.bat"
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact net461 x86 $(NuGetPackageVersionNumber)
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Run End to End Test (C#) .NetFramework x86'
enabled: false
- ${{ if ne(parameters['Skipx86Tests'], 'true') }}:
- script: |
@echo "Running Runtest.bat"
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact net461 x86 $(NuGetPackageVersionNumber)
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Run End to End Test (C#) .NetFramework x86'
enabled: false
- script: |
@echo "Running runtest.bat"

View file

@ -30,8 +30,6 @@ jobs:
DotNetExe: 'dotnet.exe'
CUDA_VERSION: ${{ parameters.CudaVersion }}
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
PlatformTarget: ${{ parameters.BuildArch }}
RuntimeIdentifier: win-${{ parameters.BuildArch }}
steps:
- powershell: |