From a26dd9c19fe56aa6649584d63e2671099554bd29 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 18 Apr 2023 16:32:24 +0200 Subject: [PATCH] src/net: install tests to target /usr/share/net Host tools and target are often out of sync, sometimes because we need to run a newer version of iproute2 with more features. By installing tests to target we can still verify basic functionality, provided the tests verify their dependencies and exit 77 (SKIP). Signed-off-by: Joachim Wiberg --- src/net/test/Makefile.am | 4 +++- src/net/test/lib.sh | 14 ++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/net/test/Makefile.am b/src/net/test/Makefile.am index b85a7c0d..640c757d 100644 --- a/src/net/test/Makefile.am +++ b/src/net/test/Makefile.am @@ -1,6 +1,8 @@ EXTRA_DIST = lib.sh $(TESTS) -CLEANFILES = *~ *.trs *.log +pkgdata_DATA = $(EXTRA_DIST) TEST_EXTENSIONS = .sh TESTS_ENVIRONMENT = unshare -mrun TESTS = three-independent.sh + +CLEANFILES = *~ *.trs *.log diff --git a/src/net/test/lib.sh b/src/net/test/lib.sh index 413e9a2b..634d11d8 100755 --- a/src/net/test/lib.sh +++ b/src/net/test/lib.sh @@ -19,6 +19,9 @@ export NET_DIR gen=-1 +NET=$(command -v net) +[ -n "$NET" ] || NET=../src/net + # Exit immediately on error, treat unset variables as error set -eu @@ -115,10 +118,11 @@ netdo() { if [ -n "$DEBUG" ]; then tree "$NET_DIR/" - echo "Calling: ../src/net $DEBUG apply" + echo "Calling: $NET $DEBUG apply" fi - ../src/net $DEBUG apply + # shellcheck disable=SC2086 + $NET $DEBUG apply if [ -n "$DEBUG" ]; then ip link @@ -129,7 +133,8 @@ netdo() netdown() { - ../src/net $DEBUG down $@ + # shellcheck disable=SC2086,SC2068 + $NET $DEBUG down $@ if [ -n "$DEBUG" ]; then ip link @@ -139,7 +144,8 @@ netdown() netup() { - ../src/net $DEBUG up $@ + # shellcheck disable=SC2086,SC2068 + $NET $DEBUG up $@ if [ -n "$DEBUG" ]; then ip link