source: mod_gnutls/test/netns_py.bash

Last change on this file was 5058bee, checked in by Fiona Klute <fiona.klute@…>, 2 years ago

Run Python instances for tests without output buffering

This reduces (but does not completely avoid) reordering of lines in
test logs, making them easier to read.

  • Property mode set to 100755
File size: 1.1 KB
3# If USE_TEST_NAMESPACE is set and MGS_NETNS_ACTIVE is not, exec into
4# the Python interpreter with the given parameters inside a new
5# namespace with active loopback interface and MGS_NETNS_ACTIVE
6# defined.
8# This script can be used to isolate each testcase inside its own
9# network namespace. If USE_TEST_NAMESPACE is empty or unset this
10# script just execs into Python, so tests do not need to distinguish
11# whether to use namespaces (unless they have a separate reason to).
13# Note that once the network is up, the exec call is wrapped in
14# another user namespace to get rid of pseudo "root" access. The
15# reason for this is that Apache tries to switch permissions to a
16# non-root user when apparently started as root, and fails because no
17# such user exists inside the namespace. Changing to a non-root user
18# beforehand avoids the issue.
20if [ -n "${USE_TEST_NAMESPACE}" ] && [ -z "${MGS_NETNS_ACTIVE}" ]; then
21    exec "${UNSHARE}" --net --ipc -r /bin/bash -c \
22         "export MGS_NETNS_ACTIVE=1; ip link set up lo; exec ${UNSHARE} --user ${PYTHON} -u ${*}"
24    exec ${PYTHON} -u "${@}"
Note: See TracBrowser for help on using the repository browser.