File tree Expand file tree Collapse file tree 4 files changed +24
-3
lines changed
Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 4545 run : cmake --build build --config RelWithDebInfo
4646
4747 - name : Run test http server
48- run : python3 -m http.server 8080 &
48+ run : ./pac_server.sh
4949 working-directory : test
5050
5151 - name : Run tests
Original file line number Diff line number Diff line change 8181 run : cmake --build build --config RelWithDebInfo
8282
8383 - name : Run test http server
84- run : python3 -m http.server 8080 &
84+ run : ./pac_server.sh
8585 working-directory : test
8686
8787 - name : Run tests
Original file line number Diff line number Diff line change 7171
7272 - name : Run test http server
7373 shell : bash
74- run : python3 -m http.server 8080 &
74+ run : ./pac_server.sh
7575 working-directory : test
7676
7777 - name : Run tests
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ # Start an HTTP server and wait until it is ready to accept connections.
3+
4+ PORT=" ${1:- 8080} "
5+ MAX_ATTEMPTS=30
6+
7+ python3 -m http.server " $PORT " &
8+ SERVER_PID=$!
9+
10+ for i in $( seq 1 " $MAX_ATTEMPTS " ) ; do
11+ if curl -sSf " http://127.0.0.1:$PORT /" > /dev/null 2>&1 ; then
12+ echo " HTTP server is ready on port $PORT (pid $SERVER_PID )"
13+ exit 0
14+ fi
15+ echo " Waiting for HTTP server (attempt $i /$MAX_ATTEMPTS )..."
16+ sleep 1
17+ done
18+
19+ echo " HTTP server failed to start on port $PORT " >&2
20+ kill " $SERVER_PID " 2> /dev/null
21+ exit 1
You can’t perform that action at this time.
0 commit comments