Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <assert.h>
#include <onnxruntime_c_api.h>
#include <cmath>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
Expand Down Expand Up @@ -146,7 +147,7 @@ int main(int argc, char* argv[]) {
// Get pointer to output tensor float values
float* floatarr;
CheckStatus(g_ort->GetTensorMutableData(output_tensor, (void**)&floatarr));
assert(abs(floatarr[0] - 0.000045) < 1e-6);
assert(std::abs(floatarr[0] - 0.000045) < 1e-6);

// score the model, and print scores for first 5 classes
for (int i = 0; i < 5; i++)
Expand Down
25 changes: 20 additions & 5 deletions csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ LocalNuGetRepo=$1
SourceRoot=$2
BuildDir=$3
export CurrentOnnxRuntimeVersion=$4
IsMacOS=${5:-false}
PackageName=${PACKAGENAME:-Microsoft.ML.OnnxRuntime}
RunTestCsharp=${RunTestCsharp:-true}
RunTestNative=${RunTestNative:-true}

set -x

OldDir=`pwd`
Expand Down Expand Up @@ -36,13 +41,23 @@ if [ $RunTestNative = "true" ]; then
TempDir=_tmp
mkdir -p $TempDir && pushd $TempDir
unzip ../$PackageName
libs="-L runtimes/linux-x86/native -L runtimes/linux-x64/native -l onnxruntime"

inc="-I build/native/include"
g++ -std=c++14 $SourceRoot/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
if [ $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 $SourceRoot/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 $SourceRoot/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 $SourceRoot/csharp/testdata/squeezenet.onnx .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
AgentPool : 'Hosted macOS High Sierra'
IsMacOS : 'true'

jobs:
- job: NuGet_Test_MacOS
Expand Down Expand Up @@ -38,7 +39,8 @@ jobs:
$(Build.BinariesDirectory)/nuget-artifact \
$(Build.SourcesDirectory) \
$(Build.BinariesDirectory) \
$(NuGetPackageVersionNumber)
$(NuGetPackageVersionNumber) \
${{ parameters.IsMacOS }}

if [ $? -ne 0 ]; then
echo "Failed to run test"
Expand Down
12 changes: 7 additions & 5 deletions tools/ci_build/github/linux/docker/scripts/install_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ elif [ "$os_major_version" == "6" ] && [ ! -d "/opt/python/cp35-cp35m" ]; then
/usr/bin/python3.6 -m pip install --upgrade pip
else
yum install -y redhat-lsb-core expat-devel libcurl-devel tar unzip curl zlib-devel make libunwind icu aria2 rsync bzip2 git bzip2-devel
# install dotnet core dependencies
yum install -y lttng-ust openssl-libs krb5-libs libicu libuuid
# install dotnet runtimes
yum install -y https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
yum install -y dotnet-sdk-2.2

if [ "$os_major_version" == "7" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f [ "$os_major_version" == "7" ]; then [](start = 3, length = 38)

This used to be a default case but now for some OS nothing will get installed and no message is being displayed.

Copy link
Contributor Author

@askhade askhade Dec 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to install dotnet dependencies and sdk which are inside this if loop only on centos 7... this is intentional

I added the dotnet sdk and dependency installation in my previous commit with the very same intention. I made a wrong assumption that only cases with os version 7 will fall in this else loop... now using this PR to fix it

# install dotnet core dependencies
yum install -y lttng-ust openssl-libs krb5-libs libicu libuuid
# install dotnet runtimes
yum install -y https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
yum install -y dotnet-sdk-2.2
fi
fi


Expand Down