From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,MISSING_DATE,MISSING_MID, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 From: "Leonid Krivoshein" To: make-initrd@lists.altlinux.org Subject: [make-initrd] [PATCH v6 13/22] bootchain-core: introduces new parameter bc_test X-BeenThere: make-initrd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: make-initrd@lists.altlinux.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Sun, 24 Oct 2021 17:21:59 -0000 X-List-Received-Date: Sun, 24 Oct 2021 17:21:59 -0000 Message-ID: <20211024172159.1ypMmtzrbJkE6DecVRjezz66IqDBPtUZ_y_MJp7jwf4@z> Archived-At: List-Archive: 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 --- 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