Merge ~canonical-kernel-team/+git/autotest-client-tests:phlin/bt-core-apt into ~canonical-kernel-team/+git/autotest-client-tests:master

Proposed by Po-Hsu Lin
Status: Merged
Merge reported by: Po-Hsu Lin
Merged at revision: 3fd89848bc328bcd7ad486ad421445ce7bd5cb28
Proposed branch: ~canonical-kernel-team/+git/autotest-client-tests:phlin/bt-core-apt
Merge into: ~canonical-kernel-team/+git/autotest-client-tests:master
Diff against target: 33 lines (+9/-4)
1 file modified
ubuntu_boot/ubuntu_boot.py (+9/-4)
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Sean Feole Approve
Review via email: mp+465714@code.launchpad.net

Commit message

* UBUNTU: SAUCE: ubuntu_boot: print OS info with os-release file

KERNTT-464
Use /etc/os-release for printing out OS information. So that we don't
need to have extra dependency for using lsb_release command on core
systems.

* UBUNTU: SAUCE: ubuntu_boot: skip apt commands on core system

KERNTT-464
There is no apt command on Ubuntu Core system. Detect if we are running
on a core system by checking for "snapd_recovery_mode" in /proc/cmdline

Package dependency will be handled by snapcraft.

* UBUNTU: SAUCE: ubuntu_boot: rename control file

KERNTT-464
Rename control file from control.ubuntu to control. It's the only way
to allow autotest to recognize the test without specifying where the
control file is.

With this change you can run it with something like:
  autotest/client/autotest-local run ubuntu_boot

This is essential for snap testing as we will need to ship tests
along with autotest.

Description of the change

Breaking my ubuntu_boot test tweaks for core systems into a couple of easy-to-review small pieces.

To post a comment you must log in.
Revision history for this message
Sean Feole (sfeole) wrote :

+1 from me Thanks for these

review: Approve
Revision history for this message
Francis Ginther (fginther) wrote :

Looks good

review: Approve
Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Applied and pushed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/ubuntu_boot/control.ubuntu b/ubuntu_boot/control
2similarity index 100%
3rename from ubuntu_boot/control.ubuntu
4rename to ubuntu_boot/control
5diff --git a/ubuntu_boot/ubuntu_boot.py b/ubuntu_boot/ubuntu_boot.py
6index 2d813e0..4690094 100644
7--- a/ubuntu_boot/ubuntu_boot.py
8+++ b/ubuntu_boot/ubuntu_boot.py
9@@ -8,9 +8,14 @@ from autotest.client.shared import error
10 class ubuntu_boot(test.test):
11 version = 1
12 def setup(self):
13- pkgs = [ 'python3', 'keyutils' ]
14- cmd = 'yes "" | DEBIAN_FRONTEND=noninteractive apt-get install --yes --force-yes ' + ' '.join(pkgs)
15- self.results = utils.system_output(cmd, retain_output=True)
16+ with open('/proc/cmdline', 'r') as fh:
17+ content = fh.read()
18+ if 'snapd_recovery_mode' in content:
19+ print('Running Ubuntu Core system, skipping apt commands.')
20+ else:
21+ pkgs = [ 'python3', 'keyutils' ]
22+ cmd = 'yes "" | DEBIAN_FRONTEND=noninteractive apt-get install --yes --force-yes ' + ' '.join(pkgs)
23+ self.results = utils.system_output(cmd, retain_output=True)
24
25 def log_check(self):
26 '''Test for checking error patterns in log files'''
27@@ -94,5 +99,5 @@ class ubuntu_boot(test.test):
28
29 cmd = "uname -a"
30 utils.system(cmd)
31- cmd = "lsb_release -a"
32+ cmd = "cat /etc/os-release"
33 utils.system(cmd)

Subscribers

People subscribed via source and target branches

to all changes: