diff options
author | Ryan Harkin <ryan.harkin@linaro.org> | 2018-04-20 11:40:36 +0100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2018-04-26 11:21:27 +0000 |
commit | dd73c2a754f299c493b30e262bafe2ae84ee4525 (patch) | |
tree | 4cdaf508ab14d46f3b5296f35e0525eaff462479 | |
parent | 7f9f4dff4b336b2bb5441df7e6adefd059f796c7 (diff) |
Add v4l2-compliance test suite
WaRP7 has a V4L2 compliant camera driver. This test runs the compliance
tests against that driver.
Taken from the man page:
"The v4l2-compliance tool is used to test video4linux devices, either
video, vbi, radio or swradio, both input and output. It attempts to test
almost all aspects of a V4L2 device and it covers almost all V4L2
ioctls. It has very good support for video capture and output, VBI
capture and output and (software) radio tuning and transmitting."
"Note that v4l2-compliance not only tests for compliance against the
V4L2 API, but also whether the driver is using all the correct
frameworks. These frameworks often automatically provide ioctls that are
strictly speaking optional, but that come for free if you use those
frameworks. By requiring their presence the v4l2-compliance utility will
enforce their use."
Change-Id: Ide6de6b954eeb6edd1f19c9c49164d05582c772f
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
-rwxr-xr-x | automated/linux/v4l2/v4l2-compliance.sh | 60 | ||||
-rw-r--r-- | automated/linux/v4l2/v4l2-compliance.yaml | 23 |
2 files changed, 83 insertions, 0 deletions
diff --git a/automated/linux/v4l2/v4l2-compliance.sh b/automated/linux/v4l2/v4l2-compliance.sh new file mode 100755 index 0000000..73a609f --- /dev/null +++ b/automated/linux/v4l2/v4l2-compliance.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +TEST_SUITE="v4l2-compliance" + +usage() { + echo "Usage: $0 [-d <video device>" 1>&2 + exit 1 +} + +while getopts "d:h:m:" o; do + case "$o" in + d) VIDEO_DEVICE="${OPTARG}" ;; + m) MEDIA_DEVICE_NUM="${OPTARG}" + MEDIA_DEVICE="/dev/media${OPTARG}" ;; + h|*) usage ;; + esac +done + +echo VIDEO_DEVICE="${VIDEO_DEVICE}" +echo MEDIA_DEVICE="${MEDIA_DEVICE}" +echo MEDIA_DEVICE_NUM="${MEDIA_DEVICE_NUM}" + +# Test run. +create_out_dir "${OUTPUT}" + +command -v v4l2-compliance +exit_on_fail "v4l2-existence-check" + +if [ ! -z "${VIDEO_DEVICE}" ] && [ -e "${VIDEO_DEVICE}" ]; then + info_msg "Running v4l2-compliance device test..." + LOG_FILE="${OUTPUT}/${TEST_SUITE}-output.txt" + test_cmd="v4l2-compliance -v -d ${VIDEO_DEVICE} 2>&1" + pipe0_status "${test_cmd}" "tee ${LOG_FILE}" + check_return "v4l2-compliance" +else + info_msg "Skipping v4l2-compliance device test..." +fi + +if [ ! -z "${MEDIA_DEVICE}" ] && [ -e "${MEDIA_DEVICE}" ]; then + info_msg "Running v4l2-compliance media test..." + LOG_FILE="${OUTPUT}/${TEST_SUITE}-output.txt" + test_cmd="v4l2-compliance -v -m${MEDIA_DEVICE_NUM} 2>&1" + pipe0_status "${test_cmd}" "tee ${LOG_FILE}" + check_return "v4l2-compliance" +else + info_msg "Skipping v4l2-compliance media test..." +fi + +# Parse test log. +grep -e FAIL -e OK "${LOG_FILE}" | \ + sed -e 's/^[ \t]*//' \ + -e 's/test //' \ + -e 's/ (Not Supported)//' \ + -e 's/ /_/g' \ + -e 's/:_/ /' \ + -e 's/ OK/ PASS/' \ + > "${RESULT_FILE}" diff --git a/automated/linux/v4l2/v4l2-compliance.yaml b/automated/linux/v4l2/v4l2-compliance.yaml new file mode 100644 index 0000000..c386d43 --- /dev/null +++ b/automated/linux/v4l2/v4l2-compliance.yaml @@ -0,0 +1,23 @@ +metadata: + name: v4l2-compliance + format: "Lava-Test-Shell Test Definition 1.0" + description: "v4l2 Compliance test suite" + maintainer: + - ryan.harkin@linaro.org + os: + - openembedded + - debian + scope: + - functional + devices: + - imx7s-warp + +params: + VIDEO_DEVICE: "/dev/video0" + MEDIA_DEVICE_NUM: "0" + +run: + steps: + - cd ./automated/linux/v4l2/ + - ./v4l2-compliance.sh -d "${VIDEO_DEVICE}" -m "${MEDIA_DEVICE_NUM}" + - ../../utils/send-to-lava.sh ./output/result.txt |