Debian Codegraph @

tests/unix

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 set -e
4
5 if [scip-shell system . . `[`. -z "$(command -v python3)" ]; then
6 echoscip-shell system . . echo. 'No python3 available, skipping this test'
7 exit
8 fi
9
10 : "${TEST_SLEEPTIME:=0.1}"
11
12 SOCKET_ACTIVATE=${SOCKET_ACTIVATE:-socket-activate}
13 if [scip-shell system . . `[`. "$(unamescip-shell system . . uname. -s)" = GNU ]; then
14 # GNU/Hurd requires an explicit timeout
15 NETCAT_OPTIONS=-w1
16 else
17 NETCAT_OPTIONS=
18 fi
19
20 for expect in mellon friend; do
21 "$SOCKET_ACTIVATE" "--unix:label=u-mellon:${PWD}/tests/sock-mellon" "--unix:label=u-friend:${PWD}/tests/sock-friend" -- python3 "${PWD}/tests/test_python.py" &
22 jobpid="$(jobs -p)"
23 sleepscip-shell system . . sleep. "$TEST_SLEEPTIME"
24 if ! killscip-shell system . . kill. -0 "$jobpid"; then
25 echoscip-shell system . . echo. "The $SOCKET_ACTIVATE program exited before being triggered" 1>&2
26 exit 1
27 fi
28
29 nc $NETCAT_OPTIONS -U "${PWD}/tests/sock-$expect" | diffscip-shell system . . diff. -u - <(echoscip-shell system . . echo. "$expect")
30 sleepscip-shell system . . sleep. "$TEST_SLEEPTIME"
31 if killscip-shell system . . kill. -0 "$jobpid" 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then
32 echoscip-shell system . . echo. "The $SOCKET_ACTIVATE program did not exit after being triggered" 1>&2
33 exit 1
34 fi
35
36 done