#!/bin/sh
# Build and run the part of the upstream test suite that does NOT require a
# real tun device, network namespaces or root. These are the C unit tests and
# the cwrap-based (socket_wrapper / nss_wrapper / uid_wrapper / pam_wrapper)
# script tests, which fake the privileged environment in user space and so run
# on ordinary, non-isolated autopkgtest testbeds.
#
# The privileged tun / firewall / root tests live in the separate "upstream"
# test, which carries the isolation-machine restriction.
# Copyright (c) 2020 Aron Xu <aron@debian.org>

set -e

builddir="${AUTOPKGTEST_TMP:-.}/build"

# Disable the tests that need /dev/net/tun (tun-tests) and root / namespaces
# (root-tests); everything else still builds and runs.
meson setup "$builddir" \
	-Dsystemd=enabled \
	-Dlatency-stats=enabled \
	-Doidc-auth=enabled \
	-Dlocal-llhttp=false \
	-Dtun-tests=false \
	-Droot-tests=false
meson compile -C "$builddir"
meson test -C "$builddir" --print-errorlogs --timeout-multiplier 6
