diff --git a/tests/st/add/add.sh b/tests/st/add/add.sh index 65767f1..4f5fc5e 100644 --- a/tests/st/add/add.sh +++ b/tests/st/add/add.sh @@ -15,7 +15,7 @@ echo "CURRUSER:" ${CURRUSER} echo "PROJECT_PATH:" ${PROJECT_PATH} export LD_LIBRARY_PATH=${MINDSPORE_INSTALL_PATH}/lib:/usr/local/python/python375/lib/:${LD_LIBRARY_PATH} -export PYTHONPATH=${MINDSPORE_INSTALL_PATH}/:${PYTHONPATH} +#export PYTHONPATH=${MINDSPORE_INSTALL_PATH}/:${PYTHONPATH} echo "LD_LIBRARY_PATH: " ${LD_LIBRARY_PATH} echo "PYTHONPATH: " ${PYTHONPATH} @@ -85,7 +85,7 @@ pytest_serving() { unset http_proxy https_proxy echo "### client start ###" - python3 -m pytest -v -s client.py > client.log 2>&1 + python3 client.py > client.log 2>&1 if [ $? -ne 0 ] then clean_pid @@ -99,6 +99,7 @@ test_bert_model() { start_service pytest_serving + cat client.log clean_pid } diff --git a/tests/st/add/client.py b/tests/st/add/client.py index a91aa29..944a6cc 100644 --- a/tests/st/add/client.py +++ b/tests/st/add/client.py @@ -50,6 +50,8 @@ def run_add_cast(): instances.append({"x1": x1, "x2": x2}) result = client.infer(instances) print(result) + y = x1 + x2 + assert (result[0]["y"] == y).all() if __name__ == '__main__': diff --git a/tests/st/add/test_serving.py b/tests/st/add/test_serving.py index cdd731e..9a2349d 100644 --- a/tests/st/add/test_serving.py +++ b/tests/st/add/test_serving.py @@ -16,6 +16,7 @@ import os import sys import pytest +import numpy as np @pytest.mark.level0 @pytest.mark.platform_arm_ascend_training @@ -32,8 +33,8 @@ def test_serving(): folders += [os.path.join(folder, x) for x in os.listdir(folder) \ if os.path.isdir(os.path.join(folder, x)) and \ '/site-packages/mindspore' in os.path.join(folder, x)] - os.system(f"sh {sh_path}/add.sh {folders[0].split('mindspore', 1)[0] + 'mindspore'}") - #assert np.allclose(ret, 0, 0.0001, 0.0001) + ret = os.system(f"sh {sh_path}/add.sh {folders[0].split('mindspore', 1)[0] + 'mindspore'}") + assert np.allclose(ret, 0) if __name__ == '__main__': test_serving()