diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2016-06-17 20:12:04 -0400 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2016-06-27 15:29:52 -0400 |
commit | fe8777a8a0a144dee2eb59d00664184f1e49db4a (patch) | |
tree | 4d52746899386dba550b8a27dba04a2324247780 /tools/testing/selftests | |
parent | b96da0fc54ffeca53dbab231ae845ad093785cc7 (diff) |
selftests: add media controller regression test scripts and document
Add regression test scripts open_loop_test.sh, and bind_unbind_sample.sh.
Also add regression_test.txt that describes the regression test procedure.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools/testing/selftests')
3 files changed, 65 insertions, 0 deletions
diff --git a/tools/testing/selftests/media_tests/bind_unbind_sample.sh b/tools/testing/selftests/media_tests/bind_unbind_sample.sh new file mode 100755 index 000000000000..9f362f10631a --- /dev/null +++ b/tools/testing/selftests/media_tests/bind_unbind_sample.sh | |||
@@ -0,0 +1,12 @@ | |||
1 | #!/bin/bash | ||
2 | # Find device number in /sys/bus/usb/drivers/drivername | ||
3 | # Edit this file to update the driver numer and name | ||
4 | # Example test for uvcvideo driver | ||
5 | #i=0 | ||
6 | # while :; do | ||
7 | # i=$((i+1)) | ||
8 | # echo 1-5:1.0 > /sys/bus/usb/drivers/uvcvideo/unbind; | ||
9 | # echo 1-5:1.0 > /sys/bus/usb/drivers/uvcvideo/bind; | ||
10 | # clear | ||
11 | # echo $i | ||
12 | #done | ||
diff --git a/tools/testing/selftests/media_tests/open_loop_test.sh b/tools/testing/selftests/media_tests/open_loop_test.sh new file mode 100755 index 000000000000..dcd3c17efc17 --- /dev/null +++ b/tools/testing/selftests/media_tests/open_loop_test.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/bash | ||
2 | i=0 | ||
3 | file=/dev/media$1 | ||
4 | while :; do | ||
5 | echo $file | ||
6 | i=$((i+1)) | ||
7 | R=$(./media_device_open -d $file); | ||
8 | # clear | ||
9 | echo -e "Loop $i\n$R" | ||
10 | done | ||
diff --git a/tools/testing/selftests/media_tests/regression_test.txt b/tools/testing/selftests/media_tests/regression_test.txt new file mode 100644 index 000000000000..2627367681f7 --- /dev/null +++ b/tools/testing/selftests/media_tests/regression_test.txt | |||
@@ -0,0 +1,43 @@ | |||
1 | Testing for regressions in Media Controller API register, ioctl, syscall, | ||
2 | and unregister paths. There have a few problems that result in user-after | ||
3 | free on media_device, media_devnode, and cdev pointers when the driver is | ||
4 | unbound while ioctl is in progress. | ||
5 | |||
6 | Test Procedure: | ||
7 | |||
8 | Run bin/unbind loop while ioctls are in progress. | ||
9 | Run rmmod and modprobe. | ||
10 | Disconnect the device. | ||
11 | |||
12 | Setup: | ||
13 | |||
14 | Build media_device_test | ||
15 | cd tools/testing/selftests/media_tests | ||
16 | make | ||
17 | |||
18 | Regressions test for cdev user-after free error on /dev/mediaX when driver | ||
19 | is unbound: | ||
20 | |||
21 | Start media_device_test to regression test media devnode dynamic alloc | ||
22 | and cdev user-after-free fixes. This opens media dev files and sits in | ||
23 | a loop running media ioctl MEDIA_IOC_DEVICE_INFO command once every 10 | ||
24 | seconds. The idea is when device file goes away, media devnode and cdev | ||
25 | should stick around until this test exits. | ||
26 | |||
27 | The test for a random number of iterations or until user kills it with a | ||
28 | sleep 10 in between the ioctl calls. | ||
29 | |||
30 | sudo ./media_device_test -d /dev/mediaX | ||
31 | |||
32 | Regression test for media_devnode unregister race with ioctl_syscall: | ||
33 | |||
34 | Start 6 open_loop_test.sh tests with different /dev/mediaX files. When | ||
35 | device file goes away after unbind, device file name changes. Start the | ||
36 | test with possible device names. If we start with /dev/media0 for example, | ||
37 | after unbind, /dev/media1 or /dev/media2 could get created. The idea is | ||
38 | keep ioctls going while bind/unbind runs. | ||
39 | |||
40 | Copy bind_unbind_sample.txt and make changes to specify the driver name | ||
41 | and number to run bind and unbind. Start the bind_unbind.sh | ||
42 | |||
43 | Run dmesg looking for any user-after free errors or mutex lock errors. | ||