2010-08-06 Bharath Suri <bharath.s.jois@gmail.com>

PR 1654/testing
	* psx13/test.c, psx13/psx13.scn: Test case to improve testing of
	dup2 routine.
	* psxfile01/test.c, psxfile01/psxfile01.scn: New test to improve
	testing of fcntl routine.
	* psximfs01/init.c, psximfs01/psximfs01.scn: Improve testing of
	imfs routines.
	* psximfs02/init.c, psximfs02/psximfs02.scn: Improve coverage of
	imfs routines.
	* psxpasswd02/init.c, psxpasswd02/psxpasswd02.scn: New tests to
	improve coverage of getpwent.c.
This commit is contained in:
Joel Sherrill
2010-08-07 00:22:46 +00:00
parent 39a056b8a1
commit 99e6fb5244
11 changed files with 89 additions and 13 deletions

View File

@@ -1,3 +1,17 @@
2010-08-06 Bharath Suri <bharath.s.jois@gmail.com>
PR 1654/testing
* psx13/test.c, psx13/psx13.scn: Test case to improve testing of
dup2 routine.
* psxfile01/test.c, psxfile01/psxfile01.scn: New test to improve
testing of fcntl routine.
* psximfs01/init.c, psximfs01/psximfs01.scn: Improve testing of
imfs routines.
* psximfs02/init.c, psximfs02/psximfs02.scn: Improve coverage of
imfs routines.
* psxpasswd02/init.c, psxpasswd02/psxpasswd02.scn: New tests to
improve coverage of getpwent.c.
2010-08-06 Ralf Corsépius <ralf.corsepius@rtems.org>
PR 1652/GCC:

View File

@@ -1,10 +1,9 @@
*** POSIX TEST 13 ***
Files initialized successfully.
Testing device_lseek()... Failed!!!
Testing dup()............ Failed!!!
Testing dup2()........... Failed!!!
Testing dup2()........... Success.
Testing fdatasync()...... Success.
Testing umask().......... Success.
Testing utime().......... Success.

View File

@@ -142,7 +142,7 @@ int DeviceLSeekTest (void)
else
retval = FALSE;
/* assert (retval == TRUE);*/
close( fd ); /* assert (retval == TRUE);*/
return (retval);
}
@@ -187,6 +187,8 @@ int DupTest(void)
else
retval = FALSE;
close( fd1 );
close( fd2 );
/* assert (retval == TRUE);*/
return (retval);
@@ -257,7 +259,7 @@ int Dup2Test(void)
}
close (fd1);
close (fd2);
/* assert (retval == TRUE);*/
return (retval);

View File

@@ -1,10 +1,9 @@
*** FILE TEST 1 ***
*************** Dump of Entire IMFS ***************
/
....dev/
........console (device 0, 0)
*************** End of Dump ***************
*************** End of Dump ***************
stat of /dev/console
....st_dev (0xfffe:0x0)
....st_ino 3 may vary by small amount
@@ -55,6 +54,7 @@ Exercise the reentrant version _link_r -- Expect ENOENT
Unlink /tmp/bha using the reentrant version -- OK
mknod with bad type - expect EINVAL
open /tmp/bha in write only mode -- OK
attempt fcntl on opened file -- OK
attempt to read from /tmp/bha - expect EINVAL
closing and unlinking /tmp/bha
open /tmp/bha in read only mode -- OK
@@ -192,7 +192,7 @@ This is call 5 to fprintf
........j (file 130)
....imfs/
........hidden_on_mount/
*************** End of Dump ***************
*************** End of Dump ***************
truncate /tmp/j to length of 40
....st_dev (0xfffe:0x0)
....st_ino 17 may vary by small amount
@@ -221,7 +221,7 @@ truncate /tmp/j to length of 40
........j (file 40)
....imfs/
........hidden_on_mount/
*************** End of Dump ***************
*************** End of Dump ***************
truncate /tmp/j to length of 0
truncate /tmp to length of 0 should fail with EISDIR
@@ -242,7 +242,7 @@ truncate /tmp to length of 0 should fail with EISDIR
........j (file 0)
....imfs/
........hidden_on_mount/
*************** End of Dump ***************
*************** End of Dump ***************
Writing First File
Writing Second File
(0)this is a test line

View File

@@ -374,7 +374,11 @@ int main(
puts( "open /tmp/bha in write only mode -- OK" );
fd = open( "/tmp/bha", O_CREAT | O_WRONLY, S_IRWXU|S_IRWXG|S_IRWXO );
rtems_test_assert( fd != -1 );
puts( "attempt fcntl on opened file -- OK" );
status = fcntl( fd, F_SETFD, 0 );
rtems_test_assert( status == 0 );
puts( "attempt to read from /tmp/bha - expect EINVAL" );
status = read( fd, buffer, 10 );
rtems_test_assert( status == -1 );

View File

@@ -147,7 +147,6 @@ void extend_helper(void)
position = lseek( TestFd, 0, SEEK_END );
printf( "Seek to end .. returned %d\n", (int) position );
rtems_test_assert( position == 1 );
/*
* test case to ftruncate a file to a length > its size
@@ -179,6 +178,7 @@ void extend_helper(void)
rc,
strerror( errno )
);
break;
}
else {
break;
@@ -216,6 +216,8 @@ rtems_task Init(
int i;
void *alloc_ptr = (void *)0;
Heap_Information_block Info;
int position = 0;
int status = 0;
puts( "\n\n*** TEST IMFS 01 ***" );
@@ -248,6 +250,12 @@ rtems_task Init(
*/
free(alloc_ptr);
extend_helper();
position = lseek( TestFd , 0, SEEK_END );
status = lseek( TestFd, position+2, SEEK_SET );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == ENOSPC );
close_it();
unlink_it();

View File

@@ -14,6 +14,8 @@ Seek to end .. returned 1280
lseek/ftruncate loop..
Seek to end .. returned 1
lseek/ftruncate loop..
Seek to end .. returned 1295
lseek/ftruncate loop..
close(biggie) - OK
unlink(biggie) - OK
*** END OF TEST IMFS 01 ***

View File

@@ -161,6 +161,22 @@ rtems_task Init(
IMFS_dump();
puts( "chown /fifo to 10 -- OK" );
status = chown( "/fifo", 10, 10 );
rtems_test_assert( status == 0 );
puts( "Changing euid to 10" );
status = seteuid( 10 );
rtems_test_assert( status == 0 );
puts( "chmod /fifo -- OK" );
status = chmod( "/fifo", S_IRWXU );
rtems_test_assert( status == 0 );
printk( "chown /fifo to %o -- OK", 0 );
status = chown( "/fifo", 0, 0 );
rtems_test_assert( status == 0 );
puts( "*** END OF TEST IMFS 02 ***" );
rtems_test_exit(0);
}

View File

@@ -57,5 +57,8 @@ Creating a fifo -- OK
....node-link links not printed
....node-slink links not printed
....fifo FIFO not printed
*************** End of Dump ***************
*** END OF TEST IMFS 02 ***
*************** End of Dump ***************
chown /fifo to 10 -- OK
Changing euid to 10
chmod /fifo -- OK
chown /fifo to 0 -- OK*** END OF TEST IMFS 02 ***

View File

@@ -17,6 +17,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
void print_passwd(
struct passwd *pw
@@ -63,6 +64,9 @@ rtems_task Init(
struct passwd *pw;
struct group *gr;
int status = -1;
char str[100] = {0};
int max_int = INT_MAX;
int limit_value = 0;
FILE *fp = NULL;
@@ -127,6 +131,28 @@ rtems_task Init(
rtems_test_assert( !pw );
rtems_test_assert( errno == EINVAL );
fp = fopen( "/etc/passwd", "w" );
rtems_test_assert( fp != NULL );
fprintf( fp, "user:x:999999999999:1:dummy::/:/bin/sh\n" );
fclose( fp );
puts( "Init - getpwnam(\"root\") -- expected EINVAL" );
pw = getpwnam( "root" );
rtems_test_assert( !pw );
rtems_test_assert( errno == EINVAL );
sprintf( str, "user:x:%d%d:1:dummy::/:/bin/sh\n", max_int/10, max_int%10+1 );
fp = fopen( "/etc/passwd", "w" );
rtems_test_assert( fp != NULL );
fprintf( fp, str );
fclose( fp );
puts( "Init - getpwnam(\"root\") -- expected EINVAL" );
pw = getpwnam( "root" );
rtems_test_assert( !pw );
rtems_test_assert( errno == EINVAL );
puts( "Init - getgrent() -- OK" );
gr = getgrent();
rtems_test_assert( gr != NULL );

View File

@@ -9,6 +9,8 @@ Init - setgrent() -- OK
Init - getpwnam("root") -- expected EINVAL
Init - getpwnam("root") -- expected EINVAL
Init - getpwnam("root") -- expected EINVAL
Init - getpwnam("root") -- expected EINVAL
Init - getpwnam("root") -- expected EINVAL
Init - getgrent() -- OK
group name: admin
group password: