summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-03-13 11:33:51 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-03-13 12:23:37 +0100
commit3b7c123c8d910eb60ab3b38dec6224e2de9847c9 (patch)
treea67335010c15af5efb5e27224ae9204883c2b5b8 /testsuites/psxtests
parentAdd missing BSD sections. (diff)
downloadrtems-3b7c123c8d910eb60ab3b38dec6224e2de9847c9.tar.bz2
Filesystem: Reference counting for locations
o A new data structure rtems_filesystem_global_location_t was introduced to be used for o the mount point location in the mount table entry, o the file system root location in the mount table entry, o the root directory location in the user environment, and o the current directory location in the user environment. During the path evaluation global start locations are obtained to ensure that the current file system instance will be not unmounted in the meantime. o The user environment uses now reference counting and is protected from concurrent access. o The path evaluation process was completely rewritten and simplified. The IMFS, RFS, NFS, and DOSFS use now a generic path evaluation method. Recursive calls in the path evaluation have been replaced with iteration to avoid stack overflows. Only the evaluation of symbolic links is recursive. No dynamic memory allocations and intermediate buffers are used in the high level path evaluation. No global locks are held during the file system instance specific path evaluation process. o Recursive symbolic link evaluation is now limited by RTEMS_FILESYSTEM_SYMLOOP_MAX. Applications can retrieve this value via sysconf(). o The device file system (devFS) uses now no global variables and allocation from the workspace. Node names are allocated from the heap. o The upper layer lseek() performs now some parameter checks. o The upper layer ftruncate() performs now some parameter checks. o unmask() is now restricted to the RWX flags and protected from concurrent access. o The fchmod_h and rmnod_h file system node handlers are now a file system operation. o The unlink_h operation has been removed. All nodes are now destroyed with the rmnod_h operation. o New lock_h, unlock_h, clonenod_h, and are_nodes_equal_h file system operations. o The path evaluation and file system operations are now protected by per file system instance lock and unlock operations. o Fix and test file descriptor duplicate in fcntl(). o New test fstests/fsnofs01.
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r--testsuites/psxtests/psxchroot01/test.c56
-rw-r--r--testsuites/psxtests/psxfchx01/init.c4
-rw-r--r--testsuites/psxtests/psxfile01/main.c1
-rw-r--r--testsuites/psxtests/psxfile01/test.c10
-rw-r--r--testsuites/psxtests/psximfs02/init.c41
-rw-r--r--testsuites/psxtests/psxmount/test.c108
-rw-r--r--testsuites/psxtests/psxreaddir/test.c44
-rw-r--r--testsuites/psxtests/psxstat/test.c44
8 files changed, 140 insertions, 168 deletions
diff --git a/testsuites/psxtests/psxchroot01/test.c b/testsuites/psxtests/psxchroot01/test.c
index a5714253b4..95a4ee10e3 100644
--- a/testsuites/psxtests/psxchroot01/test.c
+++ b/testsuites/psxtests/psxchroot01/test.c
@@ -1,23 +1,10 @@
/*
- * This is a native test to explore how the readdir() family works.
- * Newlib supports the following readdir() family members:
- *
- * closedir() -
- * readdir() -
- * scandir() -
- * opendir() -
- * rewinddir() -
- * telldir() - BSD not in POSIX
- * seekdir() - BSD not in POSIX
- *
- *
- * seekdir() takes an offset which is a byte offset. The Linux
- * implementation of this appears to seek to the ((off/DIRENT_SIZE) + 1)
- * record where DIRENT_SIZE seems to be 12 bytes.
- *
* COPYRIGHT (c) 1989-2010.
* On-Line Applications Research Corporation (OAR).
*
+ * Modifications to support reference counting in the file system are
+ * Copyright (c) 2012 embedded brains GmbH.
+ *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
@@ -37,10 +24,11 @@
#include <errno.h>
#include <rtems/libio.h>
#include <rtems/userenv.h>
+#include <rtems/malloc.h>
#include <pmacros.h>
#include <rtems/libcsupport.h>
-void touch( char *file )
+static void touch( char *file )
{
int fd;
@@ -51,7 +39,7 @@ void touch( char *file )
close( fd );
}
-int fileexists( char *file )
+static int fileexists( char *file )
{
int status;
struct stat statbuf;
@@ -77,7 +65,7 @@ int main(
#endif
{
int status;
- void *alloc_ptr = (void *)0;
+ void *opaque;
/*
* This test is the C equivalent of this sequence.
#mkdir /one
@@ -108,21 +96,27 @@ int main(
touch( "/one/one.test" );
touch( "/one/two/two.test" );
- puts( "allocate most of memory - attempt to fail chroot - expect ENOTSUP" );
- alloc_ptr = malloc( malloc_free_space() - 4 );
- rtems_test_assert( alloc_ptr != NULL );
+ puts( "chroot with bad path - expect ENOENT" );
+ status = chroot( "/three" );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENOENT );
- status = chroot( "/one" );
+ puts( "chroot with file - expect ENOTDIR" );
+ status = chroot( "/one/one.test" );
rtems_test_assert( status == -1 );
- rtems_test_assert( errno == ENOTSUP );
+ rtems_test_assert( errno == ENOTDIR );
- puts( "freeing the allocated memory" );
- free( alloc_ptr );
+ puts( "allocate most of memory - attempt to fail chroot - expect ENOMEM" );
+ opaque = rtems_heap_greedy_allocate(
+ sizeof(rtems_filesystem_global_location_t)
+ );
- puts( "chroot with bad path - expect EFAULT" );
- status = chroot( NULL );
+ status = chroot( "/one" );
rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EFAULT );
+ rtems_test_assert( errno == ENOMEM );
+
+ puts( "freeing the allocated memory" );
+ rtems_heap_greedy_free( opaque );
status = chroot( "/one" );
rtems_test_assert( status == 0 );
@@ -133,8 +127,8 @@ int main(
status = fileexists( "/two/two.test" );
printf( "%s on /two/two.test\n", (status) ? "SUCCESS" : "FAILURE" );
- puts( "Reset the private environment" );
- rtems_libio_set_private_env();
+ puts( "Go back to global environment" );
+ rtems_libio_use_global_env();
status = fileexists( "/one/one.test" );
printf( "%s on /one/one.test\n", ( status) ? "SUCCESS" : "FAILURE" );
diff --git a/testsuites/psxtests/psxfchx01/init.c b/testsuites/psxtests/psxfchx01/init.c
index 9b984cd71e..7ef030e5dc 100644
--- a/testsuites/psxtests/psxfchx01/init.c
+++ b/testsuites/psxtests/psxfchx01/init.c
@@ -47,7 +47,7 @@ rtems_task Init(
rtems_test_assert( errno == EBADF );
puts( "Init - opening /newfile in write-mode -- OK" );
- fd = open( "/newfile", O_WRONLY | O_CREAT, S_IWUSR );
+ fd = open( "/newfile", O_WRONLY | O_CREAT, S_IWUSR | S_IXUSR );
rtems_test_assert( fd != -1 );
puts( "Init - fchdir on the file descriptor - expect ENOTDIR" );
@@ -64,7 +64,7 @@ rtems_task Init(
rtems_test_assert( status == 0 );
puts( "Init - opening /newfile in read-mode -- OK" );
- fd = open( "/newfile", O_RDONLY | O_CREAT, S_IRUSR);
+ fd = open( "/newfile", O_RDONLY | O_CREAT, S_IRUSR | S_IXUSR);
rtems_test_assert( fd != -1 );
puts( "Init - fchdir on the file descriptor - expect ENOTDIR" );
diff --git a/testsuites/psxtests/psxfile01/main.c b/testsuites/psxtests/psxfile01/main.c
index 8abf3a66d6..3f8d9b88e3 100644
--- a/testsuites/psxtests/psxfile01/main.c
+++ b/testsuites/psxtests/psxfile01/main.c
@@ -39,6 +39,7 @@ rtems_task Init(
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 6
#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_INIT_TASK_STACK_SIZE (2 * RTEMS_MINIMUM_STACK_SIZE)
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
diff --git a/testsuites/psxtests/psxfile01/test.c b/testsuites/psxtests/psxfile01/test.c
index 0474021967..a82303bd17 100644
--- a/testsuites/psxtests/psxfile01/test.c
+++ b/testsuites/psxtests/psxfile01/test.c
@@ -224,11 +224,6 @@ int main(
rtems_test_assert( status == -1 );
rtems_test_assert( errno == EEXIST );
- /* test rtems_filesystem_evaluate_path by sending NULL path */
- status = chdir( NULL );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EFAULT );
-
/*
* Now switch gears and exercise rmdir().
*/
@@ -253,11 +248,6 @@ int main(
rtems_test_assert( status == -1 );
rtems_test_assert( errno == ENOENT );
- puts( "unlink /dev/tty" );
- status = unlink( "/dev/tty" );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EISDIR );
-
puts( "mknod /dev/test_console" );
status = mknod( "/dev/test_console", S_IFCHR, 0LL );
rtems_test_assert( !status );
diff --git a/testsuites/psxtests/psximfs02/init.c b/testsuites/psxtests/psximfs02/init.c
index 7ae97705a5..d170d4ef6f 100644
--- a/testsuites/psxtests/psximfs02/init.c
+++ b/testsuites/psxtests/psximfs02/init.c
@@ -22,6 +22,7 @@
#include <fcntl.h>
#include <errno.h>
#include <rtems/libio.h>
+#include <rtems/malloc.h>
#include <rtems/libcsupport.h>
#if !HAVE_DECL_SETEUID
@@ -34,11 +35,14 @@ rtems_task Init(
)
{
int status = 0;
- void *alloc_ptr = (void *)0;
+ void *opaque;
char linkname_n[20] = {0};
char linkname_p[20] = {0};
int i;
struct stat stat_buf;
+ static const char mount_point [] = "dir01";
+ static const char fs_type [] = RTEMS_FILESYSTEM_TYPE_IMFS;
+ static const char slink_2_name [] = "node-slink-2";
puts( "\n\n*** TEST IMFS 02 ***" );
@@ -92,27 +96,31 @@ rtems_task Init(
rtems_test_assert( errno == EACCES );
puts( "Allocate most of heap" );
- alloc_ptr = malloc( malloc_free_space() - 150 );
+ opaque = rtems_heap_greedy_allocate(
+ sizeof( rtems_filesystem_mount_table_entry_t )
+ + sizeof( fs_type )
+ + sizeof( rtems_filesystem_global_location_t )
+ );
- puts( "Attempt to mount a fs at /dir01 -- expect ENOMEM" );
+ printf( "Attempt to mount a fs at %s -- expect ENOMEM", mount_point );
status = mount( NULL,
- "dir01",
- "imfs",
+ mount_point,
+ fs_type,
RTEMS_FILESYSTEM_READ_WRITE,
NULL );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == ENOMEM );
puts( "Freeing allocated memory" );
- free( alloc_ptr );
-
- puts( "Allocate most of heap" );
- alloc_ptr = malloc( malloc_free_space() - 4 );
+ rtems_heap_greedy_free( opaque );
puts( "Changing directory to /" );
status = chdir( "/" );
rtems_test_assert( status == 0 );
+ puts( "Allocate most of heap" );
+ opaque = rtems_heap_greedy_allocate( 0 );
+
puts( "Attempt to create /node-link-2 for /node -- expect ENOMEM" );
status = link( "/node", "/node-link-2" );
rtems_test_assert( status == -1 );
@@ -124,23 +132,22 @@ rtems_task Init(
rtems_test_assert( errno == ENOMEM );
puts( "Freeing allocated memory" );
- free( alloc_ptr );
+ rtems_heap_greedy_free( opaque );
puts( "Allocate most of heap" );
- alloc_ptr = malloc( malloc_free_space() - 40 );
+ opaque = rtems_heap_greedy_allocate( sizeof( slink_2_name ) );
- puts( "Attempt to create /node-slink-2 for /node -- expect ENOMEM" );
- status = symlink( "/node", "node-slink-2" );
+ printf( "Attempt to create %s for /node -- expect ENOMEM", slink_2_name );
+ status = symlink( "/node", slink_2_name );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == ENOMEM );
puts( "Freeing allocated memory" );
- free( alloc_ptr );
+ rtems_heap_greedy_free( opaque );
- puts( "Attempt to stat a hardlink -- expect ENOTSUP" );
+ puts( "Attempt to stat a hardlink" );
status = lstat( "/node-link", &stat_buf );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == ENOTSUP );
+ rtems_test_assert( status == 0 );
puts( "Changing euid to 10" );
status = seteuid( 10 );
diff --git a/testsuites/psxtests/psxmount/test.c b/testsuites/psxtests/psxmount/test.c
index 7e1c84fcda..1e80376685 100644
--- a/testsuites/psxtests/psxmount/test.c
+++ b/testsuites/psxtests/psxmount/test.c
@@ -1,23 +1,10 @@
/*
- * This is a native test to explore how the readdir() family works.
- * Newlib supports the following readdir() family members:
- *
- * closedir() -
- * readdir() -
- * scandir() -
- * opendir() -
- * rewinddir() -
- * telldir() - BSD not in POSIX
- * seekdir() - BSD not in POSIX
- *
- *
- * seekdir() takes an offset which is a byte offset. The Linux
- * implementation of this appears to seek to the ((off/DIRENT_SIZE) + 1)
- * record where DIRENT_SIZE seems to be 12 bytes.
- *
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
+ * Modifications to support reference counting in the file system are
+ * Copyright (c) 2012 embedded brains GmbH.
+ *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
@@ -41,8 +28,6 @@
#include <rtems/libio.h>
#include <pmacros.h>
-extern rtems_filesystem_location_info_t rtems_filesystem_current;
-
DIR *directory;
DIR *directory2;
DIR *directory3;
@@ -100,7 +85,9 @@ int main(
int status;
struct stat statbuf;
static char mount_point_string[25] = { "/c/z/my_mount_point" };
-
+ static const char my_sub_fs_dir [] = "/c/y/my_mount_point/my_sub_fs_dir";
+ static const char my_link [] = "/c/y/my_link";
+ static const char mount_point [] = "/c/y/my_mount_point";
printf( "\n\n*** MOUNT/UNMOUNT TEST ***\n" );
@@ -293,7 +280,7 @@ int main(
/*
- * Verify we cannot unmount a file system while we are in it.
+ * Verify we can unmount a file system while we are in it.
*/
printf("Create and chdir to /c/y/my_mount_point/mydir\n");
@@ -303,22 +290,27 @@ int main(
status = chdir( "/c/y/my_mount_point/mydir" );
rtems_test_assert( status == 0 );
- printf("unmount of /c/y/my_mount_point should fail with EBUSY\n");
+ printf("unmount of /c/y/my_mount_point\n");
status = unmount( "/c/y/my_mount_point" );
+ rtems_test_assert( status == 0 );
+
+ printf("chdir to .. should fail with ENXIO\n");
+ status = chdir( ".." );
rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EBUSY );
+ rtems_test_assert( errno == ENXIO );
/*
- * Chdir to root and verify we can unmount the file system now.
+ * Chdir to root and verify we unmounted the file system now.
*/
printf("chdir to / and verify we can unmount /c/y/my_mount_point\n");
status = chdir( "/" );
rtems_test_assert( status == 0 );
- printf("unmount /c/y/my_mount_point \n");
- status = unmount( "/c/y/my_mount_point" );
- rtems_test_assert( status == 0 );
+ printf("chdir to /c/y/my_mount_point/my_dir should fail with ENOENT\n");
+ status = chdir( "/c/y/my_mount_point/mydir" );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENOENT );
/*
* Attempt to unmount a directory that does not exist.
@@ -344,7 +336,7 @@ int main(
/*
* Create a file and directory then open the directory.
- * Verify unmount will return EBUSY while directory is open.
+ * Verify unmount will return successful while directory is open.
*/
printf("Create and open /c/y/my_mount_point/my_file\n");
@@ -353,21 +345,34 @@ int main(
status = close( fd );
rtems_test_assert( status == 0 );
- printf("\nmkdir /c/y/my_mount_point/my_dir\n");
- status = mkdir( "/c/y/my_mount_point/my_dir", 0x1c0 );
- printf("Open /c/y/my_mount_point/my_dir\n");
- directory = opendir( "/c/y/my_mount_point/my_dir" );
+ printf("\nmkdir %s\n", my_sub_fs_dir );
+ status = mkdir( my_sub_fs_dir, S_IRWXU );
+
+ printf("open %s\n", my_sub_fs_dir );
+ directory = opendir( my_sub_fs_dir );
rtems_test_assert( directory );
- printf("Unmount /c/y/my_mount_point should fail with EBUSY\n");
- status = unmount( "/c/y/my_mount_point" );
+ printf("mkdir %s should fail with EEXIST\n", my_sub_fs_dir );
+ status = mkdir( my_sub_fs_dir, S_IRWXU );
rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EBUSY );
+ rtems_test_assert( errno == EEXIST );
- printf("Close /c/y/my_mount_point/my_dir\n");
+ printf("unmount %s\n", mount_point );
+ status = unmount( mount_point );
+ rtems_test_assert( status == 0 );
+
+ printf("close %s\n", my_sub_fs_dir );
status = closedir( directory );
rtems_test_assert( status == 0 );
+ printf("mkdir %s\n", my_sub_fs_dir );
+ status = mkdir( my_sub_fs_dir, S_IRWXU );
+ rtems_test_assert( status == 0 );
+
+ printf("rmdir %s\n", my_sub_fs_dir );
+ status = rmdir( my_sub_fs_dir );
+ rtems_test_assert( status == 0 );
+
/*
* Attempt to unmount a directory that is not a mount point.
*/
@@ -378,33 +383,27 @@ int main(
rtems_test_assert( errno == EACCES );
/*
- * Verify a file system can not be unmounted with a mounted file system
- * in it.
+ * Mount file system
*/
- printf("Mount a file system at /c/y/my_mount_point/my_dir\n");
+ printf("Mount a file system at %s\n", mount_point);
status = mount(
"null",
- "/c/y/my_mount_point/my_dir",
+ mount_point,
"imfs",
RTEMS_FILESYSTEM_READ_WRITE,
NULL );
rtems_test_assert( status == 0 );
- printf("unmount /c/y/my_mount_point should fail with EBUSY\n");
- status = unmount( "/c/y/my_mount_point" );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EBUSY );
-
/*
* Verify you cannot create a hard link across mounted file systems.
*/
printf("Verify a hard link across filesystems fails with EXDEV\n");
- status = mkdir( "/c/y/my_mount_point/my_dir2", S_IRWXU );
+ status = mkdir( my_sub_fs_dir, S_IRWXU );
rtems_test_assert( status == 0 );
- status = link( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" );
+ status = link( my_sub_fs_dir, my_link );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == EXDEV );
@@ -413,13 +412,13 @@ int main(
*/
printf("Verify a symbolic link across file systems works\n");
- status = symlink( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" );
+ status = symlink( my_sub_fs_dir, my_link );
rtems_test_assert( status == 0 );
- status = stat( "/c/y/my_mount_point/my_dir/my_link", &statbuf );
+ status = stat( my_link, &statbuf );
rtems_test_assert( status == 0 );
- printf("unmount /c/y/my_mount_point/my_dir\n");
- status = unmount( "/c/y/my_mount_point/my_dir" );
+ printf("unmount %s\n", mount_point);
+ status = unmount( mount_point );
rtems_test_assert( status == 0 );
/*
@@ -427,12 +426,9 @@ int main(
*/
printf("Verify the symbolic link now fails\n");
- status = stat( "/c/y/my_mount_point/my_dir/my_link", &statbuf );
- rtems_test_assert( status != 0 );
-
- printf("unmount /c/y/my_mount_point\n");
- status = unmount( "/c/y/my_mount_point" );
- rtems_test_assert( status == 0 );
+ status = stat( my_link, &statbuf );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENOENT );
printf( "\n\n*** END OF MOUNT/UNMOUNT TEST ***\n" );
rtems_test_exit(0);
diff --git a/testsuites/psxtests/psxreaddir/test.c b/testsuites/psxtests/psxreaddir/test.c
index e3b30822c9..8ea67ccdda 100644
--- a/testsuites/psxtests/psxreaddir/test.c
+++ b/testsuites/psxtests/psxreaddir/test.c
@@ -230,6 +230,8 @@ int main(
)
#endif
{
+ static const char *my_file = "/b/my_file";
+
int fd;
int i;
int status;
@@ -277,14 +279,14 @@ int main(
d_not = readdir( directory_not );
rtems_test_assert( d_not == 0 );
- printf("open /b/myfile\n");
- fd = open ("/b/my_file", O_CREAT, S_IRWXU);
+ printf("open %s\n", my_file);
+ fd = open (my_file, O_CREAT, S_IRWXU);
rtems_test_assert( fd != -1 );
close (fd);
printf("scandir a file status: ");
status = scandir(
- "/b/my_file",
+ my_file,
&namelist,
select1,
NULL
@@ -303,13 +305,13 @@ int main(
status = fcntl( fd, F_GETFD, 1 );
rtems_test_assert( status == 1 );
-#if 0
- printf("fcntl F_DUPFD should return 0\n");
+ printf("fcntl F_DUPFD should return a file descriptor\n");
status = fcntl( fd, F_DUPFD, 0 );
+ rtems_test_assert ( status >= 0 );
+
+ printf("close duplicate should return 0\n");
+ status = close( status );
rtems_test_assert ( status == 0 );
-#else
- printf("fcntl F_DUPFD should return 0 -- skip until implemented\n");
-#endif
printf("fcntl F_GETFL returns current flags\n");
status = fcntl( fd, F_GETFL, 1 );
@@ -350,16 +352,28 @@ int main(
printf("Status %d\n",status);
rtems_test_assert( status == -1 );
- printf("opendir and readdir /b/myfile\n");
- directory_not = opendir ("/b/my_file");
+ printf("close should return 0\n");
+ status = close( fd );
+ rtems_test_assert ( status == 0 );
+
+ printf("opendir, readdir and closedir %s\n", my_file);
+ directory_not = opendir (my_file);
+ rtems_test_assert( directory_not != NULL );
d_not = readdir(directory_not);
+ rtems_test_assert( d_not == NULL );
+ status = closedir (directory_not);
+ rtems_test_assert (status == 0);
- printf("opendir and readdir\n");
+ printf("opendir, readdir and closedir\n");
directory_not = opendir ("/a");
+ rtems_test_assert( directory_not != NULL );
d_not = readdir (directory_not);
+ rtems_test_assert( d_not == NULL );
+ status = closedir (directory_not);
+ rtems_test_assert (status == 0);
- printf("chdir to /b/myfile\n");
- status = chdir ("/b/my_file");
+ printf("chdir to %s\n", my_file);
+ status = chdir (my_file);
rtems_test_assert (status == -1);
printf( "\nPerforming stat of directory /\n");
@@ -500,6 +514,10 @@ int main(
printf("Selected and Sorted Node Name: %s\n", namelist[i]->d_name );
}
+ printf("unlink %s should return 0\n", my_file);
+ status = unlink( my_file );
+ rtems_test_assert ( status == 0 );
+
test_across_mount();
printf( "\n\n*** END OF READDIR TEST ***\n" );
rtems_test_exit(0);
diff --git a/testsuites/psxtests/psxstat/test.c b/testsuites/psxtests/psxstat/test.c
index c5d344d8fc..ecc82e531b 100644
--- a/testsuites/psxtests/psxstat/test.c
+++ b/testsuites/psxtests/psxstat/test.c
@@ -45,7 +45,7 @@ int _lstat_r(struct _reent *, const char *, struct stat *);
*/
char *Files[] = {
- "/////my_mount_point/dir1/\\//file1\\\\//",
+ "/////my_mount_point/dir1/\\//file1",
"/my_mount_point/dir1/file2",
"/my_mount_point/dir1/file3",
"/my_mount_point/dir1/file4",
@@ -60,7 +60,7 @@ char *Files[] = {
*/
char *Directories[] = {
- "/my_mount_point/dir1",
+ "/my_mount_point/dir1\\\\//",
"/my_mount_point/dir2",
"/my_mount_point/dir3",
"/my_mount_point/dir4",
@@ -589,15 +589,6 @@ void Cause_faults(void)
rtems_test_assert( errno == EACCES );
/*
- * Check stat with a NULL buffer.
- */
-
- printf("Stat with a NULL buffer should fail with EFAULT\n");
- status = stat( Directories[0], NULL );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EFAULT );
-
- /*
* Set current to a directory with no owner permissions.
* Verify it works properly.
*/
@@ -685,13 +676,8 @@ void Cause_faults(void)
* Check rmdir, rmnod, and unlink
*/
- printf("rmdir %s should fail with ENOTDIR\n", Links_to_Dirs[5] );
+ printf("rmdir %s\n", Links_to_Dirs[5] );
status = rmdir( Links_to_Dirs[5] );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == ENOTDIR );
-
- printf("unlink %s\n", Links_to_Dirs[5] );
- status = unlink( Links_to_Dirs[5] );
rtems_test_assert( status == 0 );
printf("unlink %s should fail with ENOTEMPTY\n", Links_to_dirlinks[5] );
@@ -757,11 +743,6 @@ void Cause_faults(void)
printf("Making too many hard links.\n" );
make_too_many_links( );
- printf( "pass fstat a null pointer should fail with EFAULT\n");
- status = fstat( fd, NULL );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EFAULT);
-
/*
* The current directory MUST be restored at the end of this test.
*/
@@ -789,10 +770,10 @@ void test_statvfs( void )
int status = 0;
struct statvfs stat;
- puts( "statvfs, with invalid path - expect ENOTSUP" );
+ puts( "statvfs, with invalid path - expect ENOENT" );
status = statvfs( "" , &stat );
rtems_test_assert( status == -1 );
- rtems_test_assert( errno == ENOTSUP );
+ rtems_test_assert( errno == ENOENT );
puts( "create /tmp -- OK" );
status = mkdir( "/tmp", 0777 );
@@ -944,21 +925,6 @@ int main(
test_statvfs();
- puts( "Exercise the reentrant version - _stat_r - expect EFAULT" );
- status = _stat_r( NULL, NULL, NULL );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EFAULT );
-
- puts( "Exercise the reentrant version - _lstat_r - expect EFAULT" );
- status = _lstat_r( NULL, NULL, NULL );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EFAULT );
-
- puts( "Try readlink with a bad buffer - expect EFAULT" );
- status = readlink( "/tmp", NULL, 0 );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EFAULT );
-
puts( "\n\n*** END OF STAT TEST 01 ***" );
rtems_test_exit(0);
}