[kde-linux/os-autoinst-distri-kdelinux] /: tests: verify that after upgrade old build is bootable

Bhushan Shah <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 66d97ea49f65b72747179a51db8d33a1e958b6b3 by Bhushan Shah.
Committed on 29/07/2026 at 04:22.
Pushed by bshah into branch 'master'.

tests: verify that after upgrade old build is bootable

- In verify_upgrade set the BOOT_PREVIOUS var, which makes bootup.py
  select the old build
- If BOOT_PREVIOUS is set, verify_upgrade test case verifies that booted
  build is indeed old build

M  +6    -0    main.pm
M  +9    -0    tests/common/bootup.py
M  +15   -2    tests/kdelinux/system/verify_upgrade.py

https://invent.kde.org/kde-linux/os-autoinst-distri-kdelinux/-/commit/66d97ea49f65b72747179a51db8d33a1e958b6b3

diff --git a/main.pm b/main.pm
index 064805c..90b9872 100755
--- a/main.pm
+++ b/main.pm
@@ -72,6 +72,12 @@ sub test_system_upgrade {
     loadtest 'common/network.py';
     loadtest 'kdelinux/app/discover_upgrade.py';
     loadtest 'common/reboot.py';
+    # Check if we booted in upgraded build
+    loadtest 'common/bootup.py';
+    loadtest 'common/basic_test.py';
+    loadtest 'kdelinux/system/verify_upgrade.py';
+    loadtest 'common/reboot.py';
+    # Verify that we are able to boot in old build
     loadtest 'common/bootup.py';
     loadtest 'common/basic_test.py';
     loadtest 'kdelinux/system/verify_upgrade.py';
diff --git a/tests/common/bootup.py b/tests/common/bootup.py
index c526dd2..af95a67 100644
--- a/tests/common/bootup.py
+++ b/tests/common/bootup.py
@@ -16,6 +16,15 @@ def run(self):
 
     # Verify that KDE Linux UEFI screen is visible
     assert_screen('uefi_screen', 'timeout', 30)
+
+    # If we are asked to boot into previous boot by upgrade testcase
+    # press "down", wait for 1 second
+    boot_prev = get_var('BOOT_PREVIOUS', '0')
+    if boot_prev == '1':
+        send_key('down')
+        time.sleep(1)
+
+    # Start the selected image.
     send_key('ret')
 
     # FDE_INSTALL=1 indicates full-disk-encryption
diff --git a/tests/kdelinux/system/verify_upgrade.py b/tests/kdelinux/system/verify_upgrade.py
index 85a7ef9..898fa5d 100644
--- a/tests/kdelinux/system/verify_upgrade.py
+++ b/tests/kdelinux/system/verify_upgrade.py
@@ -6,6 +6,19 @@ from lib.openqa.cli_session import session
 from lib import user_manager
 
 def run(self):
-    system_build = session.run('source /etc/os-release; echo $IMAGE_VERSION')
+
+    # This is booted image version
+    system_build = session.run('source /usr/lib/os-release; echo $IMAGE_VERSION')
+    # This is the BUILD number set by openQA
     test_build = get_var('BUILD')
-    assert system_build.strip() == test_build.strip(), f"Both IMAGE_VERSION={system_build} and BUILD={test_build} do not match, upgrade possibly failed"
+
+    # If we are booting in previous boot, BUILD and IMAGE_VERSION should not match
+    boot_prev = get_var('BOOT_PREVIOUS', '0')
+    if boot_prev == '0':
+        assert system_build.strip() == test_build.strip(), f"Both IMAGE_VERSION={system_build} and BUILD={test_build} do not match, upgrade possibly failed"
+    else:
+        assert system_build.strip() != test_build.strip(), f"Both IMAGE_VERSION={system_build} and BUILD={test_build} match, we could not reboot in old build"
+
+    # After we verify that we upgraded to new system, we will boot to previous
+    # image to make sure that old image is still bootable
+    set_var('BOOT_PREVIOUS', '1')
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.