Skip to content

Commit 55b13f6

Browse files
authored
Add AsyncIO HTTP compression test (#6975)
* Add AsyncIO HTTP compression test * Improve command line option handling
1 parent 4aba07d commit 55b13f6

File tree

1 file changed

+46
-62
lines changed

1 file changed

+46
-62
lines changed

qa/L0_data_compression/test.sh

+46-62
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,37 @@ fi
7070
set -e
7171

7272
# End-to-end testing with simple model
73+
function run_data_compression_infer_client() {
74+
local client_path=$1
75+
local request_algorithm=$2
76+
local response_algorithm=$3
77+
local log_path=$4
78+
79+
local python_or_cpp=`echo -n "$client_path" | tail -c 3`
80+
if [ "$python_or_cpp" == ".py" ]; then
81+
local infer_client="python $client_path"
82+
local request_cmd_option="--request-compression-algorithm $request_algorithm"
83+
local response_cmd_option="--response-compression-algorithm $response_algorithm"
84+
else # C++ if not end with ".py"
85+
local infer_client=$client_path
86+
local request_cmd_option="-i $request_algorithm"
87+
local response_cmd_option="-o $response_algorithm"
88+
fi
89+
90+
local cmd_options="-v"
91+
if [ "$request_algorithm" != "" ]; then
92+
cmd_options+=" $request_cmd_option"
93+
fi
94+
if [ "$response_algorithm" != "" ]; then
95+
cmd_options+=" $response_cmd_option"
96+
fi
97+
98+
$infer_client $cmd_options >> $log_path 2>&1
99+
return $?
100+
}
101+
73102
SIMPLE_INFER_CLIENT_PY=../clients/simple_http_infer_client.py
103+
SIMPLE_AIO_INFER_CLIENT_PY=../clients/simple_http_aio_infer_client.py
74104
SIMPLE_INFER_CLIENT=../clients/simple_http_infer_client
75105

76106
CLIENT_LOG=`pwd`/client.log
@@ -85,68 +115,22 @@ if [ "$SERVER_PID" == "0" ]; then
85115
exit 1
86116
fi
87117

88-
set +e
89-
# Test various combinations
90-
python $SIMPLE_INFER_CLIENT_PY -v --request-compression-algorithm deflate >> "${CLIENT_LOG}" 2>&1
91-
if [ $? -ne 0 ]; then
92-
RET=1
93-
fi
94-
95-
python $SIMPLE_INFER_CLIENT_PY -v --request-compression-algorithm gzip >> "${CLIENT_LOG}" 2>&1
96-
if [ $? -ne 0 ]; then
97-
RET=1
98-
fi
99-
100-
python $SIMPLE_INFER_CLIENT_PY -v --response-compression-algorithm deflate >> "${CLIENT_LOG}" 2>&1
101-
if [ $? -ne 0 ]; then
102-
RET=1
103-
fi
104-
105-
python $SIMPLE_INFER_CLIENT_PY -v --response-compression-algorithm gzip >> "${CLIENT_LOG}" 2>&1
106-
if [ $? -ne 0 ]; then
107-
RET=1
108-
fi
109-
110-
python $SIMPLE_INFER_CLIENT_PY -v --request-compression-algorithm deflate --response-compression-algorithm gzip >> "${CLIENT_LOG}" 2>&1
111-
if [ $? -ne 0 ]; then
112-
RET=1
113-
fi
114-
115-
python $SIMPLE_INFER_CLIENT_PY -v --request-compression-algorithm gzip --response-compression-algorithm deflate >> "${CLIENT_LOG}" 2>&1
116-
if [ $? -ne 0 ]; then
117-
RET=1
118-
fi
119-
120-
$SIMPLE_INFER_CLIENT -v -i deflate >> "${CLIENT_LOG}" 2>&1
121-
if [ $? -ne 0 ]; then
122-
RET=1
123-
fi
124-
125-
$SIMPLE_INFER_CLIENT -v -i gzip >> "${CLIENT_LOG}" 2>&1
126-
if [ $? -ne 0 ]; then
127-
RET=1
128-
fi
129-
130-
$SIMPLE_INFER_CLIENT -v -o deflate >> "${CLIENT_LOG}" 2>&1
131-
if [ $? -ne 0 ]; then
132-
RET=1
133-
fi
134-
135-
$SIMPLE_INFER_CLIENT -v -o gzip >> "${CLIENT_LOG}" 2>&1
136-
if [ $? -ne 0 ]; then
137-
RET=1
138-
fi
139-
140-
$SIMPLE_INFER_CLIENT -v -i deflate -o gzip >> "${CLIENT_LOG}" 2>&1
141-
if [ $? -ne 0 ]; then
142-
RET=1
143-
fi
144-
145-
$SIMPLE_INFER_CLIENT -v -i gzip -o deflate >> "${CLIENT_LOG}" 2>&1
146-
if [ $? -ne 0 ]; then
147-
RET=1
148-
fi
149-
set -e
118+
for INFER_CLIENT in "$SIMPLE_INFER_CLIENT_PY" "$SIMPLE_AIO_INFER_CLIENT_PY" "$SIMPLE_INFER_CLIENT"; do
119+
for REQUEST_ALGORITHM in "deflate" "gzip" ""; do
120+
for RESPONSE_ALGORITHM in "deflate" "gzip" ""; do
121+
if [ "$REQUEST_ALGORITHM" == "$RESPONSE_ALGORITHM" ]; then
122+
continue
123+
fi
124+
125+
set +e
126+
run_data_compression_infer_client "$INFER_CLIENT" "$REQUEST_ALGORITHM" "$RESPONSE_ALGORITHM" "$CLIENT_LOG"
127+
if [ $? -ne 0 ]; then
128+
RET=1
129+
fi
130+
set -e
131+
done
132+
done
133+
done
150134

151135
kill $SERVER_PID
152136
wait $SERVER_PID

0 commit comments

Comments
 (0)