summaryrefslogtreecommitdiff
diff options
-rwxr-xr-xbin/camera_test41
-rwxr-xr-xbin/fwts_test57
-rwxr-xr-xmanage.py2
-rw-r--r--po/pl.po2
4 files changed, 78 insertions, 24 deletions
diff --git a/bin/camera_test b/bin/camera_test
index 4e2aff12..c3e554c5 100755
--- a/bin/camera_test
+++ b/bin/camera_test
@@ -26,20 +26,22 @@
# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
#
+import argparse
+import ctypes
+import errno
+import fcntl
+import imghdr
+import logging
import os
import re
+import struct
import sys
import time
-import errno
-import fcntl
-import ctypes
-import struct
-import imghdr
-from tempfile import NamedTemporaryFile
-from subprocess import check_call, CalledProcessError, STDOUT
-import argparse
-from glob import glob
+
from gi.repository import GObject
+from glob import glob
+from subprocess import check_call, CalledProcessError, STDOUT
+from tempfile import NamedTemporaryFile
_IOC_NRBITS = 8
@@ -189,8 +191,8 @@ class CameraTest:
print(" driver : %s" % cp.driver.decode('UTF-8'))
print(" version: %s.%s.%s"
% (cp.version >> 16,
- (cp.version >> 8) & 0xff,
- cp.version & 0xff))
+ (cp.version >> 8) & 0xff,
+ cp.version & 0xff))
print(" flags : 0x%x [" % cp.capabilities,
' CAPTURE' if cp.capabilities & V4L2_CAP_VIDEO_CAPTURE
else '',
@@ -205,7 +207,7 @@ class CameraTest:
resolutions = self._get_supported_resolutions(device)
print(' ',
self._supported_resolutions_to_string(resolutions).replace(
- "\n", " "),
+ "\n", " "),
sep="")
if cp.capabilities & V4L2_CAP_VIDEO_CAPTURE:
@@ -223,6 +225,7 @@ class CameraTest:
% {'device': self.args.device,
'type': self._gst_video_type,
'plugin': self._gst_plugin})
+ logging.debug("LED test with pipeline %s", pipespec)
self._pipeline = Gst.parse_launch(pipespec)
self._pipeline.set_state(Gst.State.PLAYING)
time.sleep(10)
@@ -241,6 +244,7 @@ class CameraTest:
'width': self._width,
'height': self._height,
'plugin': self._gst_plugin})
+ logging.debug("display test with pipeline %s", pipespec)
self._pipeline = Gst.parse_launch(pipespec)
self._pipeline.set_state(Gst.State.PLAYING)
time.sleep(10)
@@ -289,6 +293,8 @@ class CameraTest:
'height': height,
'plugin': self._gst_plugin,
'filename': filename})
+ logging.debug("still test with gstreamer and "
+ "pipeline %s", pipespec)
self._pipeline = Gst.parse_launch(pipespec)
self._pipeline.set_state(Gst.State.PLAYING)
time.sleep(3)
@@ -425,8 +431,8 @@ class CameraTest:
# for continuous and stepwise, let's just use min and
# max they use the same structure and only return
# one result
- elif framesize.type == V4L2_FRMSIZE_TYPE_CONTINUOUS or\
- framesize.type == V4L2_FRMSIZE_TYPE_STEPWISE:
+ elif (framesize.type in (V4L2_FRMSIZE_TYPE_CONTINUOUS,
+ V4L2_FRMSIZE_TYPE_STEPWISE)):
resolutions.append([framesize.stepwise.min_width,
framesize.stepwise.min_height]
)
@@ -494,6 +500,10 @@ def parse_arguments(argv):
title='test',
description='Available camera tests')
+ parser.add_argument('--debug', dest='log_level',
+ action="store_const", const=logging.DEBUG,
+ default=logging.INFO, help="Show debugging messages")
+
def add_device_parameter(parser):
group = parser.add_mutually_exclusive_group()
group.add_argument("-d", "--device", default="/dev/video0",
@@ -504,7 +514,6 @@ def parse_arguments(argv):
group.add_argument("--lowest-device", action="store_true",
help=("Use the /dev/videoN "
"where N is the lowest value available"))
-
subparsers.add_parser('detect')
led_parser = subparsers.add_parser('led')
add_device_parameter(led_parser)
@@ -540,6 +549,8 @@ if __name__ == "__main__":
if not args.test:
args.test = 'detect'
+ logging.basicConfig(level=args.log_level)
+
# Import Gst only for the test cases that will need it
if args.test in ['display', 'still', 'led', 'resolutions']:
from gi.repository import Gst
diff --git a/bin/fwts_test b/bin/fwts_test
index 646c2df2..029c1ec9 100755
--- a/bin/fwts_test
+++ b/bin/fwts_test
@@ -6,7 +6,8 @@ from time import time
from argparse import ArgumentParser, RawTextHelpFormatter, REMAINDER
from subprocess import Popen, PIPE
from syslog import *
-
+from distutils.spawn import find_executable
+import os
# These tests require user interaction and need either special handling
# or skipping altogether (right now, we skip them but they're kept here
@@ -137,6 +138,20 @@ def fix_sleep_args(args):
return new_args
+def detect_progress_indicator():
+ # Return a command suitable for piping progress information to its
+ # stdin (invoked via Popen), in list format.
+ # Return zenity if installed and DISPLAY (--auto-close)
+ # return dialog if installed and no DISPLAY (width height)
+ display = os.environ.get('DISPLAY')
+ if display and find_executable('zenity'):
+ return ["zenity", "--progress", "--text", "Progress", "--auto-close"]
+ if not display and find_executable('dialog'):
+ return ["dialog", "--gauge", "Progress", "20", "70"]
+ # Return None if no progress indicator is to be used
+ return None
+
+
def main():
description_text = 'Tests the system BIOS using the Firmware Test Suite'
epilog_text = ('To perform sleep testing, you will need at least some of '
@@ -260,10 +275,10 @@ def main():
print('\n'.join(TESTS))
return 0
elif args.list_cert:
- print('\n'.join(NON_CERT_TESTS))
+ print('\n'.join(CERT_TESTS))
return 0
elif args.list_advanced:
- print('\n'.join(CERT_TESTS))
+ print('\n'.join(NON_CERT_TESTS))
return 0
elif args.test:
tests.extend(args.test)
@@ -308,6 +323,10 @@ def main():
if args.sleep:
iteration_results = {}
print('=' * 20 + ' Test Results ' + '=' * 20)
+ progress_indicator = None
+ if detect_progress_indicator():
+ progress_indicator = Popen(detect_progress_indicator(),
+ stdin=PIPE)
for iteration in range(0, iterations):
timestamp = int(time())
start_marker = 'CHECKBOX SLEEP TEST START %s' % timestamp
@@ -324,12 +343,36 @@ def main():
args.sleep_time,
args.resume_time)
iteration_results[iteration] = sleep_times
- print(' - Cycle %s: Status: %s Sleep Elapsed: %0.5f '
- 'Resume Elapsed: '
- ' %0.5f' % (iteration,
+ progress_tuple = (iteration,
iteration_results[iteration][0],
iteration_results[iteration][1],
- iteration_results[iteration][2]))
+ iteration_results[iteration][2])
+ progress_string = (' - Cycle %s: Status: %s '
+ 'Sleep Elapsed: %0.5f '
+ 'Resume Elapsed: '
+ ' %0.5f' % progress_tuple)
+ progress_pct = "{}".format(int(100 * iteration / iterations))
+ if "zenity" in detect_progress_indicator():
+ progress_indicator.stdin.write("# {}\n".format(
+ progress_string).encode('utf-8'))
+ progress_indicator.stdin.write("{}\n".format(
+ progress_pct).encode('utf-8'))
+ progress_indicator.stdin.flush()
+ elif "dialog" in detect_progress_indicator():
+ progress_indicator.stdin.write("XXX\n".encode('utf-8'))
+ progress_indicator.stdin.write(
+ progress_pct.encode('utf-8'))
+ progress_indicator.stdin.write(
+ "\nTest progress\n".encode('utf-8'))
+ progress_indicator.stdin.write(
+ progress_string.encode('utf-8'))
+ progress_indicator.stdin.write(
+ "\nXXX\n".encode('utf-8'))
+ progress_indicator.stdin.flush()
+ else:
+ print(progress_string)
+ progress_indicator.terminate()
+
if 's4' not in args.sleep:
average_times(iteration_results)
for run in iteration_results.keys():
diff --git a/manage.py b/manage.py
index 673041b9..2a9e2419 100755
--- a/manage.py
+++ b/manage.py
@@ -4,7 +4,7 @@ from plainbox.provider_manager import N_
setup(
name='2013.com.canonical.certification:checkbox',
- version="0.12",
+ version="0.13",
description=N_("Checkbox provider"),
gettext_domain='2013.com.canonical.certification.checkbox',
strict=False, deprecated=False,
diff --git a/po/pl.po b/po/pl.po
index f9bf29a6..6c9f850c 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-09-19 06:04+0000\n"
+"X-Launchpad-Export-Date: 2014-09-27 05:37+0000\n"
"X-Generator: Launchpad (build 17196)\n"
"Language: Polish\n"