From 9df9fb79362ba2db5a6971d896ccd7d444ec2e98 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Wed, 16 Sep 2020 22:38:40 -0500 Subject: [PATCH] unit.test: add bwrap wrapper script at scripts/unit.test. --- Makefile.am | 1 + scripts/include.am | 2 ++ scripts/unit.test | 9 +++++++++ tests/include.am | 1 - 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 scripts/unit.test diff --git a/Makefile.am b/Makefile.am index 60a5a57ae..3b6da4bd2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -201,6 +201,7 @@ TESTS += $(check_SCRIPTS) test: check tests/unit.log: testsuite/testsuite.log +scripts/unit.log: testsuite/testsuite.log DISTCLEANFILES+= cyassl-config DISTCLEANFILES+= wolfssl-config diff --git a/scripts/include.am b/scripts/include.am index 2ad416b68..154547f2e 100644 --- a/scripts/include.am +++ b/scripts/include.am @@ -84,6 +84,8 @@ if BUILD_OCSP dist_noinst_SCRIPTS+= scripts/ocsp.test endif +dist_noinst_SCRIPTS+= scripts/unit.test + endif endif diff --git a/scripts/unit.test b/scripts/unit.test new file mode 100755 index 000000000..3881334a3 --- /dev/null +++ b/scripts/unit.test @@ -0,0 +1,9 @@ +#!/bin/sh + +DIRNAME="$(dirname "$0")" +bwrap_path="$(command -v bwrap)" +if [ -n "$bwrap_path" ]; then + exec "$bwrap_path" --unshare-net --dev-bind / / "$DIRNAME/../tests/unit.test" "$@" +else + exec "$DIRNAME/../tests/unit.test" "$@" +fi diff --git a/tests/include.am b/tests/include.am index 1ef0a7cdf..baf8ddb8f 100644 --- a/tests/include.am +++ b/tests/include.am @@ -4,7 +4,6 @@ if BUILD_TESTS -check_PROGRAMS += tests/unit.test noinst_PROGRAMS += tests/unit.test tests_unit_test_SOURCES = \ tests/unit.c \