Ticket #1623: psxtests-changes

File psxtests-changes, 8.2 KB (added by Bharath Suri, on Jul 19, 2010 at 4:16:34 AM)

Patch @ testsuites/psxtests

Line 
1Index: psx13/psx13.scn
2===================================================================
3RCS file: /usr1/CVS/rtems/testsuites/psxtests/psx13/psx13.scn,v
4retrieving revision 1.8
5diff -u -r1.8 psx13.scn
6--- psx13/psx13.scn     9 Jul 2010 22:07:11 -0000       1.8
7+++ psx13/psx13.scn     19 Jul 2010 05:02:45 -0000
8@@ -1,5 +1,5 @@
9 
10-** POSIX TEST 13 ***
11+*** POSIX TEST 13 ***
12 
13 Files initialized successfully.
14 Testing device_lseek()... Failed!!!
15Index: psx13/test.c
16===================================================================
17RCS file: /usr1/CVS/rtems/testsuites/psxtests/psx13/test.c,v
18retrieving revision 1.16
19diff -u -r1.16 test.c
20--- psx13/test.c        9 Jul 2010 22:07:11 -0000       1.16
21+++ psx13/test.c        19 Jul 2010 05:02:45 -0000
22@@ -415,9 +415,11 @@
23       else
24        retval = FALSE;
25     }
26-
27     else
28       retval = FALSE;
29+
30+    error = utime("testfile1.tst", NULL );
31+    retval &= (error == 0) ? TRUE : FALSE;
32   }
33 
34   /* assert (retval == TRUE);*/
35@@ -563,6 +565,12 @@
36     error = fpathconf(fd, _PC_SYNC_IO);
37     error = fpathconf(fd, 255);
38 
39+    close(fd);
40+
41+    fd = open("testfile1.tst", O_WRONLY);
42+   
43+    error = fpathconf(fd, _PC_LINK_MAX);
44+
45     retval = TRUE;
46   }
47 
48Index: psxfile01/psxfile01.scn
49===================================================================
50RCS file: /usr1/CVS/rtems/testsuites/psxtests/psxfile01/psxfile01.scn,v
51retrieving revision 1.12
52diff -u -r1.12 psxfile01.scn
53--- psxfile01/psxfile01.scn     15 Jul 2010 13:59:25 -0000      1.12
54+++ psxfile01/psxfile01.scn     19 Jul 2010 05:02:46 -0000
55@@ -1,3 +1,4 @@
56+
57 *** FILE TEST 1 ***
58 *************** Dump of Entire IMFS ***************
59 /
60@@ -30,6 +31,8 @@
61 rmdir /usr
62 rmdir /dev
63 rmdir /fred
64+rmdir /tmp/bha
65+unlink /dev/tty
66 mknod /dev/test_console
67 mknod /dev/tty/S3
68 mknod /etc/passwd
69@@ -48,8 +51,17 @@
70 create /tmp/john
71 tcdrain /tmp/john
72 Attempt to create a file, open in read-only mode and truncate it
73-Exercise the reentrant version _link_r -- Expect EFAULT
74+Exercise the reentrant version _link_r -- Expect ENOENT
75 Unlink /tmp/bha using the reentrant version -- OK
76+mknod with bad type - expect EINVAL
77+open /tmp/bha in write only mode -- OK
78+attempt to read from /tmp/bha - expect EINVAL
79+closing and unlinking /tmp/bha
80+open /tmp/bha in read only mode -- OK
81+attempt to read from /tmp/bha - expect EINVAL
82+closing and unlinking /tmp/bha
83+attempt to read from an unopened filedes - expect EBADF
84+attempt to write to an unopened filedes - expect EBADF
85 mknod /tmp/joel
86 (0)the first write!!!
87 
88@@ -73,7 +85,7 @@
89 
90 stat( /tmp/joel ) returned
91 ....st_dev     (0xfffe:0x0)
92-....st_ino     13  may vary by small amount
93+....st_ino     15  may vary by small amount
94 ....mode  = 00100700
95 ....nlink = 1
96 ....uid = 0
97@@ -106,7 +118,7 @@
98 That is likely to be bigger than the available RAM on many targets.
99 stat( /tmp/joel ) returned
100 ....st_dev     (0xfffe:0x0)
101-....st_ino     14  may vary by small amount
102+....st_ino     16  may vary by small amount
103 ....mode  = 00100700
104 ....nlink = 1
105 ....uid = 0
106@@ -137,7 +149,7 @@
107 (4) 26 characters written to the file
108 (5) 26 characters written to the file
109 ....st_dev     (0xfffe:0x0)
110-....st_ino     15  may vary by small amount
111+....st_ino     17  may vary by small amount
112 ....mode  = 00100644
113 ....nlink = 1
114 ....uid = 0
115@@ -153,7 +165,7 @@
116 This is call 4 to fprintf
117 This is call 5 to fprintf
118 ....st_dev     (0xfffe:0x0)
119-....st_ino     15  may vary by small amount
120+....st_ino     17  may vary by small amount
121 ....mode  = 00100644
122 ....nlink = 1
123 ....uid = 0
124@@ -183,7 +195,7 @@
125 ***************       End of Dump        ***************
126 truncate /tmp/j to length of 40
127 ....st_dev     (0xfffe:0x0)
128-....st_ino     15  may vary by small amount
129+....st_ino     17  may vary by small amount
130 ....mode  = 00100644
131 ....nlink = 1
132 ....uid = 0
133Index: psxfile01/test.c
134===================================================================
135RCS file: /usr1/CVS/rtems/testsuites/psxtests/psxfile01/test.c,v
136retrieving revision 1.28
137diff -u -r1.28 test.c
138--- psxfile01/test.c    16 Jul 2010 09:23:42 -0000      1.28
139+++ psxfile01/test.c    19 Jul 2010 05:02:46 -0000
140@@ -244,6 +244,16 @@
141   rtems_test_assert (status == -1);
142   rtems_test_assert( errno == ENOENT );
143 
144+  puts( "rmdir /tmp/bha" );
145+  status = rmdir( "/tmp/bha" );
146+  rtems_test_assert( status == -1 );
147+  rtems_test_assert( errno == ENOENT );
148+
149+  puts( "unlink /dev/tty" );
150+  status = unlink( "/dev/tty" );
151+  rtems_test_assert( status == -1 );
152+  rtems_test_assert( errno == EISDIR );
153+
154   puts( "mknod /dev/test_console" );
155   status = mknod( "/dev/test_console", S_IFCHR, 0LL );
156   rtems_test_assert( !status );
157@@ -339,16 +349,70 @@
158   rtems_test_assert( fd == -1 );
159   rtems_test_assert( errno == EINVAL );
160 
161-  puts( "Exercise the reentrant version _link_r -- Expect EEXIST" );
162-  status = _link_r( NULL, "", "" );
163+  puts( "Exercise the reentrant version _link_r -- Expect ENOENT" );
164+  status = _link_r( NULL, "/tmp/notexist", "/tmp/cannotexist" );
165   rtems_test_assert( status == -1 );
166-  rtems_test_assert( errno == EEXIST );
167+  rtems_test_assert( errno == ENOENT );
168 
169   puts( "Unlink /tmp/bha using the reentrant version -- OK" );
170   status = _unlink_r( NULL, "/tmp/bha" );
171   rtems_test_assert( status == 0 );
172 
173   /*
174+   * Simple test case for mknod
175+   */
176+
177+  puts( "mknod with bad type - expect EINVAL" );
178+  status = mknod( "/tmp/bha", 0, 0LL );
179+  rtems_test_assert( status == -1 );
180+  rtems_test_assert( errno == EINVAL );
181+
182+  /*
183+   * Read from filedes opened for write
184+   */
185+
186+  puts( "open /tmp/bha in write only mode -- OK" );
187+  fd = open( "/tmp/bha", O_CREAT | O_WRONLY, S_IRWXU|S_IRWXG|S_IRWXO );
188+  rtems_test_assert( fd != -1 );
189
190+  puts( "attempt to read from /tmp/bha - expect EINVAL" );
191+  status = read( fd, buffer, 10 );
192+  rtems_test_assert( status == -1 );
193+  rtems_test_assert( errno == EINVAL );
194+
195+  puts( "closing and unlinking /tmp/bha" );
196+  status = close( fd );
197+  status |= unlink( "/tmp/bha" );
198+  rtems_test_assert( status == 0 );
199+
200+  puts( "open /tmp/bha in read only mode -- OK" );
201+  fd = open( "/tmp/bha", O_CREAT | O_RDONLY, S_IRWXU|S_IRWXG|S_IRWXO );
202+  rtems_test_assert( fd != -1 );
203
204+  puts( "attempt to read from /tmp/bha - expect EINVAL" );
205+  status = write( fd, buffer, 10 );
206+  rtems_test_assert( status == -1 );
207+  rtems_test_assert( errno == EINVAL );
208+
209+  puts( "closing and unlinking /tmp/bha" );
210+  status = close( fd );
211+  status |= unlink( "/tmp/bha" );
212+  rtems_test_assert( status == 0 );
213+
214+  /*
215+   * Read/write from an unopened filedes
216+   */
217+  puts( "attempt to read from an unopened filedes - expect EBADF" );
218+  status = read( 5, buffer, 10 );
219+  rtems_test_assert( status == -1 );
220+  rtems_test_assert( errno == EBADF );
221+
222+  puts( "attempt to write to an unopened filedes - expect EBADF" );
223+  status = write( 5, buffer, 10 );
224+  rtems_test_assert( status == -1 );
225+  rtems_test_assert( errno == EBADF );
226+
227+  /*
228    *  Test simple write to a file at offset 0
229    */
230 
231Index: psxstat/psxstat.scn
232===================================================================
233RCS file: /usr1/CVS/rtems/testsuites/psxtests/psxstat/psxstat.scn,v
234retrieving revision 1.12
235diff -u -r1.12 psxstat.scn
236--- psxstat/psxstat.scn 15 Jul 2010 13:59:25 -0000      1.12
237+++ psxstat/psxstat.scn 19 Jul 2010 05:02:47 -0000
238@@ -1704,12 +1704,13 @@
239 ...st_ctime   Sat Dec 31 09:00:35 1988
240 ...st_blksize 0
241 ...st_blocks  0
242-statvfs, with invalid path - expect EFAULT
243+statvfs, with invalid path - expect ENOTSUP
244 create /tmp -- OK
245 statvfs, with valid path - expect ENOTSUP
246 statvfs tested!
247 Exercise the reentrant version - _stat_r - expect EFAULT
248 Exercise the reentrant version - _lstat_r - expect EFAULT
249+Try readlink with a bad buffer - expect EFAULT
250 
251 
252 *** END OF STAT TEST 01 ***
253Index: psxstat/test.c
254===================================================================
255RCS file: /usr1/CVS/rtems/testsuites/psxtests/psxstat/test.c,v
256retrieving revision 1.30
257diff -u -r1.30 test.c
258--- psxstat/test.c      15 Jul 2010 13:59:25 -0000      1.30
259+++ psxstat/test.c      19 Jul 2010 05:02:48 -0000
260@@ -939,6 +939,11 @@
261   rtems_test_assert( status == -1 );
262   rtems_test_assert( errno == EFAULT );
263 
264+  puts( "Try readlink with a bad buffer - expect EFAULT" );
265+  status = readlink( "/tmp", NULL, 0 );
266+  rtems_test_assert( status == -1 );
267+  rtems_test_assert( errno == EFAULT );
268+
269   puts( "\n\n*** END OF STAT TEST 01 ***" );
270   rtems_test_exit(0);
271 }