Unverified Commit 817210cf authored by Michał Karzyński's avatar Michał Karzyński Committed by GitHub

Travis tests bugfix (#1550)

parent e9443168
#!/bin/bash #!/bin/bash
set -e set -e
echo "--TRAVIS VARIABLES--"
echo "TRAVIS_OS_NAME:" ${TRAVIS_OS_NAME}
echo "TRAVIS_BUILD_DIR:" ${TRAVIS_BUILD_DIR}
echo "--CUSTOM VARIABLES--"
echo "TASK:" ${TASK} echo "TASK:" ${TASK}
echo "OS:" ${OS}
if [ ${TASK} == "cpp_test" ]; then # LINUX TASKS
docker run -w '/root/ngraph/build' test_ngraph make unit-test-check if [ ${TRAVIS_OS_NAME} == "linux" ]; then
fi
if [ ${TASK} == "cpp_test" ]; then
docker run -w '/root/ngraph/build' test_ngraph make unit-test-check
fi
if [ ${TASK} == "python2_test" ]; then
docker run -w '/root/ngraph/python' test_ngraph tox -e py27
fi
if [ ${TASK} == "python3_test" ]; then
docker run -w '/root/ngraph/python' test_ngraph tox -e py3
fi
if [ ${TASK} == "python2_test" ]; then
docker run -w '/root/ngraph/python' test_ngraph tox -e py27
fi fi
if [ ${TASK} == "python3_test" ]; then # MacOS TASKS
docker run -w '/root/ngraph/python' test_ngraph tox -e py3 if [ ${TRAVIS_OS_NAME} == "osx" ]; then
if [ ${TASK} == "cpp_test" ]; then
cd ${TRAVIS_BUILD_DIR}/build
make unit-test-check
fi
fi fi
...@@ -8,10 +8,12 @@ matrix: ...@@ -8,10 +8,12 @@ matrix:
- os: linux - os: linux
sudo: required sudo: required
services: docker services: docker
language: python
env: TASK=python2_test OS=ubuntu env: TASK=python2_test OS=ubuntu
- os: linux - os: linux
sudo: required sudo: required
services: docker services: docker
language: python
env: TASK=python3_test OS=ubuntu env: TASK=python3_test OS=ubuntu
- os: linux - os: linux
sudo: required sudo: required
...@@ -37,17 +39,11 @@ install: ...@@ -37,17 +39,11 @@ install:
-DNGRAPH_ONNX_IMPORT_ENABLE=TRUE \ -DNGRAPH_ONNX_IMPORT_ENABLE=TRUE \
-DCMAKE_INSTALL_PREFIX="~/ngraph_dist" -DCMAKE_INSTALL_PREFIX="~/ngraph_dist"
make -j 2 make -j 2
cd -
fi fi
script: script:
- | - .ci/travis/run_test.sh
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
.ci/travis/run_test.sh
fi
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
cd $TRAVIS_BUILD_DIR/build
make unit-test-check
fi
branches: branches:
only: only:
......
...@@ -22,15 +22,15 @@ from test.ngraph.util import get_runtime ...@@ -22,15 +22,15 @@ from test.ngraph.util import get_runtime
def test_import_onnx_function(): def test_import_onnx_function():
dtype = np.float32 model_path = os.path.join(os.path.dirname(__file__), 'models/add_abc.onnx')
cur_dir = os.path.dirname(__file__)
model_path = os.path.join(cur_dir, 'models/add_abc.onnx')
ng_function = load_onnx_model_file(model_path)[0] ng_function = load_onnx_model_file(model_path)[0]
dtype = np.float32
value_a = np.array([1.0], dtype=dtype) value_a = np.array([1.0], dtype=dtype)
value_b = np.array([2.0], dtype=dtype) value_b = np.array([2.0], dtype=dtype)
value_c = np.array([3.0], dtype=dtype) value_c = np.array([3.0], dtype=dtype)
result = ng_function(value_a, value_b, value_c, runtime=get_runtime()) runtime = get_runtime()
computation = runtime.computation(ng_function)
result = computation(value_a, value_b, value_c)
assert np.allclose(result, np.array([6], dtype=dtype)) assert np.allclose(result, np.array([6], dtype=dtype))
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