diff options
-rwxr-xr-x | bin/chameleon_hdmi_hotplug.py | 74 | ||||
-rwxr-xr-x | bin/removable_storage_test | 6 | ||||
-rw-r--r-- | units/graphics/jobs.pxu | 2 | ||||
-rw-r--r-- | units/monitor/jobs.pxu | 16 | ||||
-rw-r--r-- | units/usb/usb.pxu | 6 |
5 files changed, 88 insertions, 16 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/units/graphics/jobs.pxu b/units/graphics/jobs.pxu index 13d9afe..fba1f7e 100644 --- a/units/graphics/jobs.pxu +++ b/units/graphics/jobs.pxu @@ -405,7 +405,7 @@ command: totem --fullscreen $PLAINBOX_PROVIDER_DATA/video/Ogg_Theora_Video.ogv 2>/dev/null & set -o pipefail sleep 15 && camera_test still --device=/dev/external_webcam -f $PLAINBOX_SESSION_SHARE/screenshot_fullscreen_video_{index}.jpg -q 2>&1 | ansi_parser - sleep 5 && totem --quit 2>/dev/null + sleep 5 && pkill totem gsettings set org.gnome.totem repeat false _summary: Test FSV screenshot for {vendor} {product} _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/usb.pxu b/units/usb/usb.pxu index ed3de93..7fc8976 100644 --- a/units/usb/usb.pxu +++ b/units/usb/usb.pxu @@ -18,6 +18,8 @@ plugin: user-interact-verify category_id: com.canonical.plainbox::usb id: usb/disk_detect depends: usb/detect +requires: + package.name == 'udisks2' or snap.name == 'udisks2' estimated_duration: 1.0 command: removable_storage_test -l usb _description: @@ -232,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' @@ -256,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: |