• Simon McVittie's avatar
    test: Skip TCP tests if getaddrinfo doesn't work · 42772170
    Simon McVittie authored
    For example, this can be the case in bubblewrap or Debian pbuilder after
    unsharing the network namespace:
    
        bwrap \
        --bind / / \
        --dev-bind /dev /dev \
        --bind /dev/shm /dev/shm \
        --bind /dev/pts /dev/pts \
        --unshare-net \
        ${builddir}/test/test-loopback --tap
        ...
        ok 1 /connect/tcp # SKIP Name resolution does not work here:
        getaddrinfo("127.0.0.1", "0", {flags=ADDRCONFIG, family=INET,
        socktype=STREAM, protocol=TCP}): Name or service not known
    
    On some systems this can be circumvented by using nss_wrapper from
    <https://cwrap.org/nss_wrapper.html>:
    
        cat > hosts <<EOF
        127.0.0.1 localhost
        EOF
        bwrap \
        ... \
        env \
        LD_PRELOAD=libnss_wrapper.so \
        NSS_WRAPPER_HOSTS=$(pwd)/hosts \
        ${builddir}/test/test-loopback --tap
        ...
        # listening at tcp:host=127.0.0.1,port=39219,family=ipv4,guid=...
    
    but for systems where that does't work, we should be prepared to skip
    the affected tests.
    Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
    Reviewed-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106812
    (cherry picked from commit f1faafd5)
    42772170
Name
Last commit
Last update
..
data Loading commit data...
integration Loading commit data...
internals Loading commit data...
name-test Loading commit data...
.gitignore Loading commit data...
Makefile.am Loading commit data...
corrupt.c Loading commit data...
dbus-daemon-eavesdrop.c Loading commit data...
dbus-daemon.c Loading commit data...
dbus-test-runner Loading commit data...
fdpass.c Loading commit data...
glib-tap-test.sh Loading commit data...
loopback.c Loading commit data...
manual-authz.c Loading commit data...
manual-backtrace.c Loading commit data...
manual-dir-iter.c Loading commit data...
manual-paths.c Loading commit data...
manual-tcp.c Loading commit data...
marshal.c Loading commit data...
message.c Loading commit data...
monitor.c Loading commit data...
relay.c Loading commit data...
sd-activation.c Loading commit data...
shell-test.c Loading commit data...
spawn-test.c Loading commit data...
syntax.c Loading commit data...
tap-test.sh.in Loading commit data...
test-apparmor-activation.sh Loading commit data...
test-dbus-daemon-fork.sh Loading commit data...
test-dbus-launch-eval.sh Loading commit data...
test-dbus-launch-x11.sh Loading commit data...
test-exit.c Loading commit data...
test-names.c Loading commit data...
test-segfault.c Loading commit data...
test-service.c Loading commit data...
test-shell-service.c Loading commit data...
test-sleep-forever.c Loading commit data...
test-utils-glib.c Loading commit data...
test-utils-glib.h Loading commit data...
test-utils.c Loading commit data...
test-utils.h Loading commit data...
thread-blocking.c Loading commit data...
uid-permissions.c Loading commit data...