Debian Codegraph @

tests/proxy-tests.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 # Proxy test: starts a backend server, a proxy server, and a client.
4 # The client talks to the proxy, which forwards to the backend.
5
6 client_log=proxy-test-client.log
7 proxy_log=proxy-test-server.log
8 server_log=proxy-test-backend.log
9
10 rmscip-shell system . . rm. -f $client_log $proxy_log $server_log
11
12 echoscip-shell system . . echo. "Starting backend server on port 1502"
13 ./unit-test-server > $server_log 2>&1 &
14 server_pid=$!
15
16 sleepscip-shell system . . sleep. 1
17
18 echoscip-shell system . . echo. "Starting proxy server on port 1503"
19 ./proxy-test-server > $proxy_log 2>&1 &
20 proxy_pid=$!
21
22 sleepscip-shell system . . sleep. 1
23
24 echoscip-shell system . . echo. "Starting proxy test client"
25 ./proxy-test-client > $client_log 2>&1
26 rc=$?
27
28 killscip-shell system . . kill. $proxy_pid 2>/dev/nullscip-shell filesystem . . `/dev/null`.
29 killscip-shell system . . kill. $server_pid 2>/dev/nullscip-shell filesystem . . `/dev/null`.
30 wait $proxy_pid 2>/dev/nullscip-shell filesystem . . `/dev/null`.
31 wait $server_pid 2>/dev/nullscip-shell filesystem . . `/dev/null`.
32
33 if [scip-shell system . . `[`. $rc -ne 0 ]; then
34 echoscip-shell system . . echo. "PROXY TESTS FAILED"
35 echoscip-shell system . . echo. "--- Client log ---"
36 catscip-shell system . . cat. $client_log
37 echoscip-shell system . . echo. "--- Proxy log ---"
38 catscip-shell system . . cat. $proxy_log
39 echoscip-shell system . . echo. "--- Backend log ---"
40 catscip-shell system . . cat. $server_log
41 fi
42
43 exit $rc