diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj b/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj index ec902c4674..6ab1eba4b6 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj +++ b/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj @@ -32,15 +32,15 @@ + + + netcoreapp2.0 + false + $(MSBuildThisFileDirectory)..\.. + AnyCPU + bin\$(Configuration)\ + $(OnnxRuntimeCsharpRoot)\..\build\Windows + $(buildDirectory)\$(Configuration)\external\protobuf\cmake\$(Configuration) + $(OnnxRuntimeCsharpRoot)\..\cmake\external\onnx\onnx + $(buildDirectory)\$(Configuration)\$(Configuration) + + + + + + + + + + + + + + + + + Always + false + + + + Always + false + + + + + + + + + diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest-docker.sh b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest-docker.sh new file mode 100755 index 0000000000..395f2fa60e --- /dev/null +++ b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest-docker.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# build docker image for CPU + +#TODO: Get this working, not tested yet + +SOURCE_ROOT=$1 +NUGET_REPO_DIRNAME=$2 # path relative to BUILD_DIR +IMAGE="ubuntu16.04" +PYTHON_VER=3.5 +OldDir=$(pwd) +cd $SOURCE_ROOT/tools/ci_build/github/linux/docker +docker build -t "onnxruntime-$IMAGE" --build-arg OS_VERSION=16.04 --build-arg PYTHON_VERSION=${PYTHON_VER} -f Dockerfile.ubuntu . + + +docker rm -f "onnxruntime-cpu" || true +docker run -h $HOSTNAME \ + --rm \ + --name "onnxruntime-cpu" \ + --volume "$SOURCE_ROOT:/onnxruntime_src" \ + --volume "$BUILD_DIR:/home/onnxruntimedev" \ + --volume "$HOME/.cache/onnxruntime:/root/.cache/onnxruntime" \ + "onnxruntime-$IMAGE" \ + /bin/bash /onnxruntime_src/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.sh \ + /home/onnxruntimedev/$NUGET_REPO_DIRNAME /onnxruntime_src & + +cd $OldDir \ No newline at end of file diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.bat b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.bat new file mode 100755 index 0000000000..c72da295d3 --- /dev/null +++ b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.bat @@ -0,0 +1,29 @@ +REM Copyright (c) Microsoft Corporation. All rights reserved. +REM Licensed under the MIT License. + +@echo off +SETLOCAL EnableDelayedExpansion + +set LocalNuGetRepo=%1 +REM WorkingDirectory is Build.SourcesDirectory\csharp +set /p MajorVersionNumber=<..\VERSION_NUMBER +set VersionSuffix= +IF NOT DEFINED IsReleaseBuild ( + FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --short HEAD`) DO ( + set VersionSuffix=-dev-%%F + ) +) + +set CurrentOnnxRuntimeVersion=%MajorVersionNumber%%VersionSuffix% +@echo %CurrentOnnxRuntimeVersion% +dotnet restore test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.csproj -s %LocalNuGetRepo% --configfile .\Nuget.CSharp.config +if NOT errorlevel 0 ( + @echo "Failed to restore nuget packages for the test project" + Exit 1 +) + +dotnet 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 +) \ No newline at end of file diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.sh b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.sh new file mode 100755 index 0000000000..729da87afc --- /dev/null +++ b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +LocalNuGetRepo=$1 +SourceRoot=$2 + +@echo "Downloading test data" +python build.by --update --download_test_data + +MajorVersion=$(cat $SourceRoot/VERSION_NUMBER) +VersionSuffix= +if [ "$IsReleaseBuild" != "true" ]; then + VersionSuffix = -dev-$(git rev-parse --short HEAD) +fi +export CurrentOnnxRuntimeVersion=$MajorVersion$VersionSuffix +echo "Current NuGet package version is $CurrentOnnxRuntimeVersion" + +dotnet restore $SourceRoot/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj -s $LocalNuGetRepo --configfile $SourceRoot/csharp/Nuget.CSharp.config +if [ $? -ne 0 ] + echo "Failed to restore nuget packages for the test project" + exit 1 +) + +dotnet test $SourceRoot/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --no-restore +if [ $? -ne 0 ] + echo "Failed to build or execute the end-to-end test" + exit 1 +) \ No newline at end of file diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 870c5295e0..7fbbd8447c 100755 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -58,6 +58,8 @@ Use the individual flags to only run the specified stages. parser.add_argument("--enable_onnx_tests", action='store_true', help='''When running the Test phase, run onnx_test_running against available test data directories.''') parser.add_argument("--pb_home", help="Path to protobuf installation") + parser.add_argument("--download_test_data", action="store_true", + help='''Downloads test data without running the tests''') # CUDA related parser.add_argument("--use_cuda", action='store_true', help="Enable CUDA.") parser.add_argument("--cuda_home", help="Path to CUDA home." @@ -237,7 +239,7 @@ def download_test_data(build_dir, src_url, expected_md5, azure_sas_key): def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home, cudnn_home, pb_home, configs, cmake_extra_defines, args, cmake_extra_args): has_test_data = False - if args.enable_onnx_tests: + if args.enable_onnx_tests or args.download_test_data: has_test_data = download_test_data(build_dir, test_data_url, test_data_checksum, args.azure_sas_key) #create a shortcut for test models if there is a 'models' folder in build_dir if has_test_data and is_windows():