Kselftest update for 4.8-rc1
Hi Linus,
Please pull this 2/2 Kselftest update for 4.8-rc1. This update contains new tests and fixes. diff is attached.
thanks,
-- Shuah
---------------------------------------------------------------------------------
The following changes since commit 1a695a905c18548062509178b98bc91e67510864:
Linux 4.7-rc1 (2016-05-29 09:29:24 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-4.8-rc1-update
for you to fetch changes up to d78388dbec256b179f1c42e714cf4acf630067c6:
selftests: media_tests add a new video device test (2016-07-26 09:59:30 -0600)
----------------------------------------------------------------
linux-kselftest-4.8-rc1-update
This update for Kselftest adds:
- a few fixes to existing tests
- new media tests for testing driver unbind, and device removal paths while an user application is actively making system calls and ioctls.
----------------------------------------------------------------
SeongJae Park (1):
selftests/lib: set printf.sh executable
Shuah Khan (5):
selftests: media_device_test change it to randomize loop count
selftests: add media_device_open test
selftests: add media controller regression test scripts and document
selftests: media_tests - Add media_device_open to .gitignore
selftests: media_tests add a new video device test
Yannick Brosseau (2):
selftests/vm: write strlen length instead of sizeof to nr_hugepages selftests/vm: Don't mlockall MCL_CURRENT in on-fault-limit test
tools/testing/selftests/lib/printf.sh | 0 tools/testing/selftests/media_tests/.gitignore | 2 + tools/testing/selftests/media_tests/Makefile | 4 +- .../selftests/media_tests/bind_unbind_sample.sh | 12 +++ .../selftests/media_tests/media_device_open.c | 81 +++++++++++++++++ .../selftests/media_tests/media_device_test.c | 19 ++-- .../selftests/media_tests/open_loop_test.sh | 10 +++ .../selftests/media_tests/regression_test.txt | 43 +++++++++ .../selftests/media_tests/video_device_test.c | 100 +++++++++++++++++++++ tools/testing/selftests/vm/compaction_test.c | 10 +-- tools/testing/selftests/vm/on-fault-limit.c | 2 +- 11 files changed, 269 insertions(+), 14 deletions(-) mode change 100644 => 100755 tools/testing/selftests/lib/printf.sh create mode 100755 tools/testing/selftests/media_tests/bind_unbind_sample.sh create mode 100644 tools/testing/selftests/media_tests/media_device_open.c create mode 100755 tools/testing/selftests/media_tests/open_loop_test.sh create mode 100644 tools/testing/selftests/media_tests/regression_test.txt create mode 100644 tools/testing/selftests/media_tests/video_device_test.c
---------------------------------------------------------------------------------
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected]
tools/testing/selftests/lib/printf.sh +0 -0
tools/testing/selftests/media_tests/.gitignore +2 -0
@@ -1 +1,3 @@ media_device_test +media_device_open +video_device_test
tools/testing/selftests/media_tests/Makefile +2 -2
@@ -1,7 +1,7 @@ -TEST_PROGS := media_device_test +TEST_PROGS := media_device_test media_device_open video_device_test all: $(TEST_PROGS) include ../lib.mk clean: - rm -fr media_device_test + rm -fr media_device_test media_device_open video_device_test
tools/testing/selftests/media_tests/bind_unbind_sample.sh new file +12 -0
@@ -0,0 +1,12 @@ +#!/bin/bash +# Find device number in /sys/bus/usb/drivers/drivername +# Edit this file to update the driver numer and name +# Example test for uvcvideo driver +#i=0 +# while :; do +# i=$((i+1)) +# echo 1-5:1.0 > /sys/bus/usb/drivers/uvcvideo/unbind; +# echo 1-5:1.0 > /sys/bus/usb/drivers/uvcvideo/bind; +# clear +# echo $i +#done
tools/testing/selftests/media_tests/media_device_open.c new file +81 -0
81 lines not on this page · raw message
tools/testing/selftests/media_tests/media_device_test.c +13 -6
@@ -1,5 +1,5 @@/* -* media_devkref_test.c - Media Controller Device Kref API Test +* media_device_test.c - Media Controller Device ioctl loop Test * * Copyright (c) 2016 Shuah Khan <[email protected]> * Copyright (c) 2016 Samsung Electronics Co., Ltd.
@@ -35,13 +35,14 @@#include <fcntl.h> #include <sys/ioctl.h> #include <sys/stat.h> +#include <time.h> #include <linux/media.h> int main (int argc,char **argv) {int opt;char media_device[256 ]; -int count =0 ; +int count;struct media_device_info mdi;int ret;int fd;
@@ -69,6 +70,10 @@ int main(int argc, char **argv)exit (-1 ); } +/* Generate random number of interations */ +srand ((unsigned int )time (NULL )); + count =rand (); +/* Open Media device and keep it open */ fd =open (media_device,O_RDWR );if (fd ==-1 ) {
@@ -82,14 +87,16 @@ int main(int argc, char **argv)"other Oops in the dmesg. Enable KaSan kernel\n" "config option for use-after-free error detection.\n\n"); -while (count <100 ) { +printf ("Running test for %d iternations\n" , count); + +while (count >0 ) { ret =ioctl (fd,MEDIA_IOC_DEVICE_INFO , &mdi);if (ret <0 )printf ("Media Device Info errno %s\n" ,strerror (errno));else -printf ("Media device model %s driver %s\n" , - mdi.model, mdi.driver); +printf ("Media device model %s driver %s - count %d\n" , + mdi.model, mdi.driver, count);sleep (10 ); - count++; + count--; } }
tools/testing/selftests/media_tests/open_loop_test.sh new file +10 -0
@@ -0,0 +1,10 @@ +#!/bin/bash + i=0 +file=/dev/media$1 + while :; do + echo $file + i=$((i+1)) + R=$(./media_device_open -d $file); + # clear + echo -e "Loop $i\n$R" + done
tools/testing/selftests/media_tests/regression_test.txt new file +43 -0
43 lines not on this page · raw message
tools/testing/selftests/media_tests/video_device_test.c new file +100 -0
100 lines not on this page · raw message
tools/testing/selftests/vm/compaction_test.c +5 -5
@@ -101,7 +101,7 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)/* Start with the initial condition of 0 huge pages*/ if (write (fd,"0" ,sizeof (char )) !=sizeof (char )) { -perror ("Failed to write to /proc/sys/vm/nr_hugepages\n" ); +perror ("Failed to write 0 to /proc/sys/vm/nr_hugepages\n" ); goto close_fd; }
@@ -110,14 +110,14 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)/* Request a large number of huge pages. The Kernel will allocate as much as it can */ if (write (fd,"100000" , (6 *sizeof (char ))) != (6 *sizeof (char ))) { -perror ("Failed to write to /proc/sys/vm/nr_hugepages\n" ); +perror ("Failed to write 100000 to /proc/sys/vm/nr_hugepages\n" ); goto close_fd; }lseek (fd,0 ,SEEK_SET );if (read (fd, nr_hugepages,sizeof (nr_hugepages)) <=0 ) { -perror ("Failed to read from /proc/sys/vm/nr_hugepages\n" ); +perror ("Failed to re-read from /proc/sys/vm/nr_hugepages\n" ); goto close_fd; }
@@ -136,9 +136,9 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)printf ("No of huge pages allocated = %d\n" , (atoi (nr_hugepages))); -if (write (fd, initial_nr_hugepages,sizeof (initial_nr_hugepages)) +if (write (fd, initial_nr_hugepages,strlen (initial_nr_hugepages)) !=strlen (initial_nr_hugepages)) { -perror ("Failed to write to /proc/sys/vm/nr_hugepages\n" ); +perror ("Failed to write value to /proc/sys/vm/nr_hugepages\n" ); goto close_fd; }
tools/testing/selftests/vm/on-fault-limit.c +1 -1
@@ -20,7 +20,7 @@ static int test_limit(void)return ret; } -if (mlockall (MCL_CURRENT |MCL_ONFAULT |MCL_FUTURE )) { +if (mlockall (MCL_ONFAULT |MCL_FUTURE )) {perror ("mlockall" );return ret; }