From: Emil Velikov Date: Mon, 2 Sep 2024 17:58:35 +0000 (+0100) Subject: testsuite: split out setup-modules.sh X-Git-Tag: v34~467 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=59f40b82252a49ddd8ad7f8ce4234fad5d54b520;p=thirdparty%2Fkmod.git testsuite: split out setup-modules.sh So that we can reuse it from the upcoming meson build. v2: - shellcheck fixes, add TODO, move to scripts/ v3: - set MAKEFLAGS="-j$(nproc)" if empty Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/86 Signed-off-by: Lucas De Marchi --- diff --git a/Makefile.am b/Makefile.am index 92f9dff7..3975074e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -163,20 +163,17 @@ endif # TESTSUITE # ------------------------------------------------------------------------------ +EXTRA_DIST += scripts/setup-modules.sh EXTRA_DIST += scripts/setup-rootfs.sh MODULE_PLAYGROUND = testsuite/module-playground +BUILD_MODULES = $(AM_V_GEN) $(top_srcdir)/scripts/setup-modules.sh $(top_srcdir) $(top_builddir) $(MODULE_PLAYGROUND) $(module_directory) ROOTFS = testsuite/rootfs ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine CREATE_ROOTFS = $(AM_V_GEN) $(top_srcdir)/scripts/setup-rootfs.sh $(ROOTFS_PRISTINE) $(ROOTFS) $(MODULE_PLAYGROUND) $(top_builddir)/config.h $(sysconfdir) $(module_directory) build-module-playground: - $(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \ - $(RM) -rf testsuite/module-playground && \ - mkdir -p testsuite/ && \ - cp -r $(top_srcdir)/$(MODULE_PLAYGROUND) $(top_builddir)/$(MODULE_PLAYGROUND); \ - fi - MODULE_DIRECTORY=$(module_directory) $(MAKE) -C $(MODULE_PLAYGROUND) + $(BUILD_MODULES) rootfs: build-module-playground diff --git a/scripts/setup-modules.sh b/scripts/setup-modules.sh new file mode 100755 index 00000000..4996b649 --- /dev/null +++ b/scripts/setup-modules.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -euo pipefail + +SRCDIR=$1 +BUILDDIR=$2 +MODULE_PLAYGROUND=$3 +# shellcheck disable=SC2034 # used by the Makefile +export MODULE_DIRECTORY=$4 + +# TODO: meson allows only out of tree builds +if test "$SRCDIR" != "$BUILDDIR"; then + rm -rf "$MODULE_PLAYGROUND" + mkdir -p "$(dirname "$MODULE_PLAYGROUND")" + cp -r "$SRCDIR/$MODULE_PLAYGROUND" "$MODULE_PLAYGROUND" +fi + +export MAKEFLAGS=${MAKEFLAGS-"-j$(nproc)"} +"${MAKE-make}" -C "$PWD/$MODULE_PLAYGROUND" modules