diff --git a/qa/L0_data_compression/test.sh b/qa/L0_data_compression/test.sh index 28255f5f7b..cb7766bdc6 100755 --- a/qa/L0_data_compression/test.sh +++ b/qa/L0_data_compression/test.sh @@ -70,7 +70,37 @@ fi set -e # End-to-end testing with simple model +function run_data_compression_infer_client() { + local client_path=$1 + local request_algorithm=$2 + local response_algorithm=$3 + local log_path=$4 + + local python_or_cpp=`echo -n "$client_path" | tail -c 3` + if [ "$python_or_cpp" == ".py" ]; then + local infer_client="python $client_path" + local request_algorithm_parameter="--request-compression-algorithm $request_algorithm" + local response_algorithm_parameter="--response-compression-algorithm $response_algorithm" + else # C++ + local infer_client=$client_path + local request_algorithm_parameter="-i $request_algorithm" + local response_algorithm_parameter="-o $response_algorithm" + fi + + if [ "$request_algorithm" != "" ] && [ "$response_algorithm" == "" ]; then + $infer_client -v $request_algorithm_parameter >> $log_path 2>&1 + return $? + fi + if [ "$request_algorithm" == "" ] && [ "$response_algorithm" != "" ]; then + $infer_client -v $response_algorithm_parameter >> $log_path 2>&1 + return $? + fi + $infer_client -v $request_algorithm_parameter $response_algorithm_parameter >> $log_path 2>&1 + return $? +} + SIMPLE_INFER_CLIENT_PY=../clients/simple_http_infer_client.py +SIMPLE_AIO_INFER_CLIENT_PY=../clients/simple_http_aio_infer_client.py SIMPLE_INFER_CLIENT=../clients/simple_http_infer_client CLIENT_LOG=`pwd`/client.log @@ -85,68 +115,22 @@ if [ "$SERVER_PID" == "0" ]; then exit 1 fi -set +e -# Test various combinations -python $SIMPLE_INFER_CLIENT_PY -v --request-compression-algorithm deflate >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -python $SIMPLE_INFER_CLIENT_PY -v --request-compression-algorithm gzip >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -python $SIMPLE_INFER_CLIENT_PY -v --response-compression-algorithm deflate >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -python $SIMPLE_INFER_CLIENT_PY -v --response-compression-algorithm gzip >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -python $SIMPLE_INFER_CLIENT_PY -v --request-compression-algorithm deflate --response-compression-algorithm gzip >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -python $SIMPLE_INFER_CLIENT_PY -v --request-compression-algorithm gzip --response-compression-algorithm deflate >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -$SIMPLE_INFER_CLIENT -v -i deflate >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -$SIMPLE_INFER_CLIENT -v -i gzip >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -$SIMPLE_INFER_CLIENT -v -o deflate >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -$SIMPLE_INFER_CLIENT -v -o gzip >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -$SIMPLE_INFER_CLIENT -v -i deflate -o gzip >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi - -$SIMPLE_INFER_CLIENT -v -i gzip -o deflate >> "${CLIENT_LOG}" 2>&1 -if [ $? -ne 0 ]; then - RET=1 -fi -set -e +for INFER_CLIENT in "$SIMPLE_INFER_CLIENT_PY" "$SIMPLE_AIO_INFER_CLIENT_PY" "$SIMPLE_INFER_CLIENT"; do + for REQUEST_ALGORITHM in "deflate" "gzip" ""; do + for RESPONSE_ALGORITHM in "deflate" "gzip" ""; do + if [ "$REQUEST_ALGORITHM" == "$RESPONSE_ALGORITHM" ]; then + continue + fi + + set +e + run_data_compression_infer_client "$INFER_CLIENT" "$REQUEST_ALGORITHM" "$RESPONSE_ALGORITHM" "$CLIENT_LOG" + if [ $? -ne 0 ]; then + RET=1 + fi + set -e + done + done +done kill $SERVER_PID wait $SERVER_PID