Meego Wiki
Views

Quality/TestSuite/Camera Driver Test Specification

From MeeGo wiki
< Quality | TestSuite
Revision as of 11:26, 22 September 2010 by Iekku (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

Blts-v4l2 package is meant to test v4l2 functionality. The blts-v4l2 package tests camera driver functionality by checking e.g. capabilities and controls. There is also tests that stream frames (using XVideo) and take snapshots (saved as JPG pictures) using different resolutions. Some of these test cases also measure FPS rates.

Test Coverage

The test cases are:

  • Core-Camera-Open device: Try to open a V4L2 device
  • Core-Camera-Read device: Open V4L2 device to requested width and height
  • Core-Camera-Check device controls: Enumerate through V4L2 device controls
  • Core-Camera-Check device capabilites: Check and print V4L2 device capabilities
  • Core-Camera-Check device formats: Enumerate and print V4L2 device formats
  • Core-Camera-Measure device stepping down resolution: Step down resolutions and calculate FPS using V4L2 device
  • Core-Camera-Stream from device to screen: Stream frames from V4L2 device to screen using XVideo
  • Core-Camera-Measure device FPS with defined resolution: Use a given resolution and calculate FPS using V4L2 device
  • Core-Camera-Take picture as JPEG with device: Take one frame from V4L2 device and create a JPG file
  • Core-Camera-Device enumeration: Enumerate V4L2 input and output devices and print supported standards
  • Core-Camera-Stream from device and crop corners: Stream frames from V4L2 device to screen using XVideo and use cropping
  • Core-Camera-Read from device using poll: As "Measure device FPS", but use poll() to detect device readiness.
  • Core-Camera-Test standard control settings: Enumerate all standard controls, and test each available control with suitable values
  • Core-Camera-Test extended control settings: Enumerate all extended controls, and test each available control with suitable values
  • Core-Camera-Check device FD priority: Init a device and check if it supports priorities
  • Core-Camera-Stream from device and vary frame rate: Stream frames from V4L2 device to screen and vary frame rates and calculate FPS
  • Core-Camera-Get stream quality setting: Stream frames from V4L2 and get the quality setting
  • Core-Camera-Set stream quality setting to high: Set stream quality setting to high, stream from the device and check the setting is used
  • Core-Camera-Check debug capability: Get state from driver to kernel log, API function doesn't need to be supported
  • Core-Camera-Select output and stream: Selects and tests possible outputs of device
  • Core-Camera-Select input and stream: Selects and tests possible inputs of device.
  • Core-Camera-Test input device standards: Loops through V4L2 input devices and tests video standards

Software Coverage

Current IOCTL coverage for v4l2 tests (experimental and not-in-scope ioctls removed from v4l2 API):

  • blts-v4l2-ioctl-coverage-full.ods
  • blts-v4l2-ioctl-coverage-in-scope.ods

Hardware Coverage

At the moment tests cases are configured to test main and front cameras

Limitations

  • Test suite functionality depends on implementation of used device driver in v4l2.

Future Improvements

  • More coverage with tests for v4l2.

Running the tests

Executing tests

Compile blts-v4l2-tests with corresponding environment
$ dpkg-buildpackage
and install package to DUT.
Execute from host end command line:
$ blts-v4l2

Test case arguments

Arguments:

Switch Function
-l Used log file, Used log file, default blts_v4l2_log
-e Execute single or multiple selected tests, for example -e 1,4,5.
-en Execute test by name, for example -en "My test X"
-s Show list of all tests
-? Help message
-nc Do not output log to terminal
Optional switch Function
-p Print ioctl profiling data
-i Save camera snapshot images to disk in control settings tests, and optionally verify them. Image save path and the verification tool are specified by the image_save_path and image_verify_tool configuration parameters.
-C Use parameter configuration file

Test cases must be run with root priviliges.

Test cases

Test case execution notices:

Case name Notice
Core-Camera-Open device
Core-Camera-Read device
Core-Camera-Check device controls
Core-Camera-Check device capabilites
Core-Camera-Check device formats
Core-Camera-Measure device stepping down resolution
Core-Camera-Stream from device to screen
Core-Camera-Measure device FPS with defined resolution
Core-Camera-Take picture as JPEG with device
Core-Camera-Device enumeration
Core-Camera-Stream from device and crop corners
Core-Camera-Read from device using poll
Core-Camera-Test standard control settings
Core-Camera-Test extended control settings
Core-Camera-Check device FD priority
Core-Camera-Stream from device and vary frame rate
Core-Camera-Get stream quality setting
Core-Camera-Set stream quality setting to high
Core-Camera-Check debug capability
Core-Camera-Select output and stream
Core-Camera-Select input and stream
Core-Camera-Test input device standards

Test cases with variables

To run test case with variable data you need to specify where configuration file is located. You can edit the configuration file yourself. To run "Core-Camera-Stream from device to screen" case you can use: blts-v4l2 -l /var/log/tests/Core-Camera-Stream_from_device_to_screen.log -en "Core-Camera-Stream from device to screen" -C example-blts-v4l2.cnf

Example of Stream case variation (example-blts-v4l2.cnf):

# Valid video devices for HW.
[parameter]
   name video_device
   const "/dev/video0" "/dev/video1"
[end_parameter]

[parameter]
   name io_method_stream
   const "MMAP" "userptr"
[end_parameter]

# Pixel formats (fourcc, as kernel v4l2 entries)
[parameter]
   name camera_pixel_format
   const "YUYV"
[end_parameter]

[parameter]
   name camera_resolution_stream_all
   const "4016x3016" "2400x1812" "848x480" "640x480" "320x240"
[end_parameter]

[test]
   name "Core-Camera-Stream from device to screen"
   params video_device camera_pixel_format io_method_stream camera_resolution_stream_all
[end_test]

Control test configuration

Image verification

The standard and extended control tests support verification of the camera snapshot image using an external tool. Image verification is enabled by specifying values for the image_save_path and image_verify_tool global configuration parameters, and by giving the -i command line flag when running the test. Once a camera snapshot has been saved for a certain control setting, the tool given in image_verify_tool is run with a command line like this: verify_tool <snapshot image name> <control name> <V4L2 control id> <control value>

The verification tool should return zero when the image is verified successfully, and a non-zero value when the verification fails. The output of the tool is appended to the log file of the test.

Control value limits and test values

The minimum and maximum values reported by the V4L2 driver can be compared with values specified in the configuration file. The test succeeds if the values match exactly, and fails otherwise. The minimum and maximum values are specified as global configuration parameters, with a special naming format:

dev<number of device>_<escaped control name>_min = <minimum value> dev<number of device>_<escaped control name>_max = <maximum value>

As the global configuration value identifiers cannot contain spaces or any of the /()[] characters, which may be present in the name of a V4L2 control, the control name must be escaped by replacing spaces with underscores, and by removing any prohibited characters from the name. For example, values for the control named Exposure Time (us) on the device /dev/video0 could be provided like this:

dev0_Exposure_Time_us_min = 1000 dev0_Exposure_Time_us_max = 100000

By default, the control tests use the minimum and maximum values reported by the V4L2 driver to test a control. Additional test values can be provided as global configuration parameters in the configuration file, using a format similar to the min/max format:

dev<number of device>_<escaped control name>_testvalues = "<space-delimited list of values>"

For example:

dev0_Exposure_Time_us_testvalues = "25000 50000 75000"

Module Design and Architecture

Architecture diagram

References

linux.bytesex.org video4linux website
www.linuxtv.org The LinuxTV project website

Change History

Version Date Handled By Status Comments
0.1 22-sep-2010 Iekku Huttunen Draft Page created
Personal tools