summaryrefslogtreecommitdiff
diff options
-rwxr-xr-xbin/chameleon_hdmi_hotplug.py74
-rwxr-xr-xbin/removable_storage_test6
-rwxr-xr-xbin/virtualization15
-rw-r--r--units/led/test-plan.pxu6
-rw-r--r--units/miscellanea/jobs.pxu3
-rw-r--r--units/monitor/jobs.pxu16
-rw-r--r--units/usb/manifest.pxu5
-rw-r--r--units/usb/test-plan.pxu2
-rw-r--r--units/usb/usb.pxu17
9 files changed, 111 insertions, 33 deletions
diff --git a/bin/chameleon_hdmi_hotplug.py b/bin/chameleon_hdmi_hotplug.py
new file mode 100755
index 0000000..7366886
--- /dev/null
+++ b/bin/chameleon_hdmi_hotplug.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python3
+
+import sys
+import time
+
+import xmlrpc.client
+
+
+def Chameleon(host, port=9992):
+ """
+ Get a proxy object that is used to control the Chameleon board.
+
+ The interface definition for this object can be found at:
+ https://chromium.googlesource.com/chromiumos/platform/chameleon/+/refs/heads/master/chameleond/interface.py
+ """
+ print('== Chameleon connection ==')
+ print('Target device: {}:{}'.format(host, port))
+ proxy = xmlrpc.client.ServerProxy('http://{}:{}'.format(host, port))
+ try:
+ # test the proxy works
+ mac = proxy.GetMacAddress()
+ print('MAC address: {}'.format(mac))
+ except OSError as e:
+ print(e)
+ raise SystemExit('ERROR connecting to Chameleon board')
+ print()
+ return proxy
+
+
+def get_hdmi_port(chameleon):
+ supported_ports = chameleon.GetSupportedPorts()
+ for port in supported_ports:
+ port_type = chameleon.GetConnectorType(port)
+ if port_type == 'HDMI':
+ return port
+
+
+def get_hdmi_status(drm_id):
+ path = '/sys/class/drm/{}/status'.format(drm_id)
+ with open(path) as sys_f:
+ return sys_f.readline().strip()
+
+
+if __name__ == '__main__':
+ drm_id = sys.argv[1]
+ c = Chameleon(sys.argv[2])
+
+ start = get_hdmi_status(drm_id)
+ print('Starting status: {}'.format(start))
+ print(flush=True)
+
+ port_num = get_hdmi_port(c)
+
+ print('chameleon> plug hdmi')
+ c.Plug(port_num)
+ time.sleep(10)
+
+ new_status = get_hdmi_status(drm_id)
+ print('Status after plug request: {}'.format(new_status))
+ print(flush=True)
+ if new_status != 'connected':
+ raise SystemExit('FAIL: hdmi not connected')
+
+ print('chameleon> unplug hdmi')
+ c.Unplug(port_num)
+ time.sleep(10)
+
+ final_status = get_hdmi_status(drm_id)
+ print('Status after unplug request: {}'.format(final_status))
+ print(flush=True)
+ if final_status != 'disconnected':
+ raise SystemExit('FAIL: hdmi did not disconnect')
+
+ print('PASS')
diff --git a/bin/removable_storage_test b/bin/removable_storage_test
index 249911a..bbace30 100755
--- a/bin/removable_storage_test
+++ b/bin/removable_storage_test
@@ -729,6 +729,8 @@ def main():
total_write_size = sum(write_sizes)
try:
+ # Clear dmesg so we can check for I/O errors later
+ subprocess.check_output(['dmesg', '-C'])
for disk, mount_point in disks_eligible.items():
print("%s (Total Data Size / iteration: %0.4f MB):" %
(disk, (total_write_size / 1024 / 1024)))
@@ -807,6 +809,10 @@ def main():
if test.umount() != 0:
errors += 1
test.clean_tmp_dir()
+ dmesg = subprocess.run(['dmesg'], stdout=subprocess.PIPE)
+ if 'I/O error' in dmesg.stdout.decode():
+ logging.error("I/O errors found in dmesg")
+ errors += 1
if errors > 0:
logging.warning(
diff --git a/bin/virtualization b/bin/virtualization
index de001a1..487fba5 100755
--- a/bin/virtualization
+++ b/bin/virtualization
@@ -24,24 +24,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from argparse import ArgumentParser
-import configparser
-from glob import glob
import os
-import re
import logging
import lsb_release
import platform
import requests
import shlex
-import signal
from subprocess import (
Popen,
PIPE,
- STDOUT,
DEVNULL,
CalledProcessError,
check_output,
- check_call,
call
)
import sys
@@ -204,7 +198,7 @@ class KVMTest(object):
self.arch = check_output(['dpkg', '--print-architecture'],
universal_newlines=True).strip()
self.qemu_config = QEMU_ARCH_CONFIG[self.arch]
- self.release = lsb_release.get_lsb_information()["CODENAME"]
+ self.release = lsb_release.get_distro_information()["CODENAME"]
def url_to_path(self, image_path):
"""
@@ -552,7 +546,7 @@ class RunCommand(object):
def run(self, cmd):
proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE,
- universal_newlines=True)
+ stdin=DEVNULL, universal_newlines=True)
self.stdout, self.stderr = proc.communicate()
self.returncode = proc.returncode
@@ -834,7 +828,8 @@ def main():
args.func(args)
except AttributeError:
parser.print_help()
- return False
+ return 1
+
if __name__ == "__main__":
- main()
+ sys.exit(main())
diff --git a/units/led/test-plan.pxu b/units/led/test-plan.pxu
index 40f5697..33c5642 100644
--- a/units/led/test-plan.pxu
+++ b/units/led/test-plan.pxu
@@ -22,9 +22,6 @@ _description:
- led/wireless is redundant given that we have led/wlan and
led/bluetooth already. (Manual)
include:
- led/battery-charged
- led/battery-charging
- led/battery-low
camera/led_.* certification-status=blocker
led/caps-lock certification-status=blocker
led/numeric-keypad certification-status=blocker
@@ -52,9 +49,6 @@ unit: test plan
_name: LED tests (after suspend)
_description: LED tests (after suspend)
include:
- suspend/led_after_suspend/battery-charged
- suspend/led_after_suspend/battery-charging
- suspend/led_after_suspend/battery-low
after-suspend-manual-camera/led_.* certification-status=blocker
suspend/led_after_suspend/caps-lock certification-status=blocker
suspend/led_after_suspend/numeric-keypad certification-status=blocker
diff --git a/units/miscellanea/jobs.pxu b/units/miscellanea/jobs.pxu
index bbb28bf..1f008cb 100644
--- a/units/miscellanea/jobs.pxu
+++ b/units/miscellanea/jobs.pxu
@@ -154,8 +154,7 @@ unit: template
template-resource: model_assertion
template-unit: job
requires:
- executable.name == 'dumpimage'
- executable.name == 'mokutil'
+ executable.name == 'dumpimage' or executable.name == 'mokutil'
id: miscellanea/secure_boot_mode_{gadget}
_summary: Test that {gadget} Ubuntu Core system booted with Secure Boot active
_description:
diff --git a/units/monitor/jobs.pxu b/units/monitor/jobs.pxu
index df1bb95..59efbf7 100644
--- a/units/monitor/jobs.pxu
+++ b/units/monitor/jobs.pxu
@@ -403,17 +403,7 @@ plugin: shell
category_id: com.canonical.plainbox::monitor
_summary: Automated HDMI hotplug test
_description:
- This test will use edid injector on muxpi to check if system detect HDMI hotplug
-environ: HDMI_PORT MUXPI_IP
-requires: manifest.has_muxpi_hdmi == 'True'
-imports: from com.canonical.plainbox import manifest
+ Use chamleon board to simulate connection/disconnection of an HDMI monitor.
+environ: HDMI_PORT CHAMELEON_IP
command:
- export SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- timeout 60 ssh $SSH_OPTS ubuntu@$MUXPI_IP "stm -hdmi off" || exit 1
- sleep 3
- timeout 60 ssh $SSH_OPTS ubuntu@$MUXPI_IP "stm -hdmi on" || exit 1
- sleep 3
- if [ "$(cat /sys/class/drm/$HDMI_PORT/status)" != "connected" ] ;then exit 1; fi
- timeout 60 ssh $SSH_OPTS ubuntu@$MUXPI_IP "stm -hdmi off" || exit 1
- sleep 3
- if [ "$(cat /sys/class/drm/$HDMI_PORT/status)" != "disconnected" ] ;then exit 1; fi
+ chameleon_hdmi_hotplug.py $HDMI_PORT $CHAMELEON_IP
diff --git a/units/usb/manifest.pxu b/units/usb/manifest.pxu
index 914e892..fef1a64 100644
--- a/units/usb/manifest.pxu
+++ b/units/usb/manifest.pxu
@@ -2,3 +2,8 @@ unit: manifest entry
id: has_usb_type_c
_name: USB Type-C Support
value-type: bool
+
+unit: manifest entry
+id: has_usb_storage
+_name: USB Storage Device Connected
+value-type: bool
diff --git a/units/usb/test-plan.pxu b/units/usb/test-plan.pxu
index f177798..02dc6e5 100644
--- a/units/usb/test-plan.pxu
+++ b/units/usb/test-plan.pxu
@@ -221,6 +221,7 @@ unit: test plan
_name: Automated USB tests
_description: Automated USB tests for Snappy Ubuntu Core devices
include:
+ usb/storage-detect
usb/storage-preinserted-.*
bootstrap_include:
removable_partition
@@ -326,6 +327,7 @@ unit: test plan
_name: Automated USB tests
_description: Automated USB tests for Snappy Ubuntu Core devices
include:
+ after-suspend-usb/storage-detect
after-suspend-usb/storage-preinserted-.*
bootstrap_include:
removable_partition
diff --git a/units/usb/usb.pxu b/units/usb/usb.pxu
index ffc9f3c..7fc8976 100644
--- a/units/usb/usb.pxu
+++ b/units/usb/usb.pxu
@@ -234,7 +234,7 @@ category_id: com.canonical.plainbox::usb
id: usb/storage-preinserted
user: root
estimated_duration: 45.0
-command: removable_storage_test -l usb && removable_storage_test -s 268400000 usb
+command: removable_storage_test -l usb && timeout 300 removable_storage_test -s 268400000 usb
flags: also-after-suspend preserve-cwd
requires:
cpuinfo.platform != 's390x'
@@ -258,7 +258,7 @@ requires:
package.name == 'udisks2' or snap.name == 'udisks2'
package.name == 'udisks2' or (snap.name == 'core' and int(snap.revision) >= 1804)
estimated_duration: 45.0
-command: removable_storage_test -l usb && removable_storage_test -s 268400000 -m 500000000 usb --driver xhci_hcd
+command: removable_storage_test -l usb && timeout 300 removable_storage_test -s 268400000 -m 500000000 usb --driver xhci_hcd
_summary:
Test USB 3.0 or 3.1 ports
_description:
@@ -293,6 +293,18 @@ _description:
This test will check that your USB 2.0 port transfers data at a
minimum expected speed.
+id: usb/storage-detect
+category_id: com.canonical.plainbox::usb
+plugin: shell
+_summary: Detect storage partitions on a device on the USB bus
+command:
+ udev_resource -f PARTITION | grep "bus: usb"
+estimated_duration: 1.0
+flags: also-after-suspend
+imports: from com.canonical.plainbox import manifest
+requires:
+ manifest.has_usb_storage == 'True'
+
unit: template
template-resource: removable_partition
template-filter: "usb" in removable_partition.bus
@@ -310,6 +322,7 @@ _description:
Tests USB 2.0 or 1.1 ports on a system by doing write/read/compare tests on
randomly created data. It requires that a USB stick is plugged into an
available USB port before running the certification suite.
+depends: usb/storage-detect
id: usb/hid
_summary: USB keyboard works