aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-02-16 12:47:14 (GMT)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-02-16 12:47:14 (GMT)
commitc497fde2893ebfec612772233ae3b7819c447647 (patch)
treef9854a4be8b6c2a9aa6053cea4b4c75e71fdb179
parent310d8e465a3a4aa54f94c6f718e28ca95d586f3a (diff)
test-media: add -kmemleak option
Add support for memory leak detection. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rwxr-xr-xcontrib/test/test-media26
1 files changed, 25 insertions, 1 deletions
diff --git a/contrib/test/test-media b/contrib/test/test-media
index f146739..8f06e4c 100755
--- a/contrib/test/test-media
+++ b/contrib/test/test-media
@@ -9,14 +9,16 @@ vim2m=0
vimc=0
cec=0
cecpwr=--skip-test-standby-resume
+kmemleak=0
unload=0
if [ -z "$1" ]; then
- echo "usage: test-media [-unload] all|mc|vivid|vim2m|vimc|cec|cec-pwr"
+ echo "usage: test-media [-unload] [-kmemleak] all|mc|vivid|vim2m|vimc|cec|cec-pwr"
echo
echo Run as root.
echo
echo "-unload: unload any media modules before testing"
+ echo "-kmemleak: enable memory leak scan"
echo
echo "'all' equals 'vivid vim2m vimc cec cec-pwr'"
echo "'mc' equals 'vivid vim2m vimc'"
@@ -34,6 +36,13 @@ while [ ! -z "$1" ]; do
-unload)
unload=1
;;
+ -kmemleak)
+ if [ -f /sys/kernel/debug/kmemleak ]; then
+ kmemleak=1
+ else
+ echo /sys/kernel/debug/kmemleak not found, disable memleak testing
+ fi
+ ;;
all)
vivid=1
vim2m=1
@@ -69,6 +78,10 @@ if [ $unload -eq 1 ]; then
test-media-unload.pl
fi
+if [ $kmemleak -eq 1 ]; then
+ echo clear >/sys/kernel/debug/kmemleak
+fi
+
modprobe vivid n_devs=3 multiplanar=1,2,2 #allocators=0,1,1
sleep 1
@@ -111,6 +124,7 @@ if [ $vim2m -eq 1 ]; then
sleep 1
stdbuf -oL v4l2-compliance -m platform:vim2m -z platform:vivid-002 -e vivid-002-vid-cap -s10 -a 2>&1 | tee -a $tmp
echo
+ rmmod vim2m
fi
if [ $vimc -eq 1 ]; then
@@ -122,6 +136,16 @@ if [ $vimc -eq 1 ]; then
v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
stdbuf -oL v4l2-compliance -m platform:vimc -z platform:vivid-002 -e vivid-002-vid-cap -s10 -a 2>&1 | tee -a $tmp
echo
+ rmmod vimc
+fi
+
+rmmod vivid
+
+if [ $kmemleak -eq 1 ]; then
+ sleep 10
+ echo kmemleak results:
+ echo scan >/sys/kernel/debug/kmemleak
+ cat /sys/kernel/debug/kmemleak
fi
echo Summary:

Privacy Policy