Skip to content

Commit

Permalink
[Bug Fix]Add check return code function (#581)
Browse files Browse the repository at this point in the history
* Fix release_task cpp_run.sh

 Author:    felixhjh <[email protected]>
 Date:      Thu Nov 10 07:26:48 2022 +0000

* Add option for infer_ppyoloe.cc

  author:    felixhjh <[email protected]>

* Fix bug in release task scripts

* Add error check function

* Format code

Co-authored-by: root <[email protected]>
  • Loading branch information
felixhjh and root authored Nov 14, 2022
1 parent 63b07f2 commit f42218a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/release_task/py_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,39 @@ elif [ "$DEVICE" = "cpu" ] && [ "$PLATFORM" = "osx-arm64" ];then
RUN_CASE=(${MACOS_ARM64_CPU_CASE[*]})
fi

ret=0
check_ret(){
if [ $? -ne 0 ];then
ret=-1
fi
}

case_number=${#RUN_CASE[@]}
py_version=$(python -V | awk '{print $2}')
echo "py_version:" $py_version
ret=0
for((j=0;j<case_number;j+=1))
do
backend=${RUN_CASE[j]}
echo "Python Backend:" $backend
if [ "$backend" != "trt" ];then
python infer_ppyoloe.py --model_dir $MODEL_PATH --image $IMAGE_PATH --device cpu --backend $backend >> py_$backend\_cpu_result.txt
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path py_$backend\_cpu_result.txt --platform $PLATFORM --device cpu
check_ret
fi
if [ "$DEVICE" = "gpu" ];then

if [ "$backend" = "trt" ];then
python infer_ppyoloe.py --model_dir $MODEL_PATH --image $IMAGE_PATH --device gpu --backend $backend >> py_trt_result.txt
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path py_trt_result.txt --platform $PLATFORM --device trt
check_ret
else
python infer_ppyoloe.py --model_dir $MODEL_PATH --image $IMAGE_PATH --device gpu --backend $backend >> py_$backend\_gpu_result.txt
python $COMPARE_SHELL --gt_path $GROUND_TRUTH_PATH --result_path py_$backend\_gpu_result.txt --platform $PLATFORM --device gpu
check_ret
fi
fi
if [ $? -ne 0 ];then
ret=-1
fi
done


res_file="result.txt"
if [ ! -f $res_file ];then
if [ $ret -ne 0 ];then
Expand Down

0 comments on commit f42218a

Please sign in to comment.