[make-initrd] [PATCH v6 13/22] bootchain-core: introduces new parameter bc_test
Leonid Krivoshein
klark.devel at gmail.com
Sun Oct 24 20:21:59 MSK 2021
Enabling the bc_test option allows the boot log to be saved to the stage2
even when extended debugging has not been enabled. It will be possible to
examine the contents of the boot log without additional debugging messages.
Signed-off-by: Leonid Krivoshein <klark.devel at gmail.com>
---
features/bootchain-core/README.md | 4 ++++
.../data/etc/initrd/cmdline.d/bootchain-core | 1 +
features/bootchain-core/data/sbin/chaind | 8 +++++++-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/features/bootchain-core/README.md b/features/bootchain-core/README.md
index cea2d84..14db55f 100644
--- a/features/bootchain-core/README.md
+++ b/features/bootchain-core/README.md
@@ -108,6 +108,10 @@ own needs.
- `overlayfs=list` - defines the list of elements to combine.
- `bc_debug` - a boolean parameter that enables advanced debugging and forces
if the daemon completes successfully, copy boot log to the stage2.
+- `bc_test=name` - defines the name of the current test case in the process of
+ fully automated self-testing, forcing in case of successful after completing
+ the daemon, copy the boot log to the stage2 and next to it create a
+ `BC-TEST.passed` file with the specified name of the test case.
## bootchain-sh-functions extended API
diff --git a/features/bootchain-core/data/etc/initrd/cmdline.d/bootchain-core b/features/bootchain-core/data/etc/initrd/cmdline.d/bootchain-core
index 4151a8d..d397f86 100644
--- a/features/bootchain-core/data/etc/initrd/cmdline.d/bootchain-core
+++ b/features/bootchain-core/data/etc/initrd/cmdline.d/bootchain-core
@@ -1,5 +1,6 @@
register_parameter string BOOTCHAIN
register_alias BOOTCHAIN PIPELINE
+register_parameter string BC_TEST
register_parameter bool BC_DEBUG
register_array string MOUNTFS
register_array string OVERLAYFS
diff --git a/features/bootchain-core/data/sbin/chaind b/features/bootchain-core/data/sbin/chaind
index ec4458e..c1b2451 100755
--- a/features/bootchain-core/data/sbin/chaind
+++ b/features/bootchain-core/data/sbin/chaind
@@ -115,12 +115,18 @@ else
debug "last step finished with exit code $rc"
fi
-if [ -f "$BC_LOGFILE" ] && [ -n "$BC_DEBUG" ]; then
+if [ -f "$BC_LOGFILE" ] && [ -n "${BC_DEBUG}${BC_TEST-}" ]; then
if [ -d "$rootmnt/var/log" ]; then
destdir="$rootmnt/var/log"
else
run mkdir -p -- "$mntdir"
destdir="$mntdir"
fi
+
+ if [ -n "${BC_TEST-}" ]; then
+ debug "test '$BC_TEST' in the stage1 passed"
+ echo "$BC_TEST" >"$destdir"/BC-TEST.passed
+ fi
+
run cp -Lf -- "$BC_LOGFILE" "$destdir/"
fi
--
2.24.1
More information about the Make-initrd
mailing list