• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * v4l-test: Test environment for Video For Linux Two API
3  *
4  * 28 Mar 2009  0.2  Clean up ret and errno variable names
5  * 18 Dec 2008  0.1  First release
6  *
7  * Written by M�rton N�meth <nm127@freemail.hu>
8  * Released under GPL
9  */
10 
11 #include <stdio.h>
12 #include <sys/types.h>
13 #include <sys/stat.h>
14 #include <fcntl.h>
15 #include <unistd.h>
16 #include <sys/ioctl.h>
17 #include <errno.h>
18 #include <string.h>
19 
20 #include <linux/videodev2.h>
21 #include <linux/errno.h>
22 
23 #include <CUnit/CUnit.h>
24 #include <CUnit/Basic.h>
25 
26 #include "v4l2_test.h"
27 #include "dev_video.h"
28 #include "video_limits.h"
29 
30 #include "test_invalid_ioctl.h"
31 
32 /* invalid ioctls */
33 
do_invalid_ioctl(int f,int request)34 static void do_invalid_ioctl(int f, int request)
35 {
36 	int ret_invalid, errno_invalid;
37 
38 	ret_invalid = ioctl(f, request, NULL);
39 	errno_invalid = errno;
40 
41 	CU_ASSERT_EQUAL(ret_invalid, -1);
42 	CU_ASSERT_EQUAL(errno_invalid, EINVAL);
43 }
44 
test_invalid_ioctl_1()45 void test_invalid_ioctl_1()
46 {
47 	do_invalid_ioctl(get_video_fd(), _IO(0, 0));
48 }
49 
test_invalid_ioctl_2()50 void test_invalid_ioctl_2()
51 {
52 	do_invalid_ioctl(get_video_fd(), _IO(0xFF, 0xFF));
53 }
54 
test_invalid_ioctl_3()55 void test_invalid_ioctl_3()
56 {
57 	do_invalid_ioctl(get_video_fd(), _IO('v', 0xFF));
58 }
59 
test_invalid_ioctl_4()60 void test_invalid_ioctl_4()
61 {
62 	do_invalid_ioctl(get_video_fd(), _IO('V', 0xFF));
63 }
64