Debian Codegraph @

test/integration/targets/fork_safe_stdio/runme.sh

raw
1 #!/usr/bin/env bash
2
3 set -eu
4
5 echo "testing optional pty inheritance"
6
7 python run-with-pty.py ansible-playbook test_pty_inherit.yml
8
9 echo "testing for stdio deadlock on forked workers (10s timeout)..."
10
11 # Enable a callback that trips deadlocks on forked-child stdout, time out after 10s; forces running
12 # in a pty, since that tends to be much slower than raw file I/O and thus more likely to trigger the deadlock.
13 # Redirect stdout to /dev/null since it's full of non-printable garbage we don't want to display unless it failed
14 ANSIBLE_CALLBACKS_ENABLED=spewstdio SPEWSTDIO_ENABLED=1 python run-with-pty.py ../test_utils/scripts/timeout.py -- 10 ansible-playbook -i hosts -f 5 test.yml > stdout.txt && RC=$? || RC=$?
15
16 if [ "${RC}" != 0 ]; then
17 echo "failed; likely stdout deadlock. dumping raw output (may be very large)"
18 cat stdout.txt
19 exit 1
20 fi
21
22 grep -q -e "spewstdio STARTING NONPRINTING SPEW ON BACKGROUND THREAD" stdout.txt || (echo "spewstdio callback was not enabled"; exit 1)
23
24 echo "PASS"