Commit a144865d authored by gaoqiong's avatar gaoqiong
Browse files

update v1.14.0

parent cf1acfd2
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="NuGet Official" value="https://api.nuget.org/v3/index.json" />
<add key="BuildArtifacts" value="[BuildPackageSource]" />
</packageSources>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<Identity
Name="f4124c5c-4bd7-488c-8e9b-1bfd74e92954"
Publisher="CN=Microsoft"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="f4124c5c-4bd7-488c-8e9b-1bfd74e92954" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>Microsoft.AI.MachineLearning.Tests.Uwp</DisplayName>
<PublisherDisplayName>sheil</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="Microsoft.AI.MachineLearning.Tests.Uwp.App">
<uap:VisualElements
DisplayName="Microsoft.AI.MachineLearning.Tests.Uwp"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="Microsoft.AI.MachineLearning.Tests.Uwp"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.AI.MachineLearning.Tests.Uwp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.AI.MachineLearning.Tests.Uwp")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
\ No newline at end of file
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>
\ No newline at end of file
# build, distribute, and bins (+ python proto bindings)
Debug
x64
packages
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WindowsAIVersion>1.3.0-dev-20200528-0441-83196680f</WindowsAIVersion>
</PropertyGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WindowsAIVersion>[PackageVersion]</WindowsAIVersion>
</PropertyGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup>
<EnableNuGetPackageRestore>true</EnableNuGetPackageRestore>
</PropertyGroup>
<Import Project="Microsoft.AI.MachineLearning.Tests.props" />
<PropertyGroup>
<CppWinRTPackage>true</CppWinRTPackage>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AI.MachineLearning" Version="$(WindowsAIVersion)" targetframework="native" />
<PackageReference Include="Microsoft.Windows.CppWinRT" Version="2.0.200615.7" targetframework="native" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<FileType>Document</FileType>
<DeploymentContent>true</DeploymentContent>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\testdata\squeezenet.onnx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Visible>true</Visible>
</None>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\winml\test\collateral\images\kitten_224.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Visible>true</Visible>
</None>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{3BB97C0D-DEC9-4828-A821-78147AE5A488}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Microsoft.AI.MachineLearning.Tests</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup>
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
#include <stdio.h>
#include "winrt/microsoft.ai.machinelearning.h"
#include "winrt/windows.storage.h"
#include "winrt/windows.foundation.h"
#include "winrt/windows.foundation.collections.h"
#include "winrt/Windows.Graphics.h"
#include "winrt/Windows.Graphics.Imaging.h"
#include "winrt/Windows.Media.h"
#include <windows.h>
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
using namespace winrt::Microsoft::AI::MachineLearning;
using namespace winrt::Windows::Storage;
using namespace winrt::Windows::Media;
using namespace winrt::Windows::Graphics::Imaging;
std::wstring GetModulePath() {
std::wstring val;
wchar_t modulePath[MAX_PATH] = {0};
GetModuleFileNameW((HINSTANCE)&__ImageBase, modulePath, _countof(modulePath));
wchar_t drive[_MAX_DRIVE];
wchar_t dir[_MAX_DIR];
wchar_t filename[_MAX_FNAME];
wchar_t ext[_MAX_EXT];
_wsplitpath_s(modulePath, drive, _MAX_DRIVE, dir, _MAX_DIR, filename, _MAX_FNAME, ext, _MAX_EXT);
val = drive;
val += dir;
return val;
}
int main() {
printf("Load squeezenet.onnx.\n");
auto model = LearningModel::LoadFromFilePath(L"squeezenet.onnx");
printf("Load kitten_224.png as StorageFile.\n");
auto name = GetModulePath() + L"kitten_224.png";
auto image = StorageFile::GetFileFromPathAsync(name).get();
printf("Load StorageFile into Stream.\n");
auto stream = image.OpenAsync(FileAccessMode::Read).get();
printf("Create SoftwareBitmap from decoded Stream.\n");
auto softwareBitmap = BitmapDecoder::CreateAsync(stream).get().GetSoftwareBitmapAsync().get();
printf("Create VideoFrame.\n");
auto frame = VideoFrame::CreateWithSoftwareBitmap(softwareBitmap);
printf("Create LearningModelSession.\n");
auto session = LearningModelSession(model);
printf("Create LearningModelBinding.\n");
auto binding = LearningModelBinding(session);
printf("Bind data_0.\n");
binding.Bind(L"data_0", frame);
printf("Evaluate.\n");
auto results = session.Evaluate(binding, L"");
printf("Success!\n");
return 0;
}
\ No newline at end of file
using Xamarin.UITest;
namespace EndToEndTests.Mobile.Automation
{
public class AppInitializer
{
public static IApp StartApp(Platform platform)
{
// For local testing of the Android test app, run a command line Debug build first
// msbuild <path_to_repo>/csharp/test/Microsoft.ML.OnnxRuntime.Tests.Droid/Microsoft.ML.OnnxRuntime.Tests.Droid.csproj /p:Configuration=Debug /t:PackageForAndroid
if (platform == Platform.Android)
{
return ConfigureApp
.Android
#if DEBUG
.EnableLocalScreenshots()
.ApkFile("../../../../../Microsoft.ML.OnnxRuntime.Tests.Droid/bin/Release/com.microsoft.onnxruntime_tests_droid.apk")
#endif
.StartApp();
}
// For local testing of the iOS test app, install to a physical iPhone device first
return ConfigureApp
.iOS
#if DEBUG
.EnableLocalScreenshots()
.InstalledApp(bundleId: "com.Microsoft.OnnxRuntime-Tests-iOS")
#endif
.StartApp();
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Xamarin.UITest" Version="3.2.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Microsoft.ML.OnnxRuntime.Tests.Devices\TestResultData.cs">
<Link>TestResultData.cs</Link>
</Compile>
</ItemGroup>
</Project>
\ No newline at end of file
using System;
using System.Threading;
using Microsoft.ML.OnnxRuntime.Tests.Devices;
using Newtonsoft.Json;
using NUnit.Framework;
using Xamarin.UITest;
namespace EndToEndTests.Mobile.Automation
{
[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
public class Tests
{
IApp _app;
Platform _platform;
string _getResultsBackdoorMethodName;
string _activityIndicatorClassName;
public Tests(Platform platform)
{
_platform = platform;
_activityIndicatorClassName = platform == Platform.Android ? "ActivityIndicatorRenderer" : "Xamarin_Forms_Platform_iOS_ActivityIndicatorRenderer";
_getResultsBackdoorMethodName = platform == Platform.Android ? "GetTestResults" : "getTestResults";
}
[SetUp]
public void BeforeEachTest()
=> _app = AppInitializer.StartApp(_platform);
[Test]
public void RunPlatformUnitTest()
{
_app.Screenshot("Pre-testing");
_app.WaitForElement(i => i.Marked("Run Everything"));
_app.Tap(i => i.Marked("Run Everything"));
_app.WaitForElement(i => i.Class(_activityIndicatorClassName));
_app.WaitForNoElement(i => i.Class(_activityIndicatorClassName).Child(0), timeout: TimeSpan.FromSeconds(30));
Thread.Sleep(1000); // Gives the test app sufficient time to prepare the results
var serializedResultSummary = _app.Invoke(_getResultsBackdoorMethodName)?.ToString();
Assert.IsNotEmpty(serializedResultSummary, "Test results were not returned");
var testSummary = JsonConvert.DeserializeObject<TestResultSummary>(serializedResultSummary);
Assert.AreEqual(testSummary.Failed, 0, $"{testSummary.Failed} tests failed");
_app.Screenshot("Post-testing");
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.13.2" targetFramework="net472" />
<package id="Xamarin.UITest" version="3.2.0" targetFramework="net472" />
</packages>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.810.8
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndToEndTests.Mobile.Automation", "EndToEndTests.Mobile.Automation\EndToEndTests.Mobile.Automation.csproj", "{1019E2BC-55E8-4318-97EF-771380E2EDF1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1019E2BC-55E8-4318-97EF-771380E2EDF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1019E2BC-55E8-4318-97EF-771380E2EDF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1019E2BC-55E8-4318-97EF-771380E2EDF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1019E2BC-55E8-4318-97EF-771380E2EDF1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F2B1A3BB-7003-43AE-B3EF-7F223D8B2EE3}
EndGlobalSection
EndGlobal
#!/bin/bash
parametersResolved=true
parametersValid=true
locallatestAndroidTestRunId=null
latestiOSTestRunId=null
latestAndroidTestRunState=null
latestiOSTestRunState=null
androidTestResultStatus=null
iosTestResultStatus=null
finishedTests=false
errors=0
maxErrors=10
timeoutInSeconds=60
failed=false
# Determine latest test runs (first item is latest run)
function getLatestTestRunIds() {
idRegex='"id":"([0-9a-z-]*)"'
androidTestRunsJson=$(curl -s -b -v -w "%{http_code}" -H "X-API-Token:$tokenAndroid" "https://api.appcenter.ms/v0.1/apps/$org/$appNameAndroid/test_runs")
[[ $androidTestRunsJson =~ $idRegex ]]
latestAndroidTestRunId="${BASH_REMATCH[1]}"
iosTestRunsJson=$(curl -s -b -v -w "%{http_code}" -H "X-API-Token:$tokeniOS" "https://api.appcenter.ms/v0.1/apps/$org/$appNameiOS/test_runs")
[[ $iosTestRunsJson =~ $idRegex ]]
latestiOSTestRunId="${BASH_REMATCH[1]}"
}
# Check status of latest test runs
function checkTestRunStatus() {
runStatusRegex='"runStatus":"([a-z]*)"'
testResultRegex='"resultStatus":"([a-z]*)"'
# Get Android and iOS test run id's if they have not already been resolved
[ $latestiOSTestRunId = null ] || [ $latestAndroidTestRunId = null ] && { getLatestTestRunIds; }
# Error if it's not possible to resolve both test run ID values
[ $latestiOSTestRunId = null ] || [ $latestAndroidTestRunId = null ] && { ((errors++)); return; }
androidLatestTestRunJson=$(curl -s -b -v -w "%{http_code}" -H "X-API-Token:$tokenAndroid" "https://api.appcenter.ms/v0.1/apps/$org/$appNameAndroid/test_runs/$latestAndroidTestRunId")
[[ $androidLatestTestRunJson =~ $runStatusRegex ]]
latestAndroidTestRunState="${BASH_REMATCH[1]}"
iosLatestTestRunJson=$(curl -s -b -v -w "%{http_code}" -H "X-API-Token:$tokeniOS" "https://api.appcenter.ms/v0.1/apps/$org/$appNameiOS/test_runs/$latestiOSTestRunId")
[[ $iosLatestTestRunJson =~ $runStatusRegex ]]
latestiOSTestRunState="${BASH_REMATCH[1]}"
if [ "$latestAndroidTestRunState" = null ] || [ "$latestiOSTestRunState" = null ]; then
((errors++))
return
elif [ "$latestAndroidTestRunState" = "finished" ] && [ "$latestiOSTestRunState" = "finished" ]; then
finishedTests=true
[[ $androidLatestTestRunJson =~ $testResultRegex ]]
androidTestResultStatus="${BASH_REMATCH[1]}"
[[ $iosLatestTestRunJson =~ $testResultRegex ]]
iosTestResultStatus="${BASH_REMATCH[1]}"
else
finishedTests=false
fi
}
echo ""
echo "========== Platform-Specific Testing Started =========="
echo ""
# Resolve parameters
for i in "$@"; do
case $1 in
"" ) break ;;
-b | --test-build-dir ) sourceDirectory="$2"; shift ;;
-p | --packages-dir ) packagesDirectory="$2"; shift ;;
-a | --apk ) androidApp="$2"; shift ;;
-i | --ipa ) iosApp="$2"; shift ;;
-o | --org ) org="$2"; shift ;;
-na | --app-name-android ) appNameAndroid="$2"; shift ;;
-ni | --app-name-ios ) appNameiOS="$2"; shift ;;
-ta | --token-android ) tokenAndroid="$2"; shift ;;
-ti | --token-ios ) tokeniOS="$2"; shift ;;
-* | --*) echo "Unknown option: '$1'"; exit 1 ;;
* ) echo "Unknown argument: '$1'"; exit 1 ;;
esac
shift
done
# Validate parameters have been resolved
[ -z "$sourceDirectory" ] && { echo "Missing --source-directory parameter"; parametersResolved=false; }
[ -z "$packagesDirectory" ] && { echo "Missing --packages-directory parameter"; parametersResolved=false; }
[ -z "$androidApp" ] && { echo "Missing --android-app parameter"; parametersResolved=false; }
[ -z "$iosApp" ] && { echo "Missing --ios-app parameter"; parametersResolved=false; }
[ -z "$org" ] && { echo "Missing --org parameter"; parametersResolved=false; }
[ -z "$appNameAndroid" ] && { echo "Missing --app-name-android parameter"; parametersResolved=false; }
[ -z "$appNameiOS" ] && { echo "Missing --app-name-ios parameter"; parametersResolved=false; }
[ -z "$tokenAndroid" ] && { echo "Missing --token-android parameter"; parametersResolved=false; }
[ -z "$tokeniOS" ] && { echo "Missing --token-ios parameter"; parametersResolved=false; }
[ $parametersResolved = false ] && {
echo ""
echo "========== Platform-Specific Testing Completed =========="
echo ""
exit 1
}
# Validate parameter values are valid
[ ! -d "$sourceDirectory" ] && { echo "No directory exists at path specified for --test-build-dir"; parametersValid=false; }
[ ! -d "$packagesDirectory" ] && { echo "No directory exists at path specified for --packages-dir"; parametersValid=false; }
[ ! -f "$androidApp" ] && { echo "No apk file found using filepath specified for --apk"; parametersValid=false; }
[ ! -f "$iosApp" ] && { echo "No ipa file found using filepath specified for --ipa"; parametersValid=false; }
toolsDir="$(find "$packagesDirectory" -name 'tools' ! -name 'test-cloud.exe' | head -1)"
[ ! -d "$toolsDir" ] && { echo "Unable to locate the requisite tools directory within the directory specified for --packages-dir"; parametersValid=false; }
[ $parametersValid = false ] && {
echo ""
echo "========== Platform-Specific Testing Completed =========="
echo ""
exit 1
}
# Start the tests
echo "Starting Tests"
# Start Android Tests
startAndroidTests=$(appcenter test run uitest \
--app "$org/$appNameAndroid" \
--devices 3aaf6e5b \
--app-path $androidApp \
--test-series "platformunittests" \
--locale "en_US" \
--build-dir $sourceDirectory \
--uitest-tools-dir $toolsDir \
--async)
echo ""
echo " Android: STARTED"
# Start iOS Tests
startiOSTests=$(appcenter test run uitest \
--app "$org/$appNameiOS" \
--devices f236dfc0 \
--app-path $iosApp \
--test-series "platformunittests" \
--locale "en_US" \
--build-dir $sourceDirectory \
--uitest-tools-dir $toolsDir \
--async)
echo " iOS: STARTED"
# Monitor state of latest test runs (todo: should cancel any test runs successfully started if one or more failed to start )
checkTestRunStatus
[ "$latestAndroidTestRunState" != "running" ] && [ "$latestiOSTestRunState" != "running" ] && {
echo ""
echo "There was an issue starting the tests"
echo ""
echo "========== Platform-Specific Testing Completed =========="
echo ""
exit 1
}
echo ""
echo "Monitoring Test Runs"
echo ""
echo " Android: $latestAndroidTestRunId"
echo " iOS: $latestiOSTestRunId"
while [ $finishedTests = false ] && [ $failed = false ]; do
sleep $timeoutInSeconds
checkTestRunStatus
if [ "$errors" -ge "$maxErrors" ]; then
failed=true
fi
done
# Determine test outcome
[ $failed = true ] && {
echo ""
echo "There was an issue monitoring the tests"
echo ""
echo "========== Platform-Specific Testing Completed =========="
echo ""
exit 1
}
echo ""
echo "Tests Finished"
echo ""
[ "$androidTestResultStatus" = "passed" ] && { echo " Android: PASS"; }
[ "$androidTestResultStatus" != "passed" ] && { echo " Android: FAIL"; }
[ "$iosTestResultStatus" = "passed" ] && { echo " iOS: PASS"; }
[ "$iosTestResultStatus" != "passed" ] && { echo " iOS: FAIL"; }
echo ""
echo "========== Platform-Specific Testing Completed =========="
echo ""
[ "$androidTestResultStatus" != "passed" ] && [ "$iosTestResultStatus" != "passed" ] && { exit 1; }
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework Condition="'$(TargetFramework)' == ''">netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
<OnnxRuntimeCsharpRoot>$(MSBuildThisFileDirectory)..\..</OnnxRuntimeCsharpRoot>
<Platform>AnyCPU</Platform>
<OutputPath>bin\$(Configuration)\</OutputPath>
<!-- arbitrary version for testing locally. when used in a CI CurrentOnnxRuntimeVersion should always be specified and match the package being tested -->
<CurrentOnnxRuntimeVersion Condition="'$(CurrentOnnxRuntimeVersion)' == ''">1.9.0</CurrentOnnxRuntimeVersion>
<PackageName Condition="'$(PACKAGENAME)' == ''">Microsoft.ML.OnnxRuntime</PackageName>
<IsLinuxBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinuxBuild>
<IsWindowsBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindowsBuild>
<IsMacOSBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsMacOSBuild>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\OnnxRuntime.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(IsLinuxBuild)'=='true'">
<!--internal build related properties for Linux -->
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeCsharpRoot)\..\build\Linux</OnnxRuntimeBuildDirectory>
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)</NativeBuildOutputDir>
</PropertyGroup>
<PropertyGroup Condition="'$(IsWindowsBuild)'=='true'">
<!--internal build related properties for Windows -->
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeCsharpRoot)\..\build\Windows</OnnxRuntimeBuildDirectory>
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)</NativeBuildOutputDir>
</PropertyGroup>
<PropertyGroup Condition="'$(IsMacOSBuild)'=='true'">
<!--internal build related properties for OSX -->
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeCsharpRoot)\..\build\MacOS</OnnxRuntimeBuildDirectory>
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)</NativeBuildOutputDir>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.16.0" /> <!-- should match version ORT native build uses -->
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<!-- use Newtonsoft.Json dependency of Microsoft.NET.Test.Sdk at a more recent version -->
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="$(PACKAGENAME)" Version="$(CurrentOnnxRuntimeVersion)" />
</ItemGroup>
<ItemGroup>
<BuildEnvVars Include="OnnxRuntimeBuildDirectory=$(OnnxRuntimeBuildDirectory)" />
<Compile Include="..\Microsoft.ML.OnnxRuntime.Tests.Common\InferenceTest.cs"/>
<Compile Include="..\Microsoft.ML.OnnxRuntime.Tests.Common\OnnxMl.cs"/>
<Compile Include="..\Microsoft.ML.OnnxRuntime.Tests.NetCoreApp\InferenceTest.netcore.cs" />
<Compile Include="..\Microsoft.ML.OnnxRuntime.Tests.Common\TestDataLoader.cs" />
<!-- Works in CI builds-->
<None Include="$(OnnxRuntimeBuildDirectory)\testdata\testdata\custom_op*.dll;$(OnnxRuntimeBuildDirectory)\testdata\testdata\custom_op*.pdb;$(OnnxRuntimeBuildDirectory)\testdata\testdata\libcustom*.so;$(OnnxRuntimeBuildDirectory)\testdata\testdata\libcustom*.dylib">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<!-- Works for local builds-->
<None Include="$(NativeBuildOutputDir)\custom_op*.dll;$(NativeBuildOutputDir)\custom_op*.pdb;$(NativeBuildOutputDir)\libcustom*.so;$(NativeBuildOutputDir)\libcustom*.dylib">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<!-- -->
<!-- test data for non-mobile scenarios -->
<None Include="$(OnnxRuntimeCSharpRoot)\testdata\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(OnnxRuntimeCSharpRoot)\..\onnxruntime\test\testdata\overridable_initializer.onnx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(OnnxRuntimeCSharpRoot)\..\onnxruntime\test\testdata\capi_symbolic_dims.onnx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(OnnxRuntimeCSharpRoot)\..\onnxruntime\test\testdata\custom_op_library\custom_op_test.onnx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<!-- test data as embedded resources for mobile scenarios -->
<EmbeddedResource Include="..\..\testdata\*">
<Link>TestData\%(Filename)%(Extension)</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\..\..\onnxruntime\test\testdata\overridable_initializer.onnx">
<Link>TestData\overridable_initializer.onnx</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\..\..\onnxruntime\test\testdata\capi_symbolic_dims.onnx">
<Link>TestData\capi_symbolic_dims.onnx</Link>
</EmbeddedResource>
</ItemGroup>
<Target Name="DefineBuildEnvironmentVariables" BeforeTargets="Build">
<WriteLinesToFile File="$(OutputPath)\Properties.txt" Lines="@(BuildEnvVars)" Overwrite="true" />
</Target>
<ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>
</Project>

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.810.8
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.ML.OnnxRuntime.EndToEndTests", "Microsoft.ML.OnnxRuntime.EndToEndTests.csproj", "{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|x86 = Debug|x86
Release|x86 = Release|x86
RelWithDebInfo|Any CPU = RelWithDebInfo|Any CPU
RelWithDebInfo|x86 = RelWithDebInfo|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.Release|Any CPU.Build.0 = Release|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.Debug|x86.ActiveCfg = Debug|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.Debug|x86.Build.0 = Debug|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.Release|x86.ActiveCfg = Release|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.Release|x86.Build.0 = Release|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU
{B6FB2796-4CFB-44FF-B826-E1B8CA9E9447}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2BAFD476-55EB-4419-9134-1EFDA06728BF}
EndGlobalSection
EndGlobal
REM Copyright (c) Microsoft Corporation. All rights reserved.
REM Licensed under the MIT License.
@ECHO ON
SETLOCAL EnableDelayedExpansion
SET TargetFramework=netcoreapp5.0
SET TargetArch=x64
SET dn="C:\Program Files\dotnet\dotnet"
SET CurrentOnnxRuntimeVersion=""
SET LocalNuGetRepo=%1
IF NOT "%2"=="" (SET TargetFramework=%2)
IF NOT "%3"=="" (SET TargetArch=%3)
IF NOT "%4"=="" (
SET CurrentOnnxRuntimeVersion=%4
) ELSE (
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
SET PlatformTarget=x86
)
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 %PackageName%
@echo %CurrentOnnxRuntimeVersion%
%dn% clean test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.csproj
%dn% restore -v normal 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"
EXIT 1
)
%dn% list test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.csproj package
dir test\Microsoft.ML.OnnxRuntime.EndToEndTests\packages\
IF "%PACKAGENAME%"=="Microsoft.ML.OnnxRuntime.Gpu" (
set TESTONGPU=ON
%dn% test -p:DefineConstants=USE_TENSORRT test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --no-restore --filter TensorRT
IF NOT errorlevel 0 (
@echo "Failed to build or execute the end-to-end test"
EXIT 1
)
%dn% test -p:DefineConstants=USE_CUDA test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --no-restore
) ELSE (
%dn% test test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --no-restore
)
IF NOT errorlevel 0 (
@echo "Failed to build or execute the end-to-end test"
EXIT 1
)
#!/bin/bash
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
LocalNuGetRepo=$1
export CurrentOnnxRuntimeVersion=$2
IsMacOS=${3:-false}
PACKAGENAME=${PACKAGENAME:-Microsoft.ML.OnnxRuntime}
RunTestCsharp=${RunTestCsharp:-true}
RunTestNative=${RunTestNative:-true}
set -x -e
pushd .
cd $BUILD_SOURCESDIRECTORY
echo "Current NuGet package version is $CurrentOnnxRuntimeVersion"
if [ $RunTestCsharp = "true" ]; then
if [[ $IsMacOS == "True" || $IsMacOS == "true" ]]; then
# TODO(#12040): The test should figure out the opset version from the model file. Remove it from the path.
ONNX_DIR="${BUILD_SOURCESDIRECTORY}/cmake/external/onnx"
ONNX_VERSION_NUMBER=$(cat "${ONNX_DIR}/VERSION_NUMBER" | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
OPSET_VERSION=$(grep "${ONNX_VERSION_NUMBER}" "${ONNX_DIR}/docs/Versioning.md" | sed -E "s/${ONNX_VERSION_NUMBER}\|[^|]+\|([0-9]+)\|.*/\1/")
mkdir -p "${BUILD_BINARIESDIRECTORY}/models"
ln -s "${ONNX_DIR}/onnx/backend/test/data/node" "${BUILD_BINARIESDIRECTORY}/models/opset${OPSET_VERSION}"
fi
# Run C# tests
dotnet restore $BUILD_SOURCESDIRECTORY/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj -s $LocalNuGetRepo -s https://api.nuget.org/v3/index.json
if [ $? -ne 0 ]; then
echo "Failed to restore nuget packages for the test project"
exit 1
fi
if [ $PACKAGENAME = "Microsoft.ML.OnnxRuntime.Gpu" ]; then
export TESTONGPU=ON
dotnet test -p:DefineConstants=USE_CUDA $BUILD_SOURCESDIRECTORY/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --no-restore --verbosity detailed --filter "DisplayName!=TestCUDAProviderOptions"
if [ $? -ne 0 ]; then
echo "Failed to build or execute the end-to-end test"
exit 1
fi
dotnet test -p:DefineConstants=USE_TENSORRT $BUILD_SOURCESDIRECTORY/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --no-restore --verbosity detailed
else
dotnet test $BUILD_SOURCESDIRECTORY/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --no-restore --verbosity detailed
fi
if [ $? -ne 0 ]; then
echo "Failed to build or execute the end-to-end test"
exit 1
fi
fi
cd $OldDir
popd
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Microsoft.ML.OnnxRuntime.Tests.Droid, PublicKey=002400000480000094000000060200000024000052534131000400000100010059013e94e4bc70136ca4c35f33acd6b62974536b698f9c7a21cee18d805c7ad860ad9eebfdc47a96ba2f8d03f4cf1c36b9d30787e276c7b9833b5bf2a6eba7e919e6b90083078a352262aed1d842e5f70a3085cbcf4c56ae851b161137920961c23fcc246598d61d258ccc615c927b2441359eea666a99ce1c3c07dca18fb0e1")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Microsoft.ML.OnnxRuntime.Tests.iOS, PublicKey=002400000480000094000000060200000024000052534131000400000100010059013e94e4bc70136ca4c35f33acd6b62974536b698f9c7a21cee18d805c7ad860ad9eebfdc47a96ba2f8d03f4cf1c36b9d30787e276c7b9833b5bf2a6eba7e919e6b90083078a352262aed1d842e5f70a3085cbcf4c56ae851b161137920961c23fcc246598d61d258ccc615c927b2441359eea666a99ce1c3c07dca18fb0e1")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Microsoft.ML.OnnxRuntime.Tests.NetCoreApp, PublicKey=002400000480000094000000060200000024000052534131000400000100010059013e94e4bc70136ca4c35f33acd6b62974536b698f9c7a21cee18d805c7ad860ad9eebfdc47a96ba2f8d03f4cf1c36b9d30787e276c7b9833b5bf2a6eba7e919e6b90083078a352262aed1d842e5f70a3085cbcf4c56ae851b161137920961c23fcc246598d61d258ccc615c927b2441359eea666a99ce1c3c07dca18fb0e1")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Microsoft.ML.OnnxRuntime.EndToEndTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010059013e94e4bc70136ca4c35f33acd6b62974536b698f9c7a21cee18d805c7ad860ad9eebfdc47a96ba2f8d03f4cf1c36b9d30787e276c7b9833b5bf2a6eba7e919e6b90083078a352262aed1d842e5f70a3085cbcf4c56ae851b161137920961c23fcc246598d61d258ccc615c927b2441359eea666a99ce1c3c07dca18fb0e1")]
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment