aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/test/test-media
blob: 6b015d2c9964bd2359f377d0b4e113226e3d9798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash

# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright 2013 Cisco Systems, Inc. and/or its affiliates. All rights reserved.

vivid=0
vim2m=0
vimc=0
cec=0
cecpwr=--skip-test-standby-resume

if [ -z "$1" ]; then
	echo "usage: test-media all|mc|vivid|vim2m|vimc|cec|cec-pwr"
	echo
	echo Run as root.
	echo
	echo "'all' equals 'vivid vim2m vimc cec cec-pwr'"
	echo "'mc' equals 'vivid vim2m vimc'"
	echo "'cec' adds the CEC compliance tests, 'cec-pwr' adds the CEC standby/wakeup tests."
	exit 0
fi

if [ `id -u` -ne 0 ]; then
	echo "$0 must be run as root"
	exit -1
fi

while [ ! -z "$1" ]; do
	case "$1" in
	all)
		vivid=1
		vim2m=1
		vimc=1
		cec=1
		cecpwr=
		;;
	mc)
		vivid=1
		vim2m=1
		vimc=1
		;;
	vivid)
		vivid=1
		;;
	vim2m)
		vim2m=1
		;;
	vimc)
		vimc=1
		;;
	cec)
		cec=1
		;;
	cec-pwr)
		cecpwr=
		;;
	esac
	shift
done

test-media-unload.pl

modprobe vivid n_devs=3 multiplanar=1,2,2 #allocators=0,1,1
modprobe vim2m
modprobe vimc
sleep 1

v4l2-ctl -z platform:vivid-000 -d vivid-000-vid-cap -i3 -v width=3840,height=2160,pixelformat=NV24
v4l2-ctl -z platform:vivid-000 -d vivid-000-vid-out -o1 -x width=3840,height=2160,pixelformat=NV24
v4l2-ctl -z platform:vivid-001 -d vivid-001-vid-cap -i3 -v width=3840,height=2160,pixelformat=NM16
v4l2-ctl -z platform:vivid-001 -d vivid-001-vid-out -o1 -x width=3840,height=2160,pixelformat=NM16
v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-cap -i3 -v width=3840,height=2160,pixelformat=NV24
v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-out -o1 -x width=3840,height=2160,pixelformat=NM16

media-ctl -d platform:vimc -V '1:0[fmt:SBGGR8_1X8/640x480]'
media-ctl -d platform:vimc -V '5:0[fmt:SBGGR8_1X8/640x480]'
v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440
v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
echo

tmp=`mktemp`

if [ $vivid -eq 1 ]; then
	stdbuf -oL v4l2-compliance -m platform:vivid-000 -z platform:vivid-002 -e vivid-002-vid-cap -s10 -a 2>&1 | tee -a $tmp
	echo
	stdbuf -oL v4l2-compliance -m platform:vivid-001 -z platform:vivid-002 -e vivid-002-vid-out -s10 -a 2>&1 | tee -a $tmp
	echo
fi

if [ $cec -eq 1 ]; then
	cec-ctl -s -D vivid -a vivid-000-vid-cap0 --tv
	cec-ctl -s -D vivid -a vivid-000-vid-out0 --playback
	trap 'kill $f0 $f1 2>/dev/null' INT
	cec-follower -s -D vivid -a vivid-000-vid-cap0 2>&1 >/dev/null &
	f0=$!
	cec-follower -s -D vivid -a vivid-000-vid-out0 2>&1 >/dev/null &
	f1=$!
	stdbuf -oL cec-compliance -D vivid -a vivid-000-vid-cap0 -A -r4 -t10 $cecpwr 2>&1 | tee -a $tmp
	sleep 5
	stdbuf -oL cec-compliance -D vivid -a vivid-000-vid-out0 -A -r0 -t10 $cecpwr 2>&1 | tee -a $tmp
	kill $f0
	kill $f1
	echo
fi

if [ $vim2m -eq 1 ]; then
	stdbuf -oL v4l2-compliance -m platform:vim2m -z platform:vivid-002 -e vivid-002-vid-cap -s10 -a 2>&1 | tee -a $tmp
	echo
fi

if [ $vimc -eq 1 ]; then
	stdbuf -oL v4l2-compliance -m platform:vimc -z platform:vivid-002 -e vivid-002-vid-cap -s10 -a 2>&1 | tee -a $tmp
	echo
fi

echo Summary:
echo

grep 'Total' $tmp | perl -e '
while (<>) {
	if (/Total/) {
		print;
		$added_nl = /^Grand/ || /\/dev\/cec/;
		printf("\n") if $added_nl;
	}
	next unless /^Total/;
	($succeeded, $failed, $warnings) = /Succeeded: (\d+), Failed: (\d+), Warnings: (\d+)/;
	$tot_succeeded += $succeeded;
	$tot_failed += $failed;
	$tot_warnings += $warnings;
}

printf("\n") unless $added_nl;
printf("Final Summary: %d, Succeeded: %d, Failed: %d, Warnings: %d\n",
	$tot_succeeded + $tot_failed, $tot_succeeded, $tot_failed, $tot_warnings);
'

rm -f $tmp

Privacy Policy