Skip to contentSkip to conversation

test-media: wrap vivid code around $vivid variable

PATCH In review Helen Koike 2 participants 3 messages Feb 17, 2021 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test-media: wrap vivid code around $vivid variable

The script was trying to load vivid and run some commands on top of it even when $vivid = 0.
Wrap all vivid code under $vivid variable.

---
 contrib/test/test-media | 66 ++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 33 deletions(-)
contrib/test/test-media +33 -33
index 10b7e89d..8cd8bc37 100755
@@ -146,29 +146,29 @@ if [ $kmemleak -eq 1 ]; then
 	echo clear >/sys/kernel/debug/kmemleak
 fi
 
-rmmod vivid 2&>/dev/null
-modprobe vivid n_devs=3 multiplanar=1,2,2 cache_hints=1,0,0 #allocators=0,1,1
-sleep 1
+if [ $vivid -eq 1 ]; then
+	rmmod vivid 2&>/dev/null
+	modprobe vivid n_devs=3 multiplanar=1,2,2 cache_hints=1,0,0 #allocators=0,1,1
+	sleep 1
 
-tmp=`mktemp`
+	tmp=`mktemp`
 
-if ! $v4l2_ctl -z platform:vivid-002 -d vivid-002-vid-cap ; then
-	echo "FAIL: the vivid module failed to load" | tee -a $tmp
-	echo "Grand Total for vivid: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
-	echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-	exit 0
-fi
+	if ! $v4l2_ctl -z platform:vivid-002 -d vivid-002-vid-cap ; then
+		echo "FAIL: the vivid module failed to load" | tee -a $tmp
+		echo "Grand Total for vivid: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
+		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
+		exit 0
+	fi
 
-$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
+	$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
 
-echo
+	echo
 
-if [ $vivid -eq 1 ]; then
 	dmesg -n notice
 	echo
 	echo vivid compliance tests, contiguous planes | tee /dev/kmsg
@@ -287,6 +287,18 @@ if [ $vivid -eq 1 ]; then
 	echo
 	echo
 	echo
+
+	date
+	echo
+	echo unbind vivid | tee /dev/kmsg
+	echo
+	echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
+	sleep $unbind_time
+	echo
+	echo rmmod vivid | tee /dev/kmsg
+	echo
+	rmmod vivid
+	sleep $rmmod_time
 fi
 
 if [ $vim2m -eq 1 ]; then
@@ -300,7 +312,7 @@ if [ $vim2m -eq 1 ]; then
 		echo "FAIL: the vim2m module failed to load" | tee -a $tmp
 		echo "Grand Total for vim2m: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
 		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-		rmmod vivid
+		rmmod vim2m
 		exit 0
 	fi
 
@@ -373,7 +385,7 @@ if [ $vimc -eq 1 ]; then
 		echo "FAIL: the vimc module failed to load" | tee -a $tmp
 		echo "Grand Total for vimc: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
 		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-		rmmod vivid
+		rmmod vimc
 		exit 0
 	fi
 
@@ -467,7 +479,7 @@ if [ $vicodec -eq 1 ]; then
 		echo "FAIL: the vicodec module failed to load" | tee -a $tmp
 		echo "Grand Total for vicodec: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
 		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-		rmmod vivid
+		rmmod vicodec
 		exit 0
 	fi
 
@@ -603,18 +615,6 @@ if [ $vicodec -eq 1 ]; then
 	echo
 fi
 
-date
-echo
-echo unbind vivid | tee /dev/kmsg
-echo
-echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
-sleep $unbind_time
-echo
-echo rmmod vivid | tee /dev/kmsg
-echo
-rmmod vivid
-sleep $rmmod_time
-
 if [ $vidtv -eq 1 ]; then
 	rmmod dvb_vidtv_bridge dvb_vidtv_tuner dvb_vidtv_demod 2&>/dev/null
 	modprobe vidtv
Signature · 1 line
2.30.1
#1 lore raw
Quoted 14 lines · Helen Koike

The script was trying to load vivid and run some commands on top of it even when $vivid = 0.
Wrap all vivid code under $vivid variable.

---
 contrib/test/test-media | 66 ++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 33 deletions(-)
contrib/test/test-media +0 -0
index 10b7e89d..8cd8bc37 100755

contrib/test/test-media if [ $kmemleak -eq 1 ]; then · line 150

Quoted 5 lines
contrib/test/test-media +0 -2
@@ -146,29 +146,29 @@ if [ $kmemleak -eq 1 ]; then
 	echo clear >/sys/kernel/debug/kmemleak
 fi
 
-rmmod vivid 2&>/dev/null
-modprobe vivid n_devs=3 multiplanar=1,2,2 cache_hints=1,0,0 #allocators=0,1,1

Ah, no. Vivid is also used to test dmabuf for vim2m, vimc and vicodec tests. It functions as the allocator for the dma buffers in that case.

So even if vivid isn't given, but only vim2m, vimc or vicodec, it should still be loaded.

It isn't needed for vidtv, so I guess it could be disabled if only vidtv is tested.

Regards,

Hans

Quoted 108 lines
contrib/test/test-media +33 -31
-sleep 1
+if [ $vivid -eq 1 ]; then
+	rmmod vivid 2&>/dev/null
+	modprobe vivid n_devs=3 multiplanar=1,2,2 cache_hints=1,0,0 #allocators=0,1,1
+	sleep 1
 
-tmp=`mktemp`
+	tmp=`mktemp`
 
-if ! $v4l2_ctl -z platform:vivid-002 -d vivid-002-vid-cap ; then
-	echo "FAIL: the vivid module failed to load" | tee -a $tmp
-	echo "Grand Total for vivid: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
-	echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-	exit 0
-fi
+	if ! $v4l2_ctl -z platform:vivid-002 -d vivid-002-vid-cap ; then
+		echo "FAIL: the vivid module failed to load" | tee -a $tmp
+		echo "Grand Total for vivid: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
+		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
+		exit 0
+	fi
 
-$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
+	$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
 
-echo
+	echo
 
-if [ $vivid -eq 1 ]; then
 	dmesg -n notice
 	echo
 	echo vivid compliance tests, contiguous planes | tee /dev/kmsg
@@ -287,6 +287,18 @@ if [ $vivid -eq 1 ]; then
 	echo
 	echo
 	echo
+
+	date
+	echo
+	echo unbind vivid | tee /dev/kmsg
+	echo
+	echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
+	sleep $unbind_time
+	echo
+	echo rmmod vivid | tee /dev/kmsg
+	echo
+	rmmod vivid
+	sleep $rmmod_time
 fi
 
 if [ $vim2m -eq 1 ]; then
@@ -300,7 +312,7 @@ if [ $vim2m -eq 1 ]; then
 		echo "FAIL: the vim2m module failed to load" | tee -a $tmp
 		echo "Grand Total for vim2m: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
 		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-		rmmod vivid
+		rmmod vim2m
 		exit 0
 	fi
 
@@ -373,7 +385,7 @@ if [ $vimc -eq 1 ]; then
 		echo "FAIL: the vimc module failed to load" | tee -a $tmp
 		echo "Grand Total for vimc: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
 		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-		rmmod vivid
+		rmmod vimc
 		exit 0
 	fi
 
@@ -467,7 +479,7 @@ if [ $vicodec -eq 1 ]; then
 		echo "FAIL: the vicodec module failed to load" | tee -a $tmp
 		echo "Grand Total for vicodec: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
 		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-		rmmod vivid
+		rmmod vicodec
 		exit 0
 	fi
 
@@ -603,18 +615,6 @@ if [ $vicodec -eq 1 ]; then
 	echo
 fi
 
-date
-echo
-echo unbind vivid | tee /dev/kmsg
-echo
-echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
-sleep $unbind_time
-echo
-echo rmmod vivid | tee /dev/kmsg
-echo
-rmmod vivid
-sleep $rmmod_time
-
 if [ $vidtv -eq 1 ]; then
 	rmmod dvb_vidtv_bridge dvb_vidtv_tuner dvb_vidtv_demod 2&>/dev/null
 	modprobe vidtv
#2 lore raw
Quoted 18 lines · Hans Verkuil
Quoted 17 lines · Helen Koike

The script was trying to load vivid and run some commands on top of it even when $vivid = 0.
Wrap all vivid code under $vivid variable.

---
  contrib/test/test-media | 66 ++++++++++++++++++++---------------------
  1 file changed, 33 insertions(+), 33 deletions(-)
contrib/test/test-media +0 -0
index 10b7e89d..8cd8bc37 100755
@@ -146,29 +146,29 @@ if [ $kmemleak -eq 1 ]; then
  	echo clear >/sys/kernel/debug/kmemleak
  fi
 
Quoted 7 lines

contrib/test/test-media if [ $kmemleak -eq 1 ]; then · line 150

Quoted 2 lines
contrib/test/test-media +0 -2
-rmmod vivid 2&>/dev/null
-modprobe vivid n_devs=3 multiplanar=1,2,2 cache_hints=1,0,0 #allocators=0,1,1

Ah, no. Vivid is also used to test dmabuf for vim2m, vimc and vicodec tests. It functions as the allocator for the dma buffers in that case.

So even if vivid isn't given, but only vim2m, vimc or vicodec, it should still be loaded.

I see, thanks, ignore this patch then.
At some point I had a doubt if the script was testing vimc or vivid for some nodes, but this was my mistake.

Thanks
Helen

Quoted 116 lines

It isn't needed for vidtv, so I guess it could be disabled if only vidtv is tested.

Regards,

Hans

Quoted 108 lines
contrib/test/test-media +33 -31
-sleep 1
+if [ $vivid -eq 1 ]; then
+	rmmod vivid 2&>/dev/null
+	modprobe vivid n_devs=3 multiplanar=1,2,2 cache_hints=1,0,0 #allocators=0,1,1
+	sleep 1
 
-tmp=`mktemp`
+	tmp=`mktemp`
 
-if ! $v4l2_ctl -z platform:vivid-002 -d vivid-002-vid-cap ; then
-	echo "FAIL: the vivid module failed to load" | tee -a $tmp
-	echo "Grand Total for vivid: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
-	echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-	exit 0
-fi
+	if ! $v4l2_ctl -z platform:vivid-002 -d vivid-002-vid-cap ; then
+		echo "FAIL: the vivid module failed to load" | tee -a $tmp
+		echo "Grand Total for vivid: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
+		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
+		exit 0
+	fi
 
-$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
+	$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
 
-echo
+	echo
 
-if [ $vivid -eq 1 ]; then
  	dmesg -n notice
  	echo
  	echo vivid compliance tests, contiguous planes | tee /dev/kmsg
@@ -287,6 +287,18 @@ if [ $vivid -eq 1 ]; then
  	echo
  	echo
  	echo
+
+	date
+	echo
+	echo unbind vivid | tee /dev/kmsg
+	echo
+	echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
+	sleep $unbind_time
+	echo
+	echo rmmod vivid | tee /dev/kmsg
+	echo
+	rmmod vivid
+	sleep $rmmod_time
  fi
 
  if [ $vim2m -eq 1 ]; then
@@ -300,7 +312,7 @@ if [ $vim2m -eq 1 ]; then
  		echo "FAIL: the vim2m module failed to load" | tee -a $tmp
  		echo "Grand Total for vim2m: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
  		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-		rmmod vivid
+		rmmod vim2m
  		exit 0
  	fi
 
@@ -373,7 +385,7 @@ if [ $vimc -eq 1 ]; then
  		echo "FAIL: the vimc module failed to load" | tee -a $tmp
  		echo "Grand Total for vimc: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
  		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-		rmmod vivid
+		rmmod vimc
  		exit 0
  	fi
 
@@ -467,7 +479,7 @@ if [ $vicodec -eq 1 ]; then
  		echo "FAIL: the vicodec module failed to load" | tee -a $tmp
  		echo "Grand Total for vicodec: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
  		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
-		rmmod vivid
+		rmmod vicodec
  		exit 0
  	fi
 
@@ -603,18 +615,6 @@ if [ $vicodec -eq 1 ]; then
  	echo
  fi
 
-date
-echo
-echo unbind vivid | tee /dev/kmsg
-echo
-echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
-sleep $unbind_time
-echo
-echo rmmod vivid | tee /dev/kmsg
-echo
-rmmod vivid
-sleep $rmmod_time
-
  if [ $vidtv -eq 1 ]; then
  	rmmod dvb_vidtv_bridge dvb_vidtv_tuner dvb_vidtv_demod 2&>/dev/null
  	modprobe vidtv