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.
This commit is contained in:
Václav Kadlčík 2021-01-22 12:22:21 +01:00
parent 4db8f84f7e
commit 7294ce61bc

View File

@ -28,6 +28,15 @@
export AVC_ERROR='+no_avc_check' 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)}" LD="${LD:-$(which ld)}"
GCC="${GCC:-$(which gcc)}" GCC="${GCC:-$(which gcc)}"
@ -54,6 +63,7 @@ rlJournalStart
rlLogInfo "PACKAGES=$PACKAGES" rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "KERNEL=$KERNEL" rlLogInfo "KERNEL=$KERNEL"
rlLogInfo "REQUIRES=$REQUIRES" rlLogInfo "REQUIRES=$REQUIRES"
rlLogInfo "JUST_BUILD=$JUST_BUILD"
rlLogInfo "COLLECTIONS=$COLLECTIONS" rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK" rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
@ -130,8 +140,8 @@ rlJournalStart
rlBundleLogs "Build-log" BUILD_LOG rlBundleLogs "Build-log" BUILD_LOG
rlPhaseEnd rlPhaseEnd
# Only install new kernel and reboot if the kernel build went successful # Install and boot the new kernel only if it's requested *and* the build was successful
if [ "$RPMBUILD_OK" = "yes" ]; then if [ "$JUST_BUILD" = 'no' ] && [ "$RPMBUILD_OK" = "yes" ]; then
rlPhaseStartTest "Install" rlPhaseStartTest "Install"
RPMS="$(ls -1 $TmpDir/RPMS/*/*.rpm | grep -v kernel-selftests-internal | tr '\n' ' ')" RPMS="$(ls -1 $TmpDir/RPMS/*/*.rpm | grep -v kernel-selftests-internal | tr '\n' ' ')"
@ -162,10 +172,16 @@ rlJournalStart
fi fi
fi fi
rlPhaseStartTest "Test" # Verify the build ID only if its install and boot were requested
rlLogInfo "$(uname -a)" if [ "$JUST_BUILD" = 'no' ]; then
rlRun "uname -r | grep $RPM_BUILD_ID" rlPhaseStartTest "Test"
rlPhaseEnd 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 rlPhaseStartCleanup
rlPhaseEnd rlPhaseEnd