summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.de.marchi@gmail.com>2023-02-09 11:19:45 -0800
committerLucas De Marchi <lucas.de.marchi@gmail.com>2023-02-10 14:27:27 -0800
commit184a070733c0055a9cad15fcad57a264910a64ff (patch)
treec44b044e3e8b4dd91c44ebf86bb3a9304019e545
parentb9605c63b859adfffc0b4b9420d720aa323b90e9 (diff)
downloadkmod-184a070733c0055a9cad15fcad57a264910a64ff.tar.gz
kmod-184a070733c0055a9cad15fcad57a264910a64ff.tar.bz2
kmod-184a070733c0055a9cad15fcad57a264910a64ff.zip
testsuite: Move setup-rootfs logic from Makefile to script
It's easier to implement the logic outside of the Makefile, so rename the populate-modules.sh script to setup-rootfs.sh and move the additional logic from the makefile to the script. Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r--Makefile.am10
-rwxr-xr-xtestsuite/setup-rootfs.sh (renamed from testsuite/populate-modules.sh)19
2 files changed, 19 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am
index b0a654c..021b315 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -239,18 +239,12 @@ endif
# TESTSUITE
# ------------------------------------------------------------------------------
-EXTRA_DIST += testsuite/populate-modules.sh
+EXTRA_DIST += testsuite/setup-rootfs.sh
MODULE_PLAYGROUND = testsuite/module-playground
ROOTFS = testsuite/rootfs
ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine
-CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && mkdir -p $(dir $(ROOTFS)) && \
- cp -r $(ROOTFS_PRISTINE) $(ROOTFS) && \
- find $(ROOTFS) -type d -exec chmod +w {} \; && \
- find $(ROOTFS) -type f -name .gitignore -exec rm -f {} \; && \
- $(top_srcdir)/testsuite/populate-modules.sh \
- $(MODULE_PLAYGROUND) $(ROOTFS) $(top_builddir)/config.h ) && \
- touch testsuite/stamp-rootfs
+CREATE_ROOTFS = $(AM_V_GEN) $(top_srcdir)/testsuite/setup-rootfs.sh $(ROOTFS_PRISTINE) $(ROOTFS) $(MODULE_PLAYGROUND) $(top_builddir)/config.h
build-module-playground:
$(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \
diff --git a/testsuite/populate-modules.sh b/testsuite/setup-rootfs.sh
index 5009cac..d155a30 100755
--- a/testsuite/populate-modules.sh
+++ b/testsuite/setup-rootfs.sh
@@ -2,9 +2,20 @@
set -e
-MODULE_PLAYGROUND=$1
+ROOTFS_PRISTINE=$1
ROOTFS=$2
-CONFIG_H=$3
+MODULE_PLAYGROUND=$3
+CONFIG_H=$4
+
+# create rootfs from rootfs-pristine
+
+create_rootfs() {
+ rm -rf "$ROOTFS"
+ mkdir -p $(dirname "$ROOTFS")
+ cp -r "$ROOTFS_PRISTINE" "$ROOTFS"
+ find "$ROOTFS" -type d -exec chmod +w {} \;
+ find "$ROOTFS" -type f -name .gitignore -exec rm -f {} \;
+}
feature_enabled() {
local feature=$1
@@ -99,6 +110,8 @@ attach_pkcs7_array=(
"test-modinfo/mod-simple-pkcs7.ko"
)
+create_rootfs
+
for k in "${!map[@]}"; do
dst=${ROOTFS}/$k
src=${MODULE_PLAYGROUND}/${map[$k]}
@@ -143,3 +156,5 @@ done
for m in "${attach_pkcs7_array[@]}"; do
cat "${MODULE_PLAYGROUND}/dummy.pkcs7" >>"${ROOTFS}/$m"
done
+
+touch testsuite/stamp-rootfs