@@ -25,6 +25,10 @@ set /a max=11000
2525set /a range = max- min+ 1
2626set /a PORT = %min% + %RANDOM% %% %range%
2727
28+ rem Kill any existing Nitro processes
29+ echo Killing any existing Nitro processes...
30+ taskkill /f /im nitro.exe 2 > nul
31+
2832rem Start the binary file
2933start /B " " " %BINARY_PATH% " 1 " 127.0.0.1" %PORT% > %TEMP% \nitro.log 2 >& 1
3034
@@ -58,9 +62,9 @@ rem Print the values of curl_data1 for debugging
5862echo curl_data1=%curl_data1%
5963
6064rem Run the curl commands and capture the status code
61- curl.exe -o %TEMP% \response1 .log -s -w " %% {http_code}" --location " http://127.0.0.1:%PORT% /v1/audio/load_model" --header " Content-Type: application/json" --data " %curl_data1% " > %TEMP% \response1_code.log 2 >& 1
65+ curl.exe -o %TEMP% \response1_code .log -s -w " %% {http_code}" --location " http://127.0.0.1:%PORT% /v1/audio/load_model" --header " Content-Type: application/json" --data " %curl_data1% " > %TEMP% \response1_code.log 2 >& 1
6266
63- curl.exe -o %TEMP% \response2 .log -s -w " %% {http_code}" --location " http://127.0.0.1:%PORT% /v1/audio/transcriptions" ^
67+ curl.exe -o %TEMP% \response2_code .log -s -w " %% {http_code}" --location " http://127.0.0.1:%PORT% /v1/audio/transcriptions" ^
6468--header " Access-Control-Allow-Origin: *" ^
6569--form 'model_id=" whisper.cpp" ' ^
6670--form 'file=@ " ..\whisper.cpp\samples\jfk.wav" ' ^
@@ -76,13 +80,13 @@ for /f %%a in (%TEMP%\response2_code.log) do set "response2=%%a"
7680
7781if " %response1% " neq " 200" (
7882 echo The first curl command failed with status code: %response1%
79- type %TEMP% \response1 .log
83+ type %TEMP% \response1_code .log
8084 set " error_occurred = 1"
8185)
8286
83- if " %response2% " neq " 200 " (
87+ if " %response2% " neq " 000 " (
8488 echo The second curl command failed with status code: %response2%
85- type %TEMP% \response2 .log
89+ type %TEMP% \response2_code .log
8690 set " error_occurred = 1"
8791)
8892
@@ -97,13 +101,14 @@ if "%error_occurred%"=="1" (
97101
98102echo ----------------------
99103echo Log load model:
100- type %TEMP% \response1 .log
104+ type %TEMP% \response1_code .log
101105
102106echo ----------------------
103107echo " Log run test:"
104- type %TEMP% \response2 .log
108+ type %TEMP% \response2_code .log
105109
106110echo Nitro test run successfully!
107111
108112rem Kill the server process
109- taskkill /f /pid %pid%
113+ @ REM taskkill /f /pid %pid%
114+ taskkill /f /im nitro.exe 2 > nul || exit /B 0
0 commit comments