From 05182d0bb05b7e21a6a154a9ac0f9a88b0493e0c Mon Sep 17 00:00:00 2001 From: qiukeren Date: Thu, 4 Jun 2020 16:05:50 +0800 Subject: [PATCH 1/3] fix benchmark script sed error when worker_processes=auto --- benchmark/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/run.sh b/benchmark/run.sh index ff068d64f57b..54ea164fce83 100755 --- a/benchmark/run.sh +++ b/benchmark/run.sh @@ -36,7 +36,7 @@ function onCtrlC () { sudo openresty -p $PWD/benchmark/server -s stop || exit 1 } -sed -i "s/worker_processes [0-9]*/worker_processes $worker_cnt/g" conf/nginx.conf +sed -i "s/worker_processes .*/worker_processes $worker_cnt/g" conf/nginx.conf make run sleep 3 From 02496dd3275852658f4e3c99bfd5159fd8180254 Mon Sep 17 00:00:00 2001 From: qiukeren Date: Thu, 4 Jun 2020 16:06:31 +0800 Subject: [PATCH 2/3] fix benchmark script osx compatibility --- benchmark/run.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/benchmark/run.sh b/benchmark/run.sh index 54ea164fce83..c41b554d2ce5 100755 --- a/benchmark/run.sh +++ b/benchmark/run.sh @@ -36,7 +36,12 @@ function onCtrlC () { sudo openresty -p $PWD/benchmark/server -s stop || exit 1 } -sed -i "s/worker_processes .*/worker_processes $worker_cnt/g" conf/nginx.conf +if [[ "$(uname)" == "Darwin" ]]; then + sed -i "" "s/worker_processes .*/worker_processes $worker_cnt;/g" conf/nginx.conf +else + sed -i "s/worker_processes .*/worker_processes $worker_cnt;/g" conf/nginx.conf +fi + make run sleep 3 From c0ec411012b40fccf4d2581dd79013b7d757066d Mon Sep 17 00:00:00 2001 From: qiukeren Date: Thu, 4 Jun 2020 16:46:51 +0800 Subject: [PATCH 3/3] fix apisix reload OSX compatibility --- bin/apisix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/apisix b/bin/apisix index 98039a2d324d..49c43edf5d1d 100755 --- a/bin/apisix +++ b/bin/apisix @@ -838,13 +838,17 @@ end function _M.reload() local test_cmd = openresty_args .. [[ -t -q ]] - if os.execute((test_cmd)) ~= 0 then + -- When success, + -- On linux, os.execute returns 0, + -- On macos, os.execute returns 3 values: true, exit, 0, and we need the first. + local test_ret = os.execute((test_cmd)) + if (test_ret == 0 or test_ret == true) then + local cmd = openresty_args .. [[ -s reload]] + -- print(cmd) + os.execute(cmd) return end - - local cmd = openresty_args .. [[ -s reload]] - -- print(cmd) - os.execute(cmd) + print("test openresty failed") end function _M.version()