Browse Source

fix st

tags/v1.1.0
zhangyinxia 5 years ago
parent
commit
2d36e173b8
3 changed files with 8 additions and 4 deletions
  1. +3
    -2
      tests/st/add/add.sh
  2. +2
    -0
      tests/st/add/client.py
  3. +3
    -2
      tests/st/add/test_serving.py

+ 3
- 2
tests/st/add/add.sh View File

@@ -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
}



+ 2
- 0
tests/st/add/client.py View File

@@ -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__':


+ 3
- 2
tests/st/add/test_serving.py View File

@@ -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()

Loading…
Cancel
Save