summaryrefslogtreecommitdiff
diff options
-rwxr-xr-xbin/graphics_env8
-rwxr-xr-xbin/net_driver_info8
-rwxr-xr-xbin/wifi_nmcli_test71
-rwxr-xr-xrequirements/container-tests-provider-checkbox8
-rw-r--r--units/led/category.pxu3
-rw-r--r--units/led/jobs.pxu48
-rw-r--r--units/led/test-plan.pxu18
7 files changed, 124 insertions, 40 deletions
diff --git a/bin/graphics_env b/bin/graphics_env
index 8c82567..9511560 100755
--- a/bin/graphics_env
+++ b/bin/graphics_env
@@ -19,9 +19,11 @@ if [[ $DRIVER == "amdgpu" || $DRIVER == "radeon" ]]; then
if [ $INDEX -gt 1 ]; then
# See https://wiki.archlinux.org/index.php/PRIME
echo "Setting up PRIME GPU offloading for AMD discrete GPU"
- PROVIDER_ID=`xrandr --listproviders | grep "Sink Output" | awk {'print $4'} | tail -1`
- SINK_ID=`xrandr --listproviders | grep "Source Output" | awk {'print $4'} | tail -1`
- xrandr --setprovideroffloadsink ${PROVIDER_ID} ${SINK_ID}
+ if ! grep -q DRI3 /var/log/Xorg.0.log; then
+ PROVIDER_ID=`xrandr --listproviders | grep "Sink Output" | awk {'print $4'} | tail -1`
+ SINK_ID=`xrandr --listproviders | grep "Source Output" | awk {'print $4'} | tail -1`
+ xrandr --setprovideroffloadsink ${PROVIDER_ID} ${SINK_ID}
+ fi
export DRI_PRIME=1
else
export DRI_PRIME=
diff --git a/bin/net_driver_info b/bin/net_driver_info
index ee5db46..6bc8058 100755
--- a/bin/net_driver_info
+++ b/bin/net_driver_info
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
-# Copyright 2017 Canonical Ltd.
+# Copyright 2017-2018 Canonical Ltd.
# All rights reserved.
#
# Written by:
# Jonathan Cave <jonathan.cave@canonical.com>
+# Taihsiang Ho <taihsiang.ho@canonical.com>
#
# Print info about drivers we can identify automatically and also those we
# identify in the special interest list!
@@ -37,5 +38,8 @@ for interface, driver in driver_list:
print(" Parameters:")
for path in Path(sysfs_path).iterdir():
if path.is_file():
- print(" {}: {}".format(path.name, path.read_text().strip()))
+ # Path.read_text is new in python 3.5 but we want to support
+ # trusty as well, which uses python 3.4 by default.
+ with open(str(path), 'r') as f:
+ print(" {}: {}".format(path.name, f.read().strip()))
print()
diff --git a/bin/wifi_nmcli_test b/bin/wifi_nmcli_test
index 24359c2..b89a525 100755
--- a/bin/wifi_nmcli_test
+++ b/bin/wifi_nmcli_test
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
-# Copyright 2017 Canonical Ltd.
+# Copyright 2017-2018 Canonical Ltd.
# All rights reserved.
#
# Written by:
# Jonathan Cave <jonathan.cave@canonical.com>
+# Taihsiang Ho <taihsiang.ho@canonical.com>
#
# wireless connection tests using nmcli
@@ -13,6 +14,8 @@ import functools
import subprocess as sp
import sys
+from distutils.version import LooseVersion
+
print = functools.partial(print, flush=True)
@@ -25,6 +28,17 @@ def print_cmd(cmd):
print("+", cmd)
+def legacy_nmcli():
+ cmd = "nmcli -v"
+ output = sp.check_output(cmd, shell=True)
+ version = LooseVersion(output.strip().split()[-1].decode())
+ # check if using an earlier nmcli version with different api
+ # nmcli in trusty is 0.9.8.8
+ if version < LooseVersion("0.9.9"):
+ return True
+ return False
+
+
def cleanup_nm_connections():
print_head("Cleaning up NM connections")
cmd = "nmcli -t -f TYPE,UUID,NAME c"
@@ -34,7 +48,10 @@ def cleanup_nm_connections():
type, uuid, name = line.strip().split(':')
if type == '802-11-wireless':
print("Deleting connection", name)
- cmd = "nmcli c delete {}".format(uuid)
+ if legacy_nmcli():
+ cmd = "nmcli c delete uuid {}".format(uuid)
+ else:
+ cmd = "nmcli c delete {}".format(uuid)
print_cmd(cmd)
sp.call(cmd, shell=True)
print()
@@ -51,17 +68,26 @@ def device_rescan():
def list_aps(args):
print_head("List APs")
count = 0
- cmd = "nmcli -t -f SSID,CHAN,FREQ,SIGNAL d wifi list ifname {}".format(
- args.device)
+ if legacy_nmcli():
+ fields = "SSID,FREQ,SIGNAL"
+ cmd = "nmcli -t -f {} d wifi list iface {}".format(fields, args.device)
+ else:
+ fields = "SSID,CHAN,FREQ,SIGNAL"
+ cmd = "nmcli -t -f {} d wifi list ifname {}".format(fields, args.device)
print_cmd(cmd)
output = sp.check_output(cmd, shell=True)
for line in output.decode(sys.stdout.encoding).splitlines():
# lp bug #1723372 - extra line in output on zesty
if line.strip() == args.device:
continue
- ssid, channel, frequency, signal = line.strip().split(':')
- print("SSID: {} Chan: {} Freq: {} Signal: {}".format(
- ssid, channel, frequency, signal))
+ if legacy_nmcli():
+ ssid, frequency, signal = line.strip().split(':')
+ print("SSID: {} Freq: {} Signal: {}".format(
+ ssid, frequency, signal))
+ else:
+ ssid, channel, frequency, signal = line.strip().split(':')
+ print("SSID: {} Chan: {} Freq: {} Signal: {}".format(
+ ssid, channel, frequency, signal))
if hasattr(args, 'essid'):
if ssid == args.essid:
count += 1
@@ -73,11 +99,19 @@ def list_aps(args):
def open_connection(args):
print_head("Connection attempt")
- cmd = "nmcli d wifi connect {} ifname {} name TEST_CON".format(
- args.essid, args.device)
+ if legacy_nmcli():
+ cmd = "nmcli d wifi connect {} iface {} name TEST_CON".format(
+ args.essid, args.device)
+ else:
+ cmd = "nmcli d wifi connect {} ifname {} name TEST_CON".format(
+ args.essid, args.device)
print_cmd(cmd)
sp.call(cmd, shell=True)
- cmd = "nmcli -m tabular -t -f GENERAL.STATE d show {}".format(args.device)
+ if legacy_nmcli():
+ cmd_part = "nmcli -m tabular -t -f GENERAL d list | "
+ cmd = cmd_part + "grep {} | awk -F: '{{print $15}}'".format(args.device)
+ else:
+ cmd = "nmcli -m tabular -t -f GENERAL.STATE d show {}".format(args.device)
print_cmd(cmd)
output = sp.check_output(cmd, shell=True)
state = output.decode(sys.stdout.encoding).strip()
@@ -91,11 +125,19 @@ def open_connection(args):
def secured_connection(args):
print_head("Connection attempt")
- cmd = "nmcli d wifi connect {} password {} ifname {} name TEST_CON".format(
- args.essid, args.psk, args.device)
+ if legacy_nmcli():
+ cmd = "nmcli d wifi connect {} password {} iface {} name TEST_CON".format(
+ args.essid, args.psk, args.device)
+ else:
+ cmd = "nmcli d wifi connect {} password {} ifname {} name TEST_CON".format(
+ args.essid, args.psk, args.device)
print_cmd(cmd)
sp.call(cmd, shell=True)
- cmd = "nmcli -m tabular -t -f GENERAL.STATE d show {}".format(args.device)
+ if legacy_nmcli():
+ cmd_part = "nmcli -m tabular -t -f GENERAL d list | "
+ cmd = cmd_part + "grep {} | awk -F: '{{print $15}}'".format(args.device)
+ else:
+ cmd = "nmcli -m tabular -t -f GENERAL.STATE d show {}".format(args.device)
print_cmd(cmd)
output = sp.check_output(cmd, shell=True)
state = output.decode(sys.stdout.encoding).strip()
@@ -136,7 +178,8 @@ if __name__ == '__main__':
args = parser.parse_args()
cleanup_nm_connections()
- device_rescan()
+ if not legacy_nmcli():
+ device_rescan()
count = list_aps(args)
if args.test_type == 'scan':
diff --git a/requirements/container-tests-provider-checkbox b/requirements/container-tests-provider-checkbox
index 92f064d..e8c629c 100755
--- a/requirements/container-tests-provider-checkbox
+++ b/requirements/container-tests-provider-checkbox
@@ -1,16 +1,16 @@
#!/bin/bash
function finish {
- rm -rf ./plainbox
+ rm -rf ./checkbox-ng
rm -rf ./plainbox-provider-resource
}
trap finish EXIT
set -e
-git clone git://git.launchpad.net/plainbox
-echo "I: running 'develop' on plainbox"
-( cd ./plainbox/ && python3 setup.py develop --quiet | sed -e 's/^/I (develop output) /' )
+git clone git://git.launchpad.net/checkbox-ng
+echo "I: running 'develop' on checkbox-ng"
+( cd ./checkbox-ng/ && python3 setup.py develop --quiet | sed -e 's/^/I (develop output) /' )
git clone git://git.launchpad.net/plainbox-provider-resource
python3 ./plainbox-provider-resource/manage.py develop --force
diff --git a/units/led/category.pxu b/units/led/category.pxu
new file mode 100644
index 0000000..9f72d20
--- /dev/null
+++ b/units/led/category.pxu
@@ -0,0 +1,3 @@
+unit: category
+id: led
+_name: LED tests
diff --git a/units/led/jobs.pxu b/units/led/jobs.pxu
index 17ce655..15d3065 100644
--- a/units/led/jobs.pxu
+++ b/units/led/jobs.pxu
@@ -7,7 +7,7 @@ _steps:
_verification:
Power led is on when system is powered on
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
estimated_duration: 15.0
id: led/power-blink-suspend
@@ -20,11 +20,11 @@ _steps:
_verification:
Power led is blinking when system is in suspend
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
estimated_duration: 180
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/suspend
estimated_duration: 30.0
depends: suspend/suspend_advanced
@@ -39,7 +39,7 @@ _description:
Did the Suspend LED blink or change color while the system was suspended?
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/battery-charging
estimated_duration: 120.0
_description:
@@ -52,7 +52,7 @@ _description:
Did the battery indicator LED turn orange?
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/battery-charged
estimated_duration: 240.0
_description:
@@ -66,7 +66,7 @@ _description:
Does the orange battery LED shut off when system is fully charged?
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/battery-low
estimated_duration: 30.0
_description:
@@ -79,7 +79,7 @@ _description:
Does the LED light orange when battery is low?
plugin: user-interact-verify
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/hdd
estimated_duration: 30.0
command: led_hdd_test
@@ -93,7 +93,7 @@ _description:
Did the HDD LED light?
plugin: user-interact-verify
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/numeric-keypad
estimated_duration: 30.0
command: keyboard_test
@@ -109,7 +109,7 @@ _description:
2. Numbers should only be entered in the keyboard verification window when the LED is on
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/caps-lock
estimated_duration: 30.0
_description:
@@ -122,7 +122,7 @@ _description:
Did the Cap Keys LED light as expected?
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/wlan
depends: keys/wireless
estimated_duration: 60.0
@@ -137,7 +137,7 @@ _description:
Did the WLAN LED turn on or change color as expected?
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/wlan-disabled
estimated_duration: 30.0
depends: keys/wireless
@@ -168,11 +168,11 @@ _steps:
_verification:
Bluetooth LED is turned on in step 2, and turned off in step 3.
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
estimated_duration: 180
plugin: user-interact-verify
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/camera
estimated_duration: 20.0
depends: camera/detect
@@ -187,7 +187,7 @@ _description:
Did the camera LED light?
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/touchpad
estimated_duration: 30.0
_description:
@@ -202,7 +202,7 @@ _description:
3. When the LED is off, the mouse pointer should not move on touchpad usage
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/wireless
estimated_duration: 120.0
_description:
@@ -219,7 +219,7 @@ _description:
Did the WLAN/Bluetooth LED light as expected?
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/mute
depends: keys/mute
estimated_duration: 30.0
@@ -234,7 +234,7 @@ _description:
Did the Audio LED turn on and off or change color as expected?
plugin: manual
-category_id: com.canonical.plainbox::led
+category_id: led
id: led/microphone-mute
estimated_duration: 30.0
depends: keys/microphone-mute
@@ -247,3 +247,17 @@ _description:
determine if it either turned off and on or changed colors.
VERIFICATION:
Did the Microphone Mute LED turn on and off or change color as expected?
+
+id: led/serial
+_summary: Serial ports LED behavior
+_purpose:
+ Check serial ports LED behavior is correct
+_steps:
+ 1. Start the test to send data to all serial ports (/dev/ttyS*)
+_verification:
+ All serial ports LED are on for a few seconds (3-4s)
+plugin: user-interact-verify
+command: echo {0..1024} | tee /dev/ttyS{0..100} &> /dev/null
+user: root
+category_id: led
+estimated_duration: 15
diff --git a/units/led/test-plan.pxu b/units/led/test-plan.pxu
index 4f59af9..f43a3ca 100644
--- a/units/led/test-plan.pxu
+++ b/units/led/test-plan.pxu
@@ -28,3 +28,21 @@ include:
suspend/led_after_suspend/caps-lock
suspend/led_after_suspend/power
suspend/led_after_suspend/touchpad
+
+id: led-full
+unit: test plan
+_name: LED tests
+_description: QA LED tests for IoT devices
+include:
+nested_part:
+ led-manual
+
+id: led-manual
+unit: test plan
+_name: Manual LED tests
+_description: Manual LED tests for IoT devices
+include:
+ led/power
+ led/power-blink-suspend
+ led/bluetooth
+ led/serial