From 7294ce61bc701681f368f849a2d0e9356a175970 Mon Sep 17 00:00:00 2001 From: Václav Kadlčík Date: Jan 22 2021 11:22:21 +0000 Subject: Make some CI test code optional The only present test case rebuilt, installed and booted the kernel. Now let's make the install and boot steps optional, just on explicit request. Skipping these steps will be the default behaviour, at least for now. You can override the default by setting variable "JUST_BUILD" in the environment the test runs in. The variable defaults to "yes" which means the test will just build the kernel. If you use JUST_BUILD=no (or JUST_BUILD=false or JUST_BUILD=0) then the test will not only build but install and boot the kernel, too. Note that the acceptable values of JUST_BUILD are case insensitive. --- diff --git a/tests/Sanity/rebuild-kernel-and-reboot/runtest.sh b/tests/Sanity/rebuild-kernel-and-reboot/runtest.sh index 76efb5f..4d21337 100755 --- a/tests/Sanity/rebuild-kernel-and-reboot/runtest.sh +++ b/tests/Sanity/rebuild-kernel-and-reboot/runtest.sh @@ -28,6 +28,15 @@ export AVC_ERROR='+no_avc_check' +case "$JUST_BUILD" in + 0|[Ff][Aa][Ll][Ss][Ee]|[Nn][Oo]) + JUST_BUILD=no + ;; + *) + JUST_BUILD=yes + ;; +esac + LD="${LD:-$(which ld)}" GCC="${GCC:-$(which gcc)}" @@ -54,6 +63,7 @@ rlJournalStart rlLogInfo "PACKAGES=$PACKAGES" rlLogInfo "KERNEL=$KERNEL" rlLogInfo "REQUIRES=$REQUIRES" + rlLogInfo "JUST_BUILD=$JUST_BUILD" rlLogInfo "COLLECTIONS=$COLLECTIONS" rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK" @@ -130,8 +140,8 @@ rlJournalStart rlBundleLogs "Build-log" BUILD_LOG rlPhaseEnd - # Only install new kernel and reboot if the kernel build went successful - if [ "$RPMBUILD_OK" = "yes" ]; then + # Install and boot the new kernel only if it's requested *and* the build was successful + if [ "$JUST_BUILD" = 'no' ] && [ "$RPMBUILD_OK" = "yes" ]; then rlPhaseStartTest "Install" RPMS="$(ls -1 $TmpDir/RPMS/*/*.rpm | grep -v kernel-selftests-internal | tr '\n' ' ')" @@ -162,10 +172,16 @@ rlJournalStart fi fi - rlPhaseStartTest "Test" - rlLogInfo "$(uname -a)" - rlRun "uname -r | grep $RPM_BUILD_ID" - rlPhaseEnd + # Verify the build ID only if its install and boot were requested + if [ "$JUST_BUILD" = 'no' ]; then + rlPhaseStartTest "Test" + if ! [ "$AFTER_REBOOT" = 'yes' ]; then + rlFail 'Not rebooted. Probably rhts-reboot did not work.' + fi + rlLogInfo "$(uname -a)" + rlRun "uname -r | grep $RPM_BUILD_ID" + rlPhaseEnd + fi rlPhaseStartCleanup rlPhaseEnd