File tree Expand file tree Collapse file tree 3 files changed +19
-5
lines changed
Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 6868 "test-server" : " echo \" Running Test Server\" && php -S localhost:8000 -t tests/server/" ,
6969 "test-server-v2" : " echo \" Running Test Server\" && php -S localhost:8000 -t tests/server-v2/" ,
7070 "test-coverage:win" : " del clover.xml && phpunit --coverage-html=coverage --coverage-clover=clover.xml && coverage-check clover.xml 100" ,
71+ "test-performance" : [
72+ " echo \" Running Performance Tests...\" " ,
73+ " php -S localhost:8077 -t tests/performance/ > /dev/null 2>&1 & echo $! > server.pid" ,
74+ " sleep 2" ,
75+ " bash tests/performance/performance_tests.sh" ,
76+ " kill `cat server.pid`" ,
77+ " rm server.pid" ,
78+ " echo \" Performance Tests Completed.\" "
79+ ],
7180 "lint" : " phpstan --no-progress --memory-limit=256M -cphpstan.neon" ,
7281 "beautify" : " phpcbf --standard=phpcs.xml" ,
7382 "phpcs" : " phpcs --standard=phpcs.xml -n" ,
Original file line number Diff line number Diff line change 22
33declare (strict_types=1 );
44
5- require __DIR__ . '/vendor/autoload.php ' ;
5+ require __DIR__ . '/../../ vendor/autoload.php ' ;
66
77// Route to list all available test routes
88Flight::route ('GET / ' , function () {
Original file line number Diff line number Diff line change 11#! /bin/bash
22
33# Allow URL to be set via environment variable or first command-line argument, default to localhost for safety
4- URL=" ${URL:- ${1:- http:// localhost: 8080 / test-static} } "
4+ URL=" ${URL:- ${1:- http:// localhost: 8077 / test-static} } "
55REQUESTS=1000
66CONCURRENCY=10
77ITERATIONS=10
@@ -24,15 +24,20 @@ echo "----------------------------------------"
2424
2525for i in $( seq 1 $ITERATIONS ) ; do
2626 printf " Run %2d/%d: " $i $ITERATIONS
27-
27+
2828 # Run ab and extract time per request
2929 result=$( ab -n $REQUESTS -c $CONCURRENCY $URL 2> /dev/null)
3030 time_per_request=$( echo " $result " | grep " Time per request:" | head -1 | awk ' {print $4}' )
3131 requests_per_sec=$( echo " $result " | grep " Requests per second:" | awk ' {print $4}' )
32-
32+
33+ if [[ -z " $time_per_request " || ! " $time_per_request " =~ ^[0-9.]+$ ]]; then
34+ echo " Warning: Could not parse time per request (ab output may be malformed)"
35+ continue
36+ fi
37+
3338 times+=($time_per_request )
3439 total=$( echo " $total + $time_per_request " | bc -l)
35-
40+
3641 printf " %.3f ms (%.2f req/s)\n" $time_per_request $requests_per_sec
3742done
3843
You can’t perform that action at this time.
0 commit comments