summaryrefslogtreecommitdiff
diff options
authorSylvain Pineau <sylvain.pineau@canonical.com>2018-04-25 10:20:33 +0200
committerSylvain Pineau <sylvain.pineau@canonical.com>2018-04-25 10:20:33 +0200
commit11b6956a6c62dbdf3bd0dcca6d65ed137094f489 (patch)
tree1903ff1cfa980da467bf76b780e4f595409093b9
parentf2e9800365272383e27d23699a7528939269bc1c (diff)
parent475ae5879f4b72a4c198cf451bf23086d6f6e0d9 (diff)
record new upstream branch created by importing plainbox-provider-checkbox_0.44.0.orig.tar.gz and merge it
-rwxr-xr-xbin/disk_stress_ng4
-rwxr-xr-xbin/network37
-rwxr-xr-xbin/pm_test115
-rw-r--r--debian/.git-dpm14
-rwxr-xr-xmanage.py2
-rw-r--r--units/info/jobs.pxu4
-rw-r--r--units/miscellanea/jobs.pxu18
-rw-r--r--units/stress/test-plan.pxu4
-rw-r--r--units/submission/jobs.pxu6
9 files changed, 117 insertions, 87 deletions
diff --git a/bin/disk_stress_ng b/bin/disk_stress_ng
index df5694e..3668f63 100755
--- a/bin/disk_stress_ng
+++ b/bin/disk_stress_ng
@@ -103,7 +103,7 @@ find_largest_partition() {
largest_size=0
mapper_string="dm-"
if [ "${disk_device#*$mapper_string}" = "$disk_device" ]; then
- partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep part | tr -s " ")
+ partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep -E 'part|lvm' | tr -s " ")
else
partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device)
fi
@@ -113,7 +113,7 @@ find_largest_partition() {
part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2)
part_location="/dev/$partition"
elif [ -b "/dev/mapper/$partition" ]; then
- part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 3)
+ part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2)
part_location="/dev/mapper/$partition"
else
echo "$partition not found!"
diff --git a/bin/network b/bin/network
index aaee226..72df643 100755
--- a/bin/network
+++ b/bin/network
@@ -62,7 +62,8 @@ class IPerfPerformanceTest(object):
protocol="tcp",
data_size="1",
run_time=None,
- scan_timeout=3600):
+ scan_timeout=3600,
+ iface_timeout=120):
self.iface = Interface(interface)
self.target = target
@@ -74,6 +75,7 @@ class IPerfPerformanceTest(object):
self.data_size = data_size
self.run_time = run_time
self.scan_timeout = scan_timeout
+ self.iface_timeout = iface_timeout
def run(self):
# if max_speed is 0, assume it's wifi and move on
@@ -474,6 +476,27 @@ def make_target_list(iface, test_targets, log_warnings):
return return_list
+# Wait until the specified interface comes up, or until iface_timeout.
+def wait_for_iface_up(iface, timeout):
+ isdown = True
+ deadline = time.time() + timeout;
+ while (time.time() < deadline) and isdown:
+ try:
+ link_status = check_output(["ip", "link", "show", "dev",
+ iface]).decode("utf-8")
+ except CalledProcessError as interface_failure:
+ logging.error("Failed to check %s:%s", iface, interface_failure)
+ return 1
+ if ("state UP" in link_status):
+ logging.debug("Interface {} is up!".format(iface))
+ isdown = False
+ else:
+ logging.debug("Interface {} not yet up; waiting....".format(iface))
+ # Sleep whether or not interface is up because sometimes the IP
+ # address gets assigned after "ip" claims it's up.
+ time.sleep(5)
+
+
def interface_test(args):
if not ("test_type" in vars(args)):
return
@@ -514,15 +537,15 @@ def interface_test(args):
# Check for an underspeed link and abort if found, UNLESS --underspeed-ok
# option was used or max_speed is 0 (which indicates a probable WiFi link)
- iface=Interface(args.interface)
+ iface = Interface(args.interface)
if iface.link_speed < iface.max_speed and iface.max_speed != 0 and \
- args.underspeed_ok == False:
+ not args.underspeed_ok:
logging.error("Detected link speed ({}) is lower than detected max "
"speed ({})".format(iface.link_speed, iface.max_speed))
logging.error("Check your device configuration and try again.")
logging.error("If you want to override and test despite this "
"under-speed link, use")
- logging.error ("the --underspeed-ok option.")
+ logging.error("the --underspeed-ok option.")
sys.exit(1)
# Back up routing table, since network down/up process
@@ -572,6 +595,7 @@ def interface_test(args):
logging.debug("Restoring interface:%s", iface)
try:
check_call(["ip", "link", "set", "dev", iface, "up"])
+ wait_for_iface_up(iface, args.iface_timeout)
except CalledProcessError as interface_failure:
logging.error("Failed to restore %s:%s", iface, interface_failure)
error_number = 3
@@ -699,6 +723,11 @@ TEST_TARGET_IPERF = iperf-server.example.com
help=("Sets the maximum time, in seconds, the test will scan for "
"iperf servers before giving up."))
test_parser.add_argument(
+ '--iface-timeout', type=int,
+ default=120,
+ help=("Sets the maximum time, in seconds, the test will wait for "
+ "an interface to come up after a test before giving up."))
+ test_parser.add_argument(
'--config', type=str,
default="/etc/checkbox.d/network.cfg",
help="Supply config file for target/host network parameters")
diff --git a/bin/pm_test b/bin/pm_test
index 481b566..c555ab5 100755
--- a/bin/pm_test
+++ b/bin/pm_test
@@ -5,15 +5,16 @@ import os
import pwd
import re
import shutil
+import signal
import subprocess
import sys
-import signal
-
from argparse import ArgumentParser, SUPPRESS
from calendar import timegm
+from configparser import ConfigParser
from datetime import datetime, timedelta
-from gi.repository import Gtk, GObject
-from time import time, localtime
+from time import localtime, time
+
+from gi.repository import GObject, Gtk
def main():
@@ -28,7 +29,7 @@ def main():
'permissions to run correctly\n')
sys.exit(1)
- #Obtain name of the invoking user.
+ # Obtain name of the invoking user.
uid = os.getenv('SUDO_UID') or os.getenv('PKEXEC_UID')
if not uid:
sys.stderr.write('Unable to determine invoking user\n')
@@ -60,7 +61,7 @@ def main():
return 0
-class PowerManagementOperation(object):
+class PowerManagementOperation():
SLEEP_TIME = 5
def __init__(self, args, extra_args, user=None):
@@ -140,9 +141,11 @@ class PowerManagementOperation(object):
script_path = ''
if fwts:
script_path = 'checkbox-support-fwts_test'
- command_tpl = '-s s3 --s3-device-check --s3-sleep-delay=30 --s3-multiple={}'
+ command_tpl = '-s s3 --s3-device-check ' \
+ '--s3-sleep-delay=30 --s3-multiple={}'
if self.args.log_dir:
- command_tpl = '--log={}/fwts.log '.format(self.args.log_dir) + command_tpl
+ command_tpl = '--log={}/fwts.log '.format(
+ self.args.log_dir) + command_tpl
command_tpl = '{} ' + command_tpl
else:
script_name = 'sleep_test'
@@ -154,9 +157,10 @@ class PowerManagementOperation(object):
logging.debug('Executing: {0!r}...'.format(command_str))
try:
# We call sleep_test or fwts_test script and log its output as it
- # contains average times we need to compute global average times later.
- logging.info(subprocess.check_output(command_str,
- universal_newlines=True, shell=True))
+ # contains average times we need to compute global average times
+ # later.
+ logging.info(subprocess.check_output(
+ command_str, universal_newlines=True, shell=True))
except subprocess.CalledProcessError as e:
logging.error('Error while running {0}:'.format(e.cmd))
logging.error(e.output)
@@ -183,9 +187,9 @@ class PowerManagementOperation(object):
else:
sleep_time = timedelta(seconds=self.args.wakeup)
- wait_time = timedelta(seconds=(self.args.pm_delay
- + (self.args.hardware_delay)
- * self.args.total))
+ wait_time = timedelta(seconds=(self.args.pm_delay +
+ self.args.hardware_delay *
+ self.args.total))
average = (end - start - wait_time) / self.args.total - sleep_time
time_message = ('Total elapsed time: {total}\n'
'Average recovery time: {average}'
@@ -202,7 +206,8 @@ class PowerManagementOperation(object):
MessageDialog(title, message).run()
if self.args.checkbox_respawn_cmd:
subprocess.run(
- r'DISPLAY=:0 x-terminal-emulator -e "sudo -u {} bash -c \"source {}; exec bash\""'.format(
+ 'DISPLAY=:0 x-terminal-emulator -e "sudo -u '
+ '{} bash -c \"source {}; exec bash\""'.format(
self.user, self.args.checkbox_respawn_cmd), shell=True)
def teardown(self):
@@ -228,7 +233,7 @@ class TestFailed(Exception):
MESSAGE = '{0} test failed'
-class WakeUpAlarm(object):
+class WakeUpAlarm():
ALARM_FILENAME = '/sys/class/rtc/rtc0/wakealarm'
RTC_FILENAME = '/proc/driver/rtc'
@@ -271,8 +276,10 @@ class WakeUpAlarm(object):
logging.error(e)
sys.exit(1)
- if ((abs(wakeup_time_utc - wakeup_time_stored) > 1) and
- (abs(wakeup_time_local - wakeup_time_stored) > 1)):
+ if (
+ (abs(wakeup_time_utc - wakeup_time_stored) > 1) and
+ (abs(wakeup_time_local - wakeup_time_stored) > 1)
+ ):
logging.error('Wakeup time not stored correctly')
sys.exit(1)
@@ -297,7 +304,7 @@ class WakeUpAlarm(object):
sys.exit(1)
-class Command(object):
+class Command():
"""
Simple subprocess.Popen wrapper to run shell commands
and log their output
@@ -392,8 +399,8 @@ class CountdownDialog(Gtk.Dialog):
# In last iteration, wait before gathering hardware information
# and perform pm-operation
self.events = [operation_event,
- hardware_info_event,
- system_info_event]
+ hardware_info_event,
+ system_info_event]
else:
# In last iteration, wait before gathering hardware information
# and finish the test
@@ -502,15 +509,15 @@ class CountdownDialog(Gtk.Dialog):
logging.info('Gathering system information...')
# FIXME: Commented out as it created huge log files
# during stress tests.
- #logging.debug('--- beginning of dmesg ---')
- #logging.debug(Command('dmesg').run().stdout)
- #logging.debug('--- end of dmesg ---')
- #logging.debug('--- beginning of syslog ---')
- #logging.debug(Command('cat /var/log/syslog').run().stdout)
- #logging.debug('--- end of syslog ---')
+ # logging.debug('--- beginning of dmesg ---')
+ # logging.debug(Command('dmesg').run().stdout)
+ # logging.debug('--- end of dmesg ---')
+ # logging.debug('--- beginning of syslog ---')
+ # logging.debug(Command('cat /var/log/syslog').run().stdout)
+ # logging.debug('--- end of syslog ---')
-class MessageDialog(object):
+class MessageDialog():
"""
Simple wrapper aroung Gtk.MessageDialog
"""
@@ -529,37 +536,47 @@ class MessageDialog(object):
dialog.destroy()
-class AutoLoginConfigurator(object):
+class AutoLoginConfigurator():
"""
Enable/disable autologin configuration
to make sure that reboot test will work properly
"""
- CONFIG_FILENAME = '/etc/lightdm/lightdm.conf'
- TEMPLATE = """
+ def __init__(self, user=None):
+ self.user = user
+ self.config_filename = '/etc/lightdm/lightdm.conf'
+ self.template = """
[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
autologin-user={username}
autologin-user-timeout=0
"""
-
- def __init__(self, user=None):
- self.user = user
+ if os.path.exists('/etc/gdm3/custom.conf'):
+ self.config_filename = '/etc/gdm3/custom.conf'
+ self.parser = ConfigParser()
+ self.parser.optionxform = str
+ self.parser.read(self.config_filename)
+ self.parser.set('daemon', 'AutomaticLoginEnable', 'True')
+ if self.user:
+ self.parser.set('daemon', 'AutomaticLogin', self.user)
def enable(self):
"""
Make sure user will autologin in next reboot
"""
logging.debug('Enabling autologin for this user...')
- if os.path.exists(self.CONFIG_FILENAME):
+ if os.path.exists(self.config_filename):
for backup_filename in self.generate_backup_filename():
if not os.path.exists(backup_filename):
- shutil.copyfile(self.CONFIG_FILENAME, backup_filename)
- shutil.copystat(self.CONFIG_FILENAME, backup_filename)
+ shutil.copyfile(self.config_filename, backup_filename)
+ shutil.copystat(self.config_filename, backup_filename)
break
- with open(self.CONFIG_FILENAME, 'w') as f:
- f.write(self.TEMPLATE.format(username=self.user))
+ with open(self.config_filename, 'w') as f:
+ if self.config_filename == '/etc/lightdm/lightdm.conf':
+ f.write(self.template.format(username=self.user))
+ elif self.config_filename == '/etc/gdm3/custom.conf':
+ self.parser.write(f)
def disable(self):
"""
@@ -575,24 +592,24 @@ autologin-user-timeout=0
backup_filename = filename
if backup_filename:
- shutil.copy(backup_filename, self.CONFIG_FILENAME)
+ shutil.copy(backup_filename, self.config_filename)
os.remove(backup_filename)
else:
- os.remove(self.CONFIG_FILENAME)
+ os.remove(self.config_filename)
def generate_backup_filename(self):
- backup_filename = self.CONFIG_FILENAME + '.bak'
+ backup_filename = self.config_filename + '.bak'
yield backup_filename
index = 0
while True:
index += 1
- backup_filename = (self.CONFIG_FILENAME
- + '.bak.{0}'.format(index))
+ backup_filename = (self.config_filename +
+ '.bak.{0}'.format(index))
yield backup_filename
-class SudoersConfigurator(object):
+class SudoersConfigurator():
"""
Enable/disable reboot test to be executed as root
to make sure that reboot test works properly
@@ -629,7 +646,7 @@ class SudoersConfigurator(object):
Command(command, verbose=False).run()
-class AutoStartFile(object):
+class AutoStartFile():
"""
Generate autostart file contents and write it to proper location
"""
@@ -711,7 +728,7 @@ Hidden=false
os.remove(self.desktop_filename)
-class LoggingConfiguration(object):
+class LoggingConfiguration():
@classmethod
def set(cls, log_level, log_filename, append):
"""
@@ -744,7 +761,7 @@ class LoggingConfiguration(object):
log_handler.doRollover()
-class MyArgumentParser(object):
+class MyArgumentParser():
"""
Command-line argument parser
"""
@@ -828,7 +845,7 @@ class MyArgumentParser(object):
# suspend cycles before reboot
parser.add_argument('--suspends-before-reboot', type=int, default=0,
help=('How many cycles of suspend/resume to run'
- 'before each reboot or poweroff'))
+ 'before each reboot or poweroff'))
# use fwts for suspend tests
parser.add_argument('--fwts', action='store_true', help=('Use fwts '
diff --git a/debian/.git-dpm b/debian/.git-dpm
index c4b01cd..9c02d15 100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@ -1,8 +1,8 @@
# see git-dpm(1) from git-dpm package
-b3f24fb38ac39af2a93399556f622db0216577a5
-b3f24fb38ac39af2a93399556f622db0216577a5
-b3f24fb38ac39af2a93399556f622db0216577a5
-b3f24fb38ac39af2a93399556f622db0216577a5
-plainbox-provider-checkbox_0.43.0.orig.tar.gz
-dafb26f938f6649039461ef12875dd5985643c73
-1738426
+475ae5879f4b72a4c198cf451bf23086d6f6e0d9
+475ae5879f4b72a4c198cf451bf23086d6f6e0d9
+475ae5879f4b72a4c198cf451bf23086d6f6e0d9
+475ae5879f4b72a4c198cf451bf23086d6f6e0d9
+plainbox-provider-checkbox_0.44.0.orig.tar.gz
+c213a1fbe04bcd7c4fd8b2c7764b9f06ebefb247
+1739119
diff --git a/manage.py b/manage.py
index ff9a656..a133b7a 100755
--- a/manage.py
+++ b/manage.py
@@ -5,7 +5,7 @@ from plainbox.provider_manager import N_
setup(
name='plainbox-provider-checkbox',
namespace='com.canonical.certification',
- version="0.43.0",
+ version="0.44.0",
description=N_("Checkbox provider"),
gettext_domain='plainbox-provider-checkbox',
strict=False, deprecated=False,
diff --git a/units/info/jobs.pxu b/units/info/jobs.pxu
index 2e21195..5d86eca 100644
--- a/units/info/jobs.pxu
+++ b/units/info/jobs.pxu
@@ -171,7 +171,7 @@ command:
estimated_duration: 6.344
_summary: Attach detailed sysfs property output from udev
requires:
- model_assertion.model != "dragonboard"
+ cpuinfo.platform not in ("aarch64")
id: udev_attachment
plugin: attachment
@@ -347,6 +347,8 @@ command:
cat /etc/buildstamp
elif [ -e /var/lib/snapd/seed/seed.yaml ]; then
echo && date -r /var/lib/snapd/seed/seed.yaml -R
+ else
+ exit 1
fi
plugin: shell
diff --git a/units/miscellanea/jobs.pxu b/units/miscellanea/jobs.pxu
index 2071f06..59e41c2 100644
--- a/units/miscellanea/jobs.pxu
+++ b/units/miscellanea/jobs.pxu
@@ -357,21 +357,3 @@ user: root
command:
SOSFILE=`ls -t $PLAINBOX_SESSION_SHARE/sosreport*xz | head -1`; [ -e ${SOSFILE} ] && cat $SOSFILE
_summary: Attach the baseline sosreport file
-
-plugin: shell
-category_id: com.canonical.plainbox::miscellanea
-estimated_duration: 0.5
-id: miscellanea/call-trace-check
-command: if [ -n "$(grep "Call Trace:" /var/log/syslog)" ]; then echo "Call Trace detected in syslog"; false; else true; fi
-_summary: Check syslog for call traces
-_description: Checks syslog for call traces after testing is complete.
-flags: preserve-locale
-
-plugin: attachment
-category_id: com.canonical.plainbox::miscellanea
-estimated_duration: 0.5
-id: miscellanea/attach-syslog
-command: if [ -n "$(grep "Call Trace:" /var/log/syslog)" ]; then cat /var/log/syslog; fi
-_summary: Attach syslog if Call Trace appears
-_description: Attaches a copy of syslog if call traces are present after testing is complete.
-flags: preserve-locale
diff --git a/units/stress/test-plan.pxu b/units/stress/test-plan.pxu
index 659e04e..4286443 100644
--- a/units/stress/test-plan.pxu
+++ b/units/stress/test-plan.pxu
@@ -67,9 +67,9 @@ unit: test plan
_name: Power Management reboot and power off stress tests (automated)
_description: Power Management reboot and power off stress tests (automated)
include:
- stress/reboot_30
+ stress/reboot_30 certification-status=blocker
stress/reboot_30_log
- stress/poweroff_30
+ stress/poweroff_30 certification-status=blocker
stress/poweroff_30_log
id: stress-ng-cert-automated
diff --git a/units/submission/jobs.pxu b/units/submission/jobs.pxu
index f6f73bc..43defe3 100644
--- a/units/submission/jobs.pxu
+++ b/units/submission/jobs.pxu
@@ -22,9 +22,9 @@ requires:
user: root
command:
dmidecode -t bios -t system | python3 -m plainbox dev parse dmidecode | \
- jq '[.[0]."_attributes" +
- {"category": .[0]."category"}, .[1]."_attributes" +
- {"category": .[1]."category"}]'
+ jq '[.[0]._attributes +
+ {"category": .[0].category}, .[1]._attributes +
+ {"category": .[1].category}]'
estimated_duration: 1
_description: Attaches dmidecode output
_summary: Attaches json dumps of udev_resource raw dmi devices