onnxruntime/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.sh
Changming Sun 8378a45ae7
Add python 3.8/3.9 support for Windows GPU and Linux ARM64 (#6615)
Add python 3.8/3.9 support for Windows GPU and Linux ARM64

Delete jemalloc from cgmanifest.json.

Add onnx node test to Nuphar pipeline.

Change $ANDROID_HOME/ndk-bundle to $ANDROID_NDK_HOME. The later one is more accurate.

Delete Java GPU packaging pipeline

Remove test data download step in Nuget Mac OS pipeline. Because these machines are out of control and out of our network, it's hard to make it reliable and the data secure.

Fix a doc problem in c-api-artifacts-package-and-publish-steps-windows.yml. It shouldn't copy C_API.md, because the file has been moved into a different branch.

Delete the CI build docker file for Ubuntu cuda 9.x and Ubuntu x86 32 bits

And, due to some internal restrictions, I need to rename some of the agent pools
2021-02-11 16:43:35 -08:00

75 lines
2.9 KiB
Bash
Executable file

#!/bin/bash
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
LocalNuGetRepo=$1
BuildDir=$3
export CurrentOnnxRuntimeVersion=$4
IsMacOS=${5:-false}
# NOTE: PackageName is not PACKAGENAME since this is being called by other scripts that have already switched to the CamelCase version
PackageName=${PackageName:-Microsoft.ML.OnnxRuntime}
RunTestCsharp=${RunTestCsharp:-true}
RunTestNative=${RunTestNative:-true}
set -x -e
OldDir=`pwd`
cd $BUILD_SOURCESDIRECTORY
echo "Current NuGet package version is $CurrentOnnxRuntimeVersion"
if [ $RunTestCsharp = "true" ]; then
if [[ $IsMacOS == "True" || $IsMacOS == "true" ]]; then
mkdir -p $BUILD_BINARIESDIRECTORY/models
ln -s $BUILD_SOURCESDIRECTORY/cmake/external/onnx/onnx/backend/test/data/node $BUILD_BINARIESDIRECTORY/models/opset14
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
dotnet test $BUILD_SOURCESDIRECTORY/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --no-restore --verbosity detailed
if [ $? -ne 0 ]; then
echo "Failed to build or execute the end-to-end test"
exit 1
fi
fi
if [ $RunTestNative = "true" ]; then
# Run Native shared object test
# PackageName is passed in environment (e.g. Microsoft.ML.OnnxRuntime)
PackageName="$PackageName.$CurrentOnnxRuntimeVersion.nupkg"
cd $LocalNuGetRepo
TempDir=_tmp
mkdir -p $TempDir && pushd $TempDir
unzip ../$PackageName
inc="-I build/native/include"
if [[ $IsMacOS == "True" || $IsMacOS == "true" ]]; then
export DYLD_FALLBACK_LIBRARY_PATH=$LocalNuGetRepo/_tmp:${DYLD_FALLBACK_LIBRARY_PATH}
libs="-L runtimes/osx-x64/native -l onnxruntime"
g++ -std=c++11 $BUILD_SOURCESDIRECTORY/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp $inc $libs -Wunused-result -Wformat=0 -o sampletest
libName=$(otool -L ./sampletest | grep onnxruntime | xargs | cut -d' ' -f1 | cut -d'/' -f2)
ln -sf runtimes/osx-x64/native/libonnxruntime.dylib $libName
else
export LD_LIBRARY_PATH=$LocalNuGetRepo/_tmp:${LD_LIBRARY_PATH}
libs="-L runtimes/linux-x86/native -L runtimes/linux-x64/native -l onnxruntime"
g++ -std=c++11 $BUILD_SOURCESDIRECTORY/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp $inc $libs -Wunused-result -o sampletest
# Create link to versioned shared object required at runtime
libname=`ldd sampletest | grep onnxruntime | xargs | cut -d" " -f1`
ln -sf runtimes/linux-x64/native/libonnxruntime.so $libname
fi
# Copy Sample Model
cp $BUILD_SOURCESDIRECTORY/csharp/testdata/squeezenet.onnx .
# Run the sample model
./sampletest
popd
rm -rf $TempDir
fi
cd $OldDir