Meego Wiki
Views

Quality/TestSuite/USB Driver Test Specification

From MeeGo wiki
< Quality | TestSuite(Difference between revisions)
Jump to: navigation, search
(Created page with "== Introduction == USB peripheral test cases are made between host (e.g. PC) and peripheral gadget (e.g. N810/N900). Both ends have their own drivers which communicate and transf…")
m (Configuration package)
 
(11 intermediate revisions not shown)
Line 1: Line 1:
== Introduction ==
== Introduction ==
-
USB peripheral test cases are made between host (e.g. PC) and peripheral gadget (e.g. N810/N900). Both ends have their own drivers which communicate and transfer data between different endpoints.  
+
 
 +
blts-usb package (0.0.14) is test driver using USB host and peripheral devices.
 +
 
 +
USB peripheral test cases are made between host (e.g. PC) and peripheral gadget (e.g. N900). Both ends have their own drivers which communicate and transfer data between different endpoints.
== Test Coverage ==
== Test Coverage ==
Line 9: Line 12:
* USB - Read test  
* USB - Read test  
* USB - Write test  
* USB - Write test  
-
Current coverage for USB tests:
 
-
* USB-coverage.ods
 
   
   
===  Software Coverage ===  
===  Software Coverage ===  
 +
 +
Current coverage for USB tests:
 +
* [[http://gitorious.org/qa-tools/mcts-coverage/blobs/master/USB-core-coverage.ods USB-coverage.ods]]
===  Hardware Coverage ===  
===  Hardware Coverage ===  
-
USB bulk and isochronous endpoint transfer test cases. Those who know more about USB transfer can also alter endpoint configurations via configuration files. Example configurations are provided with the test package.  
+
Configurable USB endpoint transfer test cases.  
===  Limitations ===  
===  Limitations ===  
Line 24: Line 28:
===  Future Improvements ===  
===  Future Improvements ===  
-
* Support for simultaneous data transfer on multiple endpoints.
 
* Automated test execution and peripheral DUT driver selection.  
* Automated test execution and peripheral DUT driver selection.  
-
* Official unique USB driver ID.  
+
* Official unique USB driver ID.
== Running the tests ==
== Running the tests ==
Line 35: Line 38:
* Supported USB cable  
* Supported USB cable  
* Device with USB host capability (e.g. PC)  
* Device with USB host capability (e.g. PC)  
-
* Device with USB peripheral capability (e.g. N900)  
+
* Device with USB peripheral capability (e.g. Nokia N810/N900)  
-
How to setup test enviroment:  
+
How to setup test environment:  
# Make sure usb cable is disconnected between devices  
# Make sure usb cable is disconnected between devices  
# Set up host side (e.g. PC) by running test 'USB - Setup host driver'
# Set up host side (e.g. PC) by running test 'USB - Setup host driver'
Line 44: Line 47:
# Execute tests  
# Execute tests  
-
NOTE: Before executing test cases it must be determined if used devices are capable of acting as peripheral or host. This depends on USB controller chips of devices and necessary information should be available from device vendors. Furthermore, current gadget driver implementation is built over MUSB driver implementation available in Linux kernel. Possible different implementations by device vendors may cause incompatibility with this test driver. <br>
+
NOTE: Before executing test cases it must be determined if used devices are capable of acting as peripheral or host. This depends on USB controller chips of devices and necessary information should be available from device vendors.<br>
 +
 
 +
To run test cases, execute the command:
 +
 
<code>$ blts_usb_testrunner -C [config file] -e [test number]</code>
<code>$ blts_usb_testrunner -C [config file] -e [test number]</code>
-
===  Configuration files ===  
+
The test environment must have following packages installed:
 +
;*[[../BLTS Common Library | libbltscommon1]]
 +
 
 +
===Building packages===
 +
 
 +
The build environment must have the following packages installed:
 +
 
 +
;*[[../BLTS Common Library | libbltscommon-devel]]
 +
;* kernel-devel
 +
 
 +
{{:Quality/TestSuite/Building_BLTS_Packages}}
 +
 
 +
===  Configuration package ===  
 +
 
 +
The blts-usb package is dependent on blts-usb-tests-config configuration file package. The packaging script pack.sh creates RPM package blts-usb-tests-config-example_{version}.rpm and it must be installed first. The configuration files are copied in the test device during RPM installation. 
 +
 
 +
The configuration file package can be installed in the device with a command:
 +
 
 +
<pre>
 +
rpm -ivh blts-usb-tests-config-example_{version}.rpm
 +
</pre>
 +
 
This test asset uses two configuration files: One for generic test execution options and one for endpoint configuration. Endpoint configuration file is linked to base configuration files thus only base file path is given as parameter. Configuration files must be used, as they contain endpoint configuration for driver.  
This test asset uses two configuration files: One for generic test execution options and one for endpoint configuration. Endpoint configuration file is linked to base configuration files thus only base file path is given as parameter. Configuration files must be used, as they contain endpoint configuration for driver.  
-
Currently following example base configuration files are included in the package:  
+
Currently following example base configuration file is included in the package:  
-
* blts-usb-testrunner-bulk.cnf
+
* blts-usb-testrunner-default.cnf
-
* blts-usb-testrunner-int.cnf
+
-
* blts-usb-testrunner-isoc.cnf  
+
-
The base files are linked to endpoint configuration files and following examples are provided with test package:  
+
The base files are linked to endpoint configuration files and following example is provided with test package:  
-
* ep-configuration-bulk.cfg
+
* ep-configuration-default.cfg
-
* ep-configuration-int.cfg
+
-
* ep-configuration-isoc.cfg  
+
-
NOTE: Supported endpoint configurations differ from device to device and they should be modified according to test execution requirements. These configuration files are provided as examples and should not be used as such during proper test execution.  
+
NOTE: Supported endpoint configurations differ from device to device and they should be modified according to test execution requirements. These configuration files are provided as examples and should not be used as such during proper test execution.
-
=== Common test execution guidelines ===
+
For further instructions on creating and using configuration files, see [[Quality/TestSuite/USB_Driver_Test_Specification#Configuration_file_examples|Configuration file examples]].
 +
 
 +
===Test asset specific instructions===
 +
 
 +
The test package can be installed in the device by executing the command:
 +
 
 +
<pre>
 +
rpm -ivh blts-usb-tests_{version}.rpm
 +
</pre>
 +
 
 +
'''Common test execution guidelines'''
NOTE:  
NOTE:  
-
* Default config files are installed to /usr/share/blts-usb-tests/.
+
* Default config files are installed to /etc/blts  
* Drivers must be initialized before running other test cases.  
* Drivers must be initialized before running other test cases.  
* All USB cables MUST be disconnected when executing initializations!  
* All USB cables MUST be disconnected when executing initializations!  
-
NOTE: All other gadget drivers MUST be unloaded before test execution in used DUT!  
+
NOTE:  
 +
All other gadget drivers MUST be unloaded before test execution in used DUT!  
You can use command lsmod to determine which modules are loaded in memory:  
You can use command lsmod to determine which modules are loaded in memory:  
Line 82: Line 116:
<u>Arguments: </u>
<u>Arguments: </u>
-
 
+
{{:Quality/TestSuite/Common_General_Switch}}
-
{|cellspacing="0" border="1"
+
{|style="width:100%" cellspacing="0" border="1"
-
!|Switch  
+
!style="width:20%"|Optional Switch  
-
!|Function
+
!style="width:80%"|Function  
-
 
+
-
|-
+
-
|| -C || Used parameter configuration file
+
-
|-
+
-
|| -l  || Used log file, default blts_skeleton_run.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
+
|-
|-
|| -h || Use given host driver (default: blts_usb_host), for example -h blts_usb_host   
|| -h || Use given host driver (default: blts_usb_host), for example -h blts_usb_host   
Line 111: Line 127:
-
===  Test cases ===  
+
===  Running test cases ===  
Test case execution notices:  
Test case execution notices:  
{|cellspacing="0" border="1"
{|cellspacing="0" border="1"
Line 127: Line 143:
''* This test is run on host device.'' <br>
''* This test is run on host device.'' <br>
''# This test is run on peripheral device.''
''# This test is run on peripheral device.''
 +
 +
 +
'''Test case descriptions and execution commands:'''
 +
 +
;* USB - Setup host driver
 +
: * Setup host driver for test execution. Command line parameter:
 +
: * -h <name> : Use <name> as host driver (default: blts_usb_host)
 +
: * <code>$ blts-usb-tests -en "USB - Setup host driver"</code>
 +
 +
;* USB - Setup peripheral driver
 +
: * Setup peripheral driver for test execution. Command line parameter:
 +
: * -p <name> : Use <name> as peripheral driver (default: blts_gadget)
 +
: * <code>$ blts-usb-tests -en "USB - Setup peripheral driver"</code>
 +
 +
;* USB - Read test
 +
: * Read data from available endpoints. Command line parameter:
 +
: * -h <name> : Use <name> as host driver (default: blts_usb_host)
 +
: * <code>$ blts-usb-tests -en "USB - Read test"</code>
 +
 +
;* USB - Write test
 +
: * Write data to available endpoints. Command line parameter:
 +
: * -h <name> : Use <name> as host driver (default: blts_usb_host)
 +
: * <code>$ blts-usb-tests -en "USB - Write test"</code>
===  Configuration file examples ===  
===  Configuration file examples ===  
-
Example base configuration file <code>blts-usb-testrunner-bulk.cnf: </code>
+
The test asset allows you to change all endpoint parameters via configuration files. Since the USB (2.0) specification only states the valid range for different settings, it is possible to give any values as long as they fit inside these ranges. The test asset allows experimenting with different configurations and "triangulation" of what works and what does not. Naturally there are certain HW related restrictions such as total transfer capacity which obviously cannot be exceeded with endpoint configuration. Basic test asset configurations is done with base configuration files, such as provided <code>blts-usb-testrunner-default.cnf</code>:
<pre>
<pre>
Line 139: Line 178:
[parameter]
[parameter]
-
  name host_driver
+
name host_driver
-
  const "blts_usb_host"
+
const "blts_usb_host"
[end_parameter]
[end_parameter]
[parameter]
[parameter]
-
  name host_driver_path
+
name host_driver_path
-
  const "/usr/lib/tests/blts-usb-tests/"
+
const "/usr/lib/tests/blts-usb-tests/"
[end_parameter]
[end_parameter]
[parameter]
[parameter]
-
  name peripheral_driver
+
name peripheral_driver
-
  const "blts_gadget"
+
const "blts_gadget"
[end_parameter]
[end_parameter]
[parameter]
[parameter]
-
  name peripheral_driver_path
+
name peripheral_driver_path
-
  const "/usr/lib/tests/blts-usb-tests/"
+
const "/usr/lib/tests/blts-usb-tests/"
[end_parameter]
[end_parameter]
[parameter]
[parameter]
-
  name data_transfer_timeout
+
name data_transfer_timeout
-
  const "10000"
+
const "10000"
[end_parameter]
[end_parameter]
[parameter]
[parameter]
-
  name usb_transfer_size
+
name usb_transfer_size
-
  const 4096
+
const 4096
[end_parameter]
[end_parameter]
Line 173: Line 212:
[parameter]
[parameter]
-
  name ep_configuration_file
+
name ep_configuration_file
-
  const "/usr/share/blts-usb-tests/ep-configuration-bulk.cfg"
+
const "/etc/blts/ep-configuration-default.cfg"
[end_parameter]
[end_parameter]
Line 182: Line 221:
[test]
[test]
-
  name "USB - Setup host driver"
+
name "USB - Setup host driver"
-
  params host_driver host_driver_path
+
params host_driver host_driver_path
[end_test]
[end_test]
[test]
[test]
-
  name "USB - Setup peripheral driver"
+
name "USB - Setup peripheral driver"
-
  params peripheral_driver peripheral_driver_path usb_transfer_size ep_configuration_file
+
params peripheral_driver peripheral_driver_path usb_transfer_size ep_configuration_file
[end_test]
[end_test]
Line 196: Line 235:
[test]
[test]
-
  name "USB - Read test"
+
name "USB - Read test"
-
  params host_driver host_driver_path peripheral_driver peripheral_driver_path usb_transfer_size
+
params host_driver host_driver_path peripheral_driver peripheral_driver_path usb_transfer_size
[end_test]
[end_test]
[test]
[test]
-
  name "USB - Write test"
+
name "USB - Write test"
-
  params host_driver host_driver_path peripheral_driver peripheral_driver_path usb_transfer_size
+
params host_driver host_driver_path peripheral_driver peripheral_driver_path usb_transfer_size
[end_test]
[end_test]
</pre>
</pre>
-
Example endpoint configuration file <code> ep-configuration-bulk.cfg: </code>
+
To change the endpoint configuration, you will have to edit ep-configuration files. For example, provided <code>ep-configuration-default.cfg</code> looks like this by default:
<pre>
<pre>
# device_speed used_speed max_power
# device_speed used_speed max_power
Line 214: Line 253:
2 bulk out 512 9
2 bulk out 512 9
</pre>
</pre>
-
 
+
The lines starting with # are comments and document provided parameters. Device_speed is the highest speed used device is supposed to be able handle (any/low/full/high) and used_speed the operational speed during test execution. This can be used to force the device to use lower speed than normally would be used. To add new pair of bulk endpoints simply add following lines to the file:
-
 
+
<pre>
 +
3 bulk in 512 9
 +
4 bulk out 512 9
 +
</pre>
 +
Do note that you can put different endpoint types to the same configuration so there can be any combination of bulk, interrupt and isochronous endpoints as long as device supports this.
== Module Design and Architecture ==
== Module Design and Architecture ==
-
Debian package is provided which includes both host and peripheral drivers in addition to test runner. This package can be installed on all devices under testing, although functionality depends on used hardware.  
+
Both Debian and RPM package is provided. The package includes both host and peripheral drivers in addition to test runner. This package can be installed on all devices under testing, although functionality depends on used hardware.  
===  Architecture diagram ===  
===  Architecture diagram ===  
Line 226: Line 269:
{|cellspacing="0" border="1"
{|cellspacing="0" border="1"
|  USB Specification || [http://www.usb.org/developers/docs/ USB documentation]  
|  USB Specification || [http://www.usb.org/developers/docs/ USB documentation]  
 +
|-
 +
||  blts-usb  || [http://gitorious.org/qa-tools/mcts/trees/master/mcts-blts/blts-usb/ blts-usb tests]
 +
|}
 +
 +
 +
== Change History ==
 +
{|cellspacing="0" border="1"
 +
!|Version
 +
!|Date
 +
!|Handled By
 +
!|Status
 +
!|Comments
 +
 +
|-
 +
|| 0.1 || 8-sep-2010 || [mailto:ext-iekku.huttunen@nokia.com Iekku Huttunen] || Draft || Page created
 +
|-
 +
|| 0.2 || 15-Dec-2010 || [mailto:aki.nyman@digia.com Aki Nyman] || Draft || Page updated to refer blts usb test package 0.0.14
|}
|}

Latest revision as of 11:34, 25 March 2011

Contents

Introduction

blts-usb package (0.0.14) is test driver using USB host and peripheral devices.

USB peripheral test cases are made between host (e.g. PC) and peripheral gadget (e.g. N900). Both ends have their own drivers which communicate and transfer data between different endpoints.

Test Coverage

Each test case must be run independently and devices must be preset according to case requirements using provided setup test cases. In practice, this means for example data transfer requires preconnected host enabled USB cable and host mode supporting device is connected to system. Each test case prints out required user interaction to terminal.

  • USB - Setup host driver
  • USB - Setup peripheral driver
  • USB - Read test
  • USB - Write test

Software Coverage

Current coverage for USB tests:

Hardware Coverage

Configurable USB endpoint transfer test cases.

Limitations

  • Drivers must be initialized before running other test cases.
  • All other gadget drivers MUST be unloaded before test execution in used DUT!
  • All USB cables MUST be disconnected when executing initializations!

Future Improvements

  • Automated test execution and peripheral DUT driver selection.
  • Official unique USB driver ID.

Running the tests

Hardware setup and test execution order

Required hardware:

  • Supported USB cable
  • Device with USB host capability (e.g. PC)
  • Device with USB peripheral capability (e.g. Nokia N810/N900)

How to setup test environment:

  1. Make sure usb cable is disconnected between devices
  2. Set up host side (e.g. PC) by running test 'USB - Setup host driver'
  3. Set up gadget side (peripheral device) by running test 'USB - Setup peripheral driver'
  4. Connect cable
  5. Execute tests

NOTE: Before executing test cases it must be determined if used devices are capable of acting as peripheral or host. This depends on USB controller chips of devices and necessary information should be available from device vendors.

To run test cases, execute the command:

$ blts_usb_testrunner -C [config file] -e [test number]

The test environment must have following packages installed:

Building packages

The build environment must have the following packages installed:

The source package includes the pack.sh script, which is used for building RPM and Debian packages and source tar packages. To build an RPM package with the script, execute this command in the top level source directory of asset:

./pack.sh -r

To get help about the packaging script, execute

./pack.sh -h

The asset can also be built manually by executing:

./autogen.sh
./configure
make

Configuration package

The blts-usb package is dependent on blts-usb-tests-config configuration file package. The packaging script pack.sh creates RPM package blts-usb-tests-config-example_{version}.rpm and it must be installed first. The configuration files are copied in the test device during RPM installation.

The configuration file package can be installed in the device with a command:

rpm -ivh blts-usb-tests-config-example_{version}.rpm

This test asset uses two configuration files: One for generic test execution options and one for endpoint configuration. Endpoint configuration file is linked to base configuration files thus only base file path is given as parameter. Configuration files must be used, as they contain endpoint configuration for driver.

Currently following example base configuration file is included in the package:

  • blts-usb-testrunner-default.cnf

The base files are linked to endpoint configuration files and following example is provided with test package:

  • ep-configuration-default.cfg

NOTE: Supported endpoint configurations differ from device to device and they should be modified according to test execution requirements. These configuration files are provided as examples and should not be used as such during proper test execution.

For further instructions on creating and using configuration files, see Configuration file examples.

Test asset specific instructions

The test package can be installed in the device by executing the command:

rpm -ivh blts-usb-tests_{version}.rpm 

Common test execution guidelines

NOTE:

  • Default config files are installed to /etc/blts
  • Drivers must be initialized before running other test cases.
  • All USB cables MUST be disconnected when executing initializations!

NOTE: All other gadget drivers MUST be unloaded before test execution in used DUT!

You can use command lsmod to determine which modules are loaded in memory:

$ lsmod

See if some gadget driver is found. For example g_file_storage is a mass storage module, but this depends on used HW and SW. The module can be unloaded with following command:

$ modprobe -r g_file_storage

Test case arguments

Arguments:

General Switch Function
-l Used log file
-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
-C Used configuration file
-? Help message
-xml, -axml Create result XML. -axml appends results to an existing XML file.
-auto Silent logging for test automation. Only the results are printed to stdout.
-v Verbose logging (default)
-vv Even more verbose logging
Optional Switch Function
-h Use given host driver (default: blts_usb_host), for example -h blts_usb_host
-p Use given peripheral driver (default: blts_gadget), for example -h blts_gadget


Running test cases

Test case execution notices:

Case name Notice
USB - Setup host driver*
USB - Setup peripheral driver# Use configuration file to create specific setup, bulk endpoints are created by default
USB - Read test* Read data from endpoints
USB - Write test* Write data to endpoints

* This test is run on host device.
# This test is run on peripheral device.


Test case descriptions and execution commands:

  • USB - Setup host driver
* Setup host driver for test execution. Command line parameter:
* -h <name> : Use <name> as host driver (default: blts_usb_host)
* $ blts-usb-tests -en "USB - Setup host driver"
  • USB - Setup peripheral driver
* Setup peripheral driver for test execution. Command line parameter:
* -p <name> : Use <name> as peripheral driver (default: blts_gadget)
* $ blts-usb-tests -en "USB - Setup peripheral driver"
  • USB - Read test
* Read data from available endpoints. Command line parameter:
* -h <name> : Use <name> as host driver (default: blts_usb_host)
* $ blts-usb-tests -en "USB - Read test"
  • USB - Write test
* Write data to available endpoints. Command line parameter:
* -h <name> : Use <name> as host driver (default: blts_usb_host)
* $ blts-usb-tests -en "USB - Write test"

Configuration file examples

The test asset allows you to change all endpoint parameters via configuration files. Since the USB (2.0) specification only states the valid range for different settings, it is possible to give any values as long as they fit inside these ranges. The test asset allows experimenting with different configurations and "triangulation" of what works and what does not. Naturally there are certain HW related restrictions such as total transfer capacity which obviously cannot be exceeded with endpoint configuration. Basic test asset configurations is done with base configuration files, such as provided blts-usb-testrunner-default.cnf:

# USB test case configuration for parameters

######################
# General parameters #
######################

[parameter]
	name host_driver
	const "blts_usb_host"
[end_parameter]

[parameter]
	name host_driver_path
	const "/usr/lib/tests/blts-usb-tests/"
[end_parameter]

[parameter]
	name peripheral_driver
	const "blts_gadget"
[end_parameter]

[parameter]
	name peripheral_driver_path
	const "/usr/lib/tests/blts-usb-tests/"
[end_parameter]

[parameter]
	name data_transfer_timeout
	const "10000"
[end_parameter]

[parameter]
	name usb_transfer_size
	const 4096
[end_parameter]

##########################
# Endpoint configuration #
##########################

[parameter]
	name ep_configuration_file
	const "/etc/blts/ep-configuration-default.cfg"
[end_parameter]

################
# Driver setup #
################

[test]
	name "USB - Setup host driver"
	params host_driver host_driver_path
[end_test]

[test]
	name "USB - Setup peripheral driver"
	params peripheral_driver peripheral_driver_path usb_transfer_size ep_configuration_file
[end_test]

#######################
# Data transfer cases #
#######################

[test]
	name "USB - Read test"
	params host_driver host_driver_path peripheral_driver peripheral_driver_path usb_transfer_size
[end_test]

[test]
	name "USB - Write test"
	params host_driver host_driver_path peripheral_driver peripheral_driver_path usb_transfer_size
[end_test]

To change the endpoint configuration, you will have to edit ep-configuration files. For example, provided ep-configuration-default.cfg looks like this by default:

# device_speed used_speed max_power
high any 50
# endpoint type direction max_packet_size interval
1 bulk in 512 9
2 bulk out 512 9

The lines starting with # are comments and document provided parameters. Device_speed is the highest speed used device is supposed to be able handle (any/low/full/high) and used_speed the operational speed during test execution. This can be used to force the device to use lower speed than normally would be used. To add new pair of bulk endpoints simply add following lines to the file:

3 bulk in 512 9
4 bulk out 512 9

Do note that you can put different endpoint types to the same configuration so there can be any combination of bulk, interrupt and isochronous endpoints as long as device supports this.

Module Design and Architecture

Both Debian and RPM package is provided. The package includes both host and peripheral drivers in addition to test runner. This package can be installed on all devices under testing, although functionality depends on used hardware.

Architecture diagram

References

USB Specification USB documentation
blts-usb blts-usb tests


Change History

Version Date Handled By Status Comments
0.1 8-sep-2010 Iekku Huttunen Draft Page created
0.2 15-Dec-2010 Aki Nyman Draft Page updated to refer blts usb test package 0.0.14
Personal tools