diff options
-rwxr-xr-x | bin/cpufreq_test.py | 3 | ||||
-rwxr-xr-x | bin/edid_cycle.py | 9 | ||||
-rwxr-xr-x | bin/maas-version-check.sh | 66 | ||||
-rw-r--r-- | units/pig/test-plan.pxu | 16 | ||||
-rw-r--r-- | units/zapper/jobs.pxu (renamed from units/pig/jobs.pxu) | 7 | ||||
-rw-r--r-- | units/zapper/resource.pxu (renamed from units/pig/resource.pxu) | 0 | ||||
-rw-r--r-- | units/zapper/test-plan.pxu | 16 |
7 files changed, 79 insertions, 38 deletions
diff --git a/bin/cpufreq_test.py b/bin/cpufreq_test.py index 73fa651..7d48021 100755 --- a/bin/cpufreq_test.py +++ b/bin/cpufreq_test.py @@ -61,8 +61,9 @@ class CpuFreqTest: # max, min percentage of avg freq allowed to pass # values relative to target freq # ex: max = 110, min = 90 is 20% passing tolerance + # LP 1963650: lowered min to 85 to fine tune failures max_freq_pct = 150 - min_freq_pct = 90 + min_freq_pct = 85 def __init__(self): def append_max_min(): diff --git a/bin/edid_cycle.py b/bin/edid_cycle.py index e327cb0..64069cf 100755 --- a/bin/edid_cycle.py +++ b/bin/edid_cycle.py @@ -3,12 +3,10 @@ This program tests whether the system changes the resolution automatically when supplied with a new EDID information. -To run the test RaspberryPi equipped with a HDMI->CSI-2 bridge is needed. See -here for details: -https://docs.google.com/document/d/1kjgaazt2IMskn_HPjN7adXYx1O5zXc39DRayZ0PYh9Y +To run the test you need Zapper board connected and set up. The command-line argument for the program is the address of the RaspberryPi -Host (optionally with a username), e.g.: pi@192.168.1.100 +Host (optionally with a username), e.g.: ubuntu@192.168.1.100 """ import os import re @@ -28,8 +26,7 @@ def check_resolution(): def change_edid(host, edid_file): with open(edid_file, 'rb') as f: - cmd = ['ssh', host, '/snap/bin/pigbox', 'run', - '\'v4l2-ctl --set-edid=file=-,' + cmd = ['ssh', host, '\'v4l2-ctl --set-edid=file=-,' 'format=raw --fix-edid-checksums\''] subprocess.check_output(cmd, input=f.read()) diff --git a/bin/maas-version-check.sh b/bin/maas-version-check.sh index 25e233f..7d97f0b 100755 --- a/bin/maas-version-check.sh +++ b/bin/maas-version-check.sh @@ -1,9 +1,10 @@ #!/bin/bash -# Copyright (C) 2012-2019 Canonical Ltd. +# Copyright (C) 2012-2022 Canonical Ltd. # Authors # Jeff Lane <jeff@ubuntu.com> +# Rod Smith <rod.smith@canonical.com> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, @@ -18,14 +19,57 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. MAAS_FILE="/etc/installed-by-maas" +DATASOURCE_FILE="/var/lib/cloud/instance/datasource" +MAAS_DATASOURCE="" +RETVAL="0" -# Is the file there? -if [ -s $MAAS_FILE ]; then - maas_version=$(cat $MAAS_FILE) - echo "$maas_version" - exit 0 -else - echo "ERROR: This system does not appear to have been installed by MAAS" - echo "ERROR: " "$(ls -l $MAAS_FILE 2>&1)" - exit 1 -fi +# Find the MAAS data source, as recorded in cloud installer files +get_maas_datasource() { + # Is the file there? + if [ -s $DATASOURCE_FILE ]; then + MAAS_DATASOURCE=$(cut -d "[" -f 2 $DATASOURCE_FILE | cut -d "]" -f 1) + echo "MAAS data source is $MAAS_DATASOURCE" + else + echo "ERROR: This system does not appear to have been installed by MAAS" + echo "ERROR: " "$(ls -l $DATASOURCE_FILE 2>&1)" + RETVAL="1" + fi +} + +# Verify that the $MAAS_DATASOURCE points to a valid IP address. +# Note: Function assumes that $MAAS_DATASOURCE is already set, as is +# done by the get_maas_datasource() function. +verify_maas_ip() { + if [[ $RETVAL == 0 ]]; then + MAAS_HOSTNAME=$(echo "$MAAS_DATASOURCE" | cut -d "/" -f 3 | cut -d ":" -f 1) + HOST_OUTPUT=$(host "$MAAS_HOSTNAME" | grep "has address") + status=$? + if [[ $status -eq 0 ]]; then + MAAS_IP=$(echo "$HOST_OUTPUT" | cut -d " " -f 4) + echo "MAAS server's IP address is $MAAS_IP" + else + echo "ERROR: Unable to determine MAAS server's IP address" + RETVAL=1 + fi + fi +} + +# Pull the MAAS version information from a file left here by the +# Server Certification pre-seed file +get_maas_version() { + # Is the file there? + if [ -s $MAAS_FILE ]; then + maas_version=$(cat $MAAS_FILE) + echo "MAAS version is $maas_version" + else + echo "ERROR: The MAAS version cannot be determined" + echo "ERROR: " "$(ls -l $MAAS_FILE 2>&1)" + RETVAL="1" + fi +} + +get_maas_datasource +verify_maas_ip +get_maas_version + +exit $RETVAL diff --git a/units/pig/test-plan.pxu b/units/pig/test-plan.pxu deleted file mode 100644 index 071a927..0000000 --- a/units/pig/test-plan.pxu +++ /dev/null @@ -1,16 +0,0 @@ -id: pig-enabled-full -unit: test plan -_name: Tests using Pi Testing Rig -_description: Tests using Pi Testing Rig -include: -nested_part: - pig-enabled-automated - -id: pig-enabled-automated -unit: test plan -_name: Tests using Pi Testing Rig (Automated) -_description: Tests using Pi Testing Rig (Automated) -include: - monitor/pig-edid -bootstrap_include: - pig diff --git a/units/pig/jobs.pxu b/units/zapper/jobs.pxu index b3702ab..acf65f1 100644 --- a/units/pig/jobs.pxu +++ b/units/zapper/jobs.pxu @@ -1,8 +1,7 @@ -id: monitor/pig-edid +id: monitor/zapper-edid category_id: com.canonical.plainbox::monitor plugin: shell estimated_duration: 60 _summary: Check if the system automatically changes the resolution based on EDID -requires: pig.hdmi_bridge == 'installed' -environ: PIG_HOST -command: edid_cycle.py "$PIG_HOST" +environ: ZAPPER_HOST +command: edid_cycle.py "$ZAPPER_HOST" diff --git a/units/pig/resource.pxu b/units/zapper/resource.pxu index 81b9d19..81b9d19 100644 --- a/units/pig/resource.pxu +++ b/units/zapper/resource.pxu diff --git a/units/zapper/test-plan.pxu b/units/zapper/test-plan.pxu new file mode 100644 index 0000000..ce287ff --- /dev/null +++ b/units/zapper/test-plan.pxu @@ -0,0 +1,16 @@ +id: zapper-enabled-full +unit: test plan +_name: Tests using Zapper +_description: Tests using Zapper +include: +nested_part: + zapper-enabled-automated + +id: zapper-enabled-automated +unit: test plan +_name: Tests using Zapper +_description: Tests using Zapper +include: + monitor/pig-edid +bootstrap_include: + pig |