summaryrefslogtreecommitdiffstats
path: root/testsuites/fstests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-08-02 14:24:59 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-08-02 14:24:59 +0000
commit6fed43eabc0e78606cf80439c536a00be18fd743 (patch)
treef74fea0e1e6b46a7acea595ad70131a6b25f34df /testsuites/fstests
parent2011-08-02 Ricardo Aguirre <el.mastin@ymail.com> (diff)
downloadrtems-6fed43eabc0e78606cf80439c536a00be18fd743.tar.bz2
2011-08-02 Xiang Cui <medivhc@gmail.com>
* configure.ac, fserror/test.c, fslink/test.c, fspermission/test.c, fsrdwr/init.c, fssymlink/test.c, fstime/test.c, mdosfs_support/fs_config.h, mdosfs_support/fs_support.c, mimfs_support/fs_support.c, mrfs_support/fs_config.h, support/fstest.h, support/fstest_support.c, support/ramdisk_support.c, support/ramdisk_support.h: Perform first phase of clean up.
Diffstat (limited to 'testsuites/fstests')
-rw-r--r--testsuites/fstests/ChangeLog10
-rw-r--r--testsuites/fstests/configure.ac54
-rw-r--r--testsuites/fstests/fserror/test.c20
-rw-r--r--testsuites/fstests/fslink/test.c2
-rw-r--r--testsuites/fstests/fspermission/test.c26
-rw-r--r--testsuites/fstests/fsrdwr/init.c437
-rw-r--r--testsuites/fstests/fssymlink/test.c16
-rw-r--r--testsuites/fstests/fstime/test.c14
-rw-r--r--testsuites/fstests/mdosfs_support/fs_config.h1
-rw-r--r--testsuites/fstests/mdosfs_support/fs_support.c2
-rw-r--r--testsuites/fstests/mimfs_support/fs_support.c2
-rw-r--r--testsuites/fstests/mrfs_support/fs_config.h9
-rw-r--r--testsuites/fstests/support/fstest.h6
-rw-r--r--testsuites/fstests/support/fstest_support.c98
-rw-r--r--testsuites/fstests/support/ramdisk_support.c49
-rw-r--r--testsuites/fstests/support/ramdisk_support.h2
16 files changed, 387 insertions, 361 deletions
diff --git a/testsuites/fstests/ChangeLog b/testsuites/fstests/ChangeLog
index 622e6bb1c8..065672c7cd 100644
--- a/testsuites/fstests/ChangeLog
+++ b/testsuites/fstests/ChangeLog
@@ -1,3 +1,13 @@
+2011-08-02 Xiang Cui <medivhc@gmail.com>
+
+ * configure.ac, fserror/test.c, fslink/test.c, fspermission/test.c,
+ fsrdwr/init.c, fssymlink/test.c, fstime/test.c,
+ mdosfs_support/fs_config.h, mdosfs_support/fs_support.c,
+ mimfs_support/fs_support.c, mrfs_support/fs_config.h,
+ support/fstest.h, support/fstest_support.c,
+ support/ramdisk_support.c, support/ramdisk_support.h: Perform first
+ phase of clean up.
+
2011-08-01 Xiang Cui <medivhc@gmail.com>
* imfs_fslink/Makefile.am, imfs_fssymlink/Makefile.am,
diff --git a/testsuites/fstests/configure.ac b/testsuites/fstests/configure.ac
index e279389bc6..cb0626172e 100644
--- a/testsuites/fstests/configure.ac
+++ b/testsuites/fstests/configure.ac
@@ -1,5 +1,5 @@
## Process this file with autoconf to produce a configure script.
-##
+##
## $Id$
AC_PREREQ([2.68])
@@ -78,32 +78,32 @@ AC_CHECK_SIZEOF([blksize_t])
AC_CHECK_SIZEOF([blkcnt_t])
# Explicitly list all Makefiles here
-AC_CONFIG_FILES([Makefile
-imfs_fserror/Makefile
-imfs_fslink/Makefile
-imfs_fspatheval/Makefile
-imfs_fspermission/Makefile
-imfs_fsrdwr/Makefile
-imfs_fssymlink/Makefile
-imfs_fstime/Makefile
-mdosfs_fserror/Makefile
-mdosfs_fspatheval/Makefile
-mdosfs_fsrdwr/Makefile
-mdosfs_fstime/Makefile
-mimfs_fserror/Makefile
-mimfs_fslink/Makefile
-mimfs_fspatheval/Makefile
-mimfs_fspermission/Makefile
-mimfs_fsrdwr/Makefile
-mimfs_fssymlink/Makefile
-mimfs_fstime/Makefile
-mrfs_fserror/Makefile
-mrfs_fslink/Makefile
-mrfs_fspatheval/Makefile
-mrfs_fspermission/Makefile
-mrfs_fsrdwr/Makefile
-mrfs_fssymlink/Makefile
-mrfs_fstime/Makefile
+AC_CONFIG_FILES([Makefile
+imfs_fserror/Makefile
+imfs_fslink/Makefile
+imfs_fspatheval/Makefile
+imfs_fspermission/Makefile
+imfs_fsrdwr/Makefile
+imfs_fssymlink/Makefile
+imfs_fstime/Makefile
+mdosfs_fserror/Makefile
+mdosfs_fspatheval/Makefile
+mdosfs_fsrdwr/Makefile
+mdosfs_fstime/Makefile
+mimfs_fserror/Makefile
+mimfs_fslink/Makefile
+mimfs_fspatheval/Makefile
+mimfs_fspermission/Makefile
+mimfs_fsrdwr/Makefile
+mimfs_fssymlink/Makefile
+mimfs_fstime/Makefile
+mrfs_fserror/Makefile
+mrfs_fslink/Makefile
+mrfs_fspatheval/Makefile
+mrfs_fspermission/Makefile
+mrfs_fsrdwr/Makefile
+mrfs_fssymlink/Makefile
+mrfs_fstime/Makefile
])
AC_OUTPUT
diff --git a/testsuites/fstests/fserror/test.c b/testsuites/fstests/fserror/test.c
index d30eb5c6d9..61cf12f791 100644
--- a/testsuites/fstests/fserror/test.c
+++ b/testsuites/fstests/fserror/test.c
@@ -69,7 +69,7 @@ void open_mkdir_error (void)
/*
* O_CREAT is not set and the named file does not exist
* or O_CREAT is set and either the path prefix does not exist or
- * the path argument points to an empty string.
+ * the path argument points to an empty string.
*/
sprintf (name, "%s/%s", name03, name02);
@@ -128,7 +128,7 @@ void rename_error (void)
/*
- * Create a new directory and a new directory in it
+ * Create a new directory and a new directory in it
*/
status = mkdir (name01, mode);
@@ -147,12 +147,12 @@ void rename_error (void)
rtems_test_assert (status != 0);
rtems_test_assert (errno == EEXIST || errno == ENOTEMPTY);
/*
- * The new directory pathname contains a path prefix
+ * The new directory pathname contains a path prefix
* that names the old directory.
*/
EXPECT_ERROR (EINVAL, rename, name01, name);
/*
- * The new argument points to a directory and
+ * The new argument points to a directory and
* the old argument points to a file that is not a directory.
*/
fd = creat (name03, mode);
@@ -206,7 +206,7 @@ void truncate_error (void)
status = chdir (wd);
rtems_test_assert (status == 0);
/*
- * Create a file
+ * Create a file
*/
fd = creat (file, mode);
status = close (fd);
@@ -256,7 +256,8 @@ void rmdir_unlink_error (void)
/*
* The path argument names a directory that is not an empty directory,
- * or there are hard links to the directory other than dot or a single entry in dot-dot.
+ * or there are hard links to the directory other than
+ * dot or a single entry in dot-dot.
*/
EXPECT_ERROR (ENOTEMPTY, rmdir, "..");
@@ -272,8 +273,9 @@ void rmdir_unlink_error (void)
EXPECT_ERROR (EINVAL, rmdir, "tmp/.");
/*
- * A component of path does not name an existing file,
- * or the path argument names a nonexistent directory or points to an empty string
+ * A component of path does not name an existing file,
+ * or the path argument names a nonexistent directory or
+ * points to an empty string
*/
EXPECT_ERROR (ENOENT, rmdir, "");
EXPECT_ERROR (ENOENT, rmdir, nonexistence);
@@ -338,7 +340,7 @@ void rdwr_error (void)
EXPECT_ERROR (EBADF, write, 100, readbuf, 10);
/*
- * The whence argument is not a proper value,
+ * The whence argument is not a proper value,
* or the resulting file offset would be negative for a regular file,
* block special file, or directory.
*/
diff --git a/testsuites/fstests/fslink/test.c b/testsuites/fstests/fslink/test.c
index a9df8ffd4b..f2d2922c97 100644
--- a/testsuites/fstests/fslink/test.c
+++ b/testsuites/fstests/fslink/test.c
@@ -65,7 +65,7 @@ void link_test01 (void)
rtems_test_assert (statbuf.st_nlink == 2);
/*
- * link the file and check the nlink
+ * link the file and check the nlink
*/
status = link (name1, name2);
rtems_test_assert (status == 0);
diff --git a/testsuites/fstests/fspermission/test.c b/testsuites/fstests/fspermission/test.c
index 4750e6d77e..476030f7b0 100644
--- a/testsuites/fstests/fspermission/test.c
+++ b/testsuites/fstests/fspermission/test.c
@@ -40,9 +40,9 @@ void umask_test01(void )
char* directory01="dir01";
const char* wd=__func__;
-
+
mode_t mode=S_IRWXU|S_IRWXG|S_IRWXO ;
-
+
/*
@@ -88,7 +88,7 @@ void umask_test01(void )
tmp_mode = (statbuf.st_mode) & ALLPERMS;
printf("The file mode of %s is %03o\n",file02,(unsigned int)tmp_mode);
rtems_test_assert(tmp_mode==file_mode);
-
+
status = stat (directory01, &statbuf);
rtems_test_assert (status == 0);
tmp_mode = (statbuf.st_mode) & ALLPERMS;
@@ -136,7 +136,7 @@ void umask_test01(void )
tmp_mode = (statbuf.st_mode) & ALLPERMS;
printf("The file mode of %s is %03o\n",file02,(unsigned int)tmp_mode);
rtems_test_assert(tmp_mode==file_mode);
-
+
status = stat (directory01, &statbuf);
rtems_test_assert (status == 0);
tmp_mode = (statbuf.st_mode) & ALLPERMS;
@@ -167,17 +167,17 @@ void test_premission01(void )
char path[20];
char* test_data="Test Data";
char* data_buf;
- size_t len=strlen(test_data);
+ size_t len=strlen(test_data);
int n;
DIR *dp;
const char* wd=__func__;
-
+
mode_t mode=S_IRWXU|S_IRWXG|S_IRWXO ;
uid_t user_id =65534;
gid_t group_id =65534;
-
+
uid_t another_user_id =65533;
gid_t another_group_id =65533;
@@ -234,7 +234,7 @@ void test_premission01(void )
rtems_test_assert(statbuf.st_gid==group_id);
/*
- * Create directory and a file in it for tese
+ * Create directory and a file in it for tese
*/
status=mkdir(directory01,0777);
@@ -253,7 +253,7 @@ void test_premission01(void )
rtems_test_assert(statbuf.st_gid==group_id);
/*
- * Check the file with open and write
+ * Check the file with open and write
*/
/*
@@ -264,7 +264,7 @@ void test_premission01(void )
rtems_test_assert(n==len);
status=close(fd);
rtems_test_assert(status==0);
-
+
fd=open(file02,O_WRONLY);
n=write(fd,test_data,len);
rtems_test_assert(n==len);
@@ -281,7 +281,7 @@ void test_premission01(void )
rtems_test_assert(n==len);
status=close(fd);
rtems_test_assert(status==0);
-
+
EXPECT_ERROR(EACCES,open,file02,O_RDONLY);
EXPECT_ERROR(EACCES,open,file02,O_RDWR);
@@ -349,7 +349,7 @@ void test_premission01(void )
status=seteuid(another_user_id);
rtems_test_assert(status==0);
-
+
EXPECT_ERROR(EACCES,open,file02,O_WRONLY);
EXPECT_ERROR(EACCES,open,file02,O_RDONLY);
EXPECT_ERROR(EACCES,open,file02,O_RDWR);
@@ -395,7 +395,7 @@ void test_premission02(void )
mode_t file_mode=0321;
const char* wd=__func__;
-
+
mode_t mode=S_IRWXU|S_IRWXG|S_IRWXO ;
uid_t user_id =65534;
gid_t group_id =65534;
diff --git a/testsuites/fstests/fsrdwr/init.c b/testsuites/fstests/fsrdwr/init.c
index 6565eb9415..7464277e2f 100644
--- a/testsuites/fstests/fsrdwr/init.c
+++ b/testsuites/fstests/fsrdwr/init.c
@@ -21,12 +21,13 @@
#include "fstest.h"
const char *databuf =
- "Happy days are here again. Happy days are here again.1Happy "
- "days are here again.2Happy days are here again.3Happy days are here again."
- "4Happy days are here again.5Happy days are here again.6Happy days are here "
- "again.7Happy days are here again.";
+ "Happy days are here again. Happy days are here again.1Happy "
+ "days are here again.2Happy days are here again.3Happy days are here again."
+ "4Happy days are here again.5Happy days are here again.6Happy days are here "
+ "again.7Happy days are here again.";
-void read_write_test (void)
+void
+read_write_test (void)
{
int fd;
@@ -42,15 +43,15 @@ void read_write_test (void)
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
- const char* wd=__func__;
+ const char *wd = __func__;
/*
* Create a new directory and change the current directory to this
*/
- status=mkdir(wd,mode);
- rtems_test_assert(status==0);
- status=chdir(wd);
- rtems_test_assert(status==0);
+ status = mkdir (wd, mode);
+ rtems_test_assert (status == 0);
+ status = chdir (wd);
+ rtems_test_assert (status == 0);
/*
* Create an empty file
*/
@@ -142,7 +143,7 @@ void read_write_test (void)
rtems_test_assert (status == 0);
/*
- * Open the file using O_TRUNC
+ * Open the file using O_TRUNC
*/
fd = open (name01, O_WRONLY | O_TRUNC);
@@ -173,347 +174,351 @@ void read_write_test (void)
/*
* Go back to parent directory
*/
- status=chdir("..");
- rtems_test_assert(status==0);
+ status = chdir ("..");
+ rtems_test_assert (status == 0);
}
-void truncate_test03(void )
+void
+truncate_test03 (void)
{
- int fd;
- int status;
- char *name01="name01";
+ int fd;
+ int status;
+ char *name01 = "name01";
struct stat statbuf;
- char data;
- int n;
- int i;
+ char data;
+ int n;
+ int i;
- size_t len = strlen(databuf);
+ size_t len = strlen (databuf);
char *readbuf;
- off_t good_size=100;
- mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO;
+ off_t good_size = 100;
+ mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
- const char* wd=__func__;
+ const char *wd = __func__;
/*
* Create a new directory and change the current directory to this
*/
- status=mkdir(wd,mode);
- rtems_test_assert(status==0);
- status=chdir(wd);
- rtems_test_assert(status==0);
+ status = mkdir (wd, mode);
+ rtems_test_assert (status == 0);
+ status = chdir (wd);
+ rtems_test_assert (status == 0);
/*
* Create an empty file
*/
- fd=creat(name01,mode);
- status=close(fd);
- rtems_test_assert(status==0);
+ fd = creat (name01, mode);
+ status = close (fd);
+ rtems_test_assert (status == 0);
/*
* Truncate it to a valid size
*/
- status=truncate(name01,good_size);
- rtems_test_assert(status==0);
+ status = truncate (name01, good_size);
+ rtems_test_assert (status == 0);
/*
* Verify the size and the data
*/
- status=stat(name01,&statbuf);
- rtems_test_assert(status==0);
- rtems_test_assert(good_size==statbuf.st_size);
+ status = stat (name01, &statbuf);
+ rtems_test_assert (status == 0);
+ rtems_test_assert (good_size == statbuf.st_size);
- fd=open(name01,O_RDONLY);
- while ((n=read(fd,&data,1))>0) {
- rtems_test_assert(data==0);
+ fd = open (name01, O_RDONLY);
+ while ((n = read (fd, &data, 1)) > 0) {
+ rtems_test_assert (data == 0);
}
- status=close(fd);
- rtems_test_assert(status==0);
+ status = close (fd);
+ rtems_test_assert (status == 0);
/*
* Fill a file with data
*/
- fd=open(name01,O_WRONLY);
- rtems_test_assert(fd!=-1);
- n=write(fd,databuf,len);
- rtems_test_assert(n==len);
+ fd = open (name01, O_WRONLY);
+ rtems_test_assert (fd != -1);
+ n = write (fd, databuf, len);
+ rtems_test_assert (n == len);
/*
- * Truncate it to the half size
+ * Truncate it to the half size
*/
- status=truncate(name01,len/2);
- status=truncate(name01,len);
+ status = truncate (name01, len / 2);
+ status = truncate (name01, len);
/*
* verify the data
*/
- readbuf = (char *)malloc(len/2);
- rtems_test_assert( readbuf );
- fd=open(name01,O_RDONLY);
- rtems_test_assert(fd!=-1);
- n=read(fd,readbuf,len/2);
- rtems_test_assert(n==len/2);
- rtems_test_assert(!strncmp(databuf,readbuf,len/2));
- n=read(fd,readbuf,len/2);
- rtems_test_assert(n==len/2);
- for (i=0;i<len/2;i++){
- rtems_test_assert(readbuf[i]==0);
+ readbuf = (char *) malloc (len / 2);
+ rtems_test_assert (readbuf);
+ fd = open (name01, O_RDONLY);
+ rtems_test_assert (fd != -1);
+ n = read (fd, readbuf, len / 2);
+ rtems_test_assert (n == len / 2);
+ rtems_test_assert (!strncmp (databuf, readbuf, len / 2));
+ n = read (fd, readbuf, len / 2);
+ rtems_test_assert (n == len / 2);
+ for (i = 0; i < len / 2; i++) {
+ rtems_test_assert (readbuf[i] == 0);
}
- status=close(fd);
- rtems_test_assert( status==0 );
+ status = close (fd);
+ rtems_test_assert (status == 0);
/*
* Go back to parent directory
*/
- status=chdir("..");
- rtems_test_assert(status==0);
+ status = chdir ("..");
+ rtems_test_assert (status == 0);
}
-void lseek_test(void)
+void
+lseek_test (void)
{
- int fd;
- int status;
- char *name01="test_name01";
+ int fd;
+ int status;
+ char *name01 = "test_name01";
struct stat statbuf;
- int n;
- int i;
+ int n;
+ int i;
- size_t len = strlen(databuf);
+ size_t len = strlen (databuf);
off_t pos;
- int total_written=0;
+ int total_written = 0;
char *readbuf;
- mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO;
+ mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
- const char* wd=__func__;
+ const char *wd = __func__;
/*
* Create a new directory and change the current directory to this
*/
- status=mkdir(wd,mode);
- rtems_test_assert(status==0);
- status=chdir(wd);
- rtems_test_assert(status==0);
+ status = mkdir (wd, mode);
+ rtems_test_assert (status == 0);
+ status = chdir (wd);
+ rtems_test_assert (status == 0);
/*
* Create a file and fill with the data.
*/
- puts("Create a new file");
- fd=creat(name01,mode);
- rtems_test_assert(fd!=-1);
+ puts ("Create a new file");
+ fd = creat (name01, mode);
+ rtems_test_assert (fd != -1);
+
+ pos = lseek (fd, 0, SEEK_CUR);
+ rtems_test_assert (pos == 0);
- pos=lseek(fd,0,SEEK_CUR);
- rtems_test_assert(pos==0);
+ pos = lseek (fd, 0, SEEK_END);
+ rtems_test_assert (pos == 0);
- pos=lseek(fd,0,SEEK_END);
- rtems_test_assert(pos==0);
-
- pos=lseek(fd,0,SEEK_SET);
- rtems_test_assert(pos==0);
-
+ pos = lseek (fd, 0, SEEK_SET);
+ rtems_test_assert (pos == 0);
- printf( "Writing %d bytes to file\n", len * 10 );
- for (i=0; i<10; i++) {
- n = write(fd, databuf, len);
- rtems_test_assert( n != -1 );
+
+ printf ("Writing %d bytes to file\n", len * 10);
+ for (i = 0; i < 10; i++) {
+ n = write (fd, databuf, len);
+ rtems_test_assert (n != -1);
total_written += n;
}
- printf("Successfully wrote %d\n", total_written);
+ printf ("Successfully wrote %d\n", total_written);
/*
* Check the current position
*/
- puts("Check the current position");
- pos=lseek(fd,0,SEEK_CUR);
- rtems_test_assert(pos==total_written);
+ puts ("Check the current position");
+ pos = lseek (fd, 0, SEEK_CUR);
+ rtems_test_assert (pos == total_written);
- pos=lseek(fd,0,SEEK_END);
- rtems_test_assert(pos==total_written);
+ pos = lseek (fd, 0, SEEK_END);
+ rtems_test_assert (pos == total_written);
/*
* ftruncate shall not change the posistion
*/
- status=ftruncate(fd,total_written+1);
- rtems_test_assert(status==0);
+ status = ftruncate (fd, total_written + 1);
+ rtems_test_assert (status == 0);
- pos=lseek(fd,0,SEEK_CUR);
- rtems_test_assert(pos==total_written);
+ pos = lseek (fd, 0, SEEK_CUR);
+ rtems_test_assert (pos == total_written);
- pos=lseek(fd,0,SEEK_END);
- printf("%jd\n",(intmax_t)pos);
- rtems_test_assert(pos==total_written+1);
+ pos = lseek (fd, 0, SEEK_END);
+ printf ("%jd\n", (intmax_t) pos);
+ rtems_test_assert (pos == total_written + 1);
- status=ftruncate(fd,total_written);
- rtems_test_assert(status==0);
-
- pos=lseek(fd,0,SEEK_CUR);
- rtems_test_assert(pos==total_written+1);
+ status = ftruncate (fd, total_written);
+ rtems_test_assert (status == 0);
+ pos = lseek (fd, 0, SEEK_CUR);
+ rtems_test_assert (pos == total_written + 1);
- status=close(fd);
- rtems_test_assert(status==0);
+
+ status = close (fd);
+ rtems_test_assert (status == 0);
/*
* Check the file size
*/
- status=stat(name01,&statbuf);
- rtems_test_assert(statbuf.st_size==total_written);
+ status = stat (name01, &statbuf);
+ rtems_test_assert (statbuf.st_size == total_written);
/*
* Open the file with O_RDONLY and check the lseek
*/
- readbuf=(char*)malloc(len);
- fd=open(name01,O_RDONLY);
- pos=lseek(fd,len,SEEK_CUR);
- rtems_test_assert(pos==len);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(!strncmp(databuf,readbuf,len));
-
- pos=lseek(fd,len,SEEK_CUR);
- rtems_test_assert(pos==3*len);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(!strncmp(databuf,readbuf,len));
-
- pos=lseek(fd,-len,SEEK_CUR);
- rtems_test_assert(pos==3*len);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(!strncmp(databuf,readbuf,len));
-
- pos=lseek(fd,4*len,SEEK_SET);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(!strncmp(databuf,readbuf,len));
-
-
- pos=lseek(fd,10,SEEK_SET);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(strncmp(databuf,readbuf,len)!=0);
-
- pos=lseek(fd,-len,SEEK_END);
- n=read(fd,readbuf,2*len);
- rtems_test_assert(n==len);
- rtems_test_assert(!strncmp(databuf,readbuf,len));
-
- status=close(fd);
- rtems_test_assert(status==0);
+ readbuf = (char *) malloc (len);
+ fd = open (name01, O_RDONLY);
+ pos = lseek (fd, len, SEEK_CUR);
+ rtems_test_assert (pos == len);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (!strncmp (databuf, readbuf, len));
+
+ pos = lseek (fd, len, SEEK_CUR);
+ rtems_test_assert (pos == 3 * len);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (!strncmp (databuf, readbuf, len));
+
+ pos = lseek (fd, -len, SEEK_CUR);
+ rtems_test_assert (pos == 3 * len);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (!strncmp (databuf, readbuf, len));
+
+ pos = lseek (fd, 4 * len, SEEK_SET);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (!strncmp (databuf, readbuf, len));
+
+
+ pos = lseek (fd, 10, SEEK_SET);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (strncmp (databuf, readbuf, len) != 0);
+
+ pos = lseek (fd, -len, SEEK_END);
+ n = read (fd, readbuf, 2 * len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (!strncmp (databuf, readbuf, len));
+
+ status = close (fd);
+ rtems_test_assert (status == 0);
/*
* Open the file withe O_RDWR and check the lseek
*/
- fd=open(name01,O_RDWR);
+ fd = open (name01, O_RDWR);
- pos=lseek(fd,len,SEEK_CUR);
- rtems_test_assert(pos==len);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(!strncmp(databuf,readbuf,len));
+ pos = lseek (fd, len, SEEK_CUR);
+ rtems_test_assert (pos == len);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (!strncmp (databuf, readbuf, len));
- pos=lseek(fd,len,SEEK_CUR);
- rtems_test_assert(pos==3*len);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(!strncmp(databuf,readbuf,len));
+ pos = lseek (fd, len, SEEK_CUR);
+ rtems_test_assert (pos == 3 * len);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (!strncmp (databuf, readbuf, len));
- pos=lseek(fd,-len,SEEK_CUR);
- rtems_test_assert(pos==3*len);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(!strncmp(databuf,readbuf,len));
+ pos = lseek (fd, -len, SEEK_CUR);
+ rtems_test_assert (pos == 3 * len);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (!strncmp (databuf, readbuf, len));
- pos=lseek(fd,4*len,SEEK_SET);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(!strncmp(databuf,readbuf,len));
+ pos = lseek (fd, 4 * len, SEEK_SET);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (!strncmp (databuf, readbuf, len));
/*
- * Go to the wrong position, so the data is not the same
+ * Go to the wrong position, so the data is not the same
*/
- pos=lseek(fd,10,SEEK_SET);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(strncmp(databuf,readbuf,len)!=0);
+ pos = lseek (fd, 10, SEEK_SET);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (strncmp (databuf, readbuf, len) != 0);
/*
- * Use SEEK_END
+ * Use SEEK_END
*/
- pos=lseek(fd,-len,SEEK_END);
- n=read(fd,readbuf,2*len);
- rtems_test_assert(n==len);
- rtems_test_assert(!strncmp(databuf,readbuf,len));
+ pos = lseek (fd, -len, SEEK_END);
+ n = read (fd, readbuf, 2 * len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (!strncmp (databuf, readbuf, len));
- memset(readbuf,0,len);
+ memset (readbuf, 0, len);
/*
* Write the zero to the end of file.
*/
- pos=lseek(fd,-len,SEEK_END);
- rtems_test_assert(pos==total_written-len);
- n=write(fd,readbuf,len);
- rtems_test_assert(n==len);
+ pos = lseek (fd, -len, SEEK_END);
+ rtems_test_assert (pos == total_written - len);
+ n = write (fd, readbuf, len);
+ rtems_test_assert (n == len);
/*
- * Verify it
+ * Verify it
*/
- pos=lseek(fd,total_written-len,SEEK_SET);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- for (i=0;i<n;i++){
- rtems_test_assert(readbuf[i]==0);
+ pos = lseek (fd, total_written - len, SEEK_SET);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ for (i = 0; i < n; i++) {
+ rtems_test_assert (readbuf[i] == 0);
}
/*
* Write the zero to the beginning of file.
*/
- pos=lseek(fd,-total_written,SEEK_END);
- rtems_test_assert(pos==0);
- n=write(fd,readbuf,len);
- rtems_test_assert(n==len);
+ pos = lseek (fd, -total_written, SEEK_END);
+ rtems_test_assert (pos == 0);
+ n = write (fd, readbuf, len);
+ rtems_test_assert (n == len);
/*
* Verify it
*/
- pos=lseek(fd,0,SEEK_SET);
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- for (i=0;i<n;i++){
- rtems_test_assert(readbuf[i]==0);
+ pos = lseek (fd, 0, SEEK_SET);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ for (i = 0; i < n; i++) {
+ rtems_test_assert (readbuf[i] == 0);
}
- n=read(fd,readbuf,len);
- rtems_test_assert(n==len);
- rtems_test_assert(strncmp(databuf,readbuf,len)==0);
+ n = read (fd, readbuf, len);
+ rtems_test_assert (n == len);
+ rtems_test_assert (strncmp (databuf, readbuf, len) == 0);
/*
* Call ftruncate to decrease the file and the position not change
*/
- status=ftruncate(fd,len);
- rtems_test_assert(status==0);
- pos=lseek(fd,0,SEEK_CUR);
- rtems_test_assert(pos==len*2);
+ status = ftruncate (fd, len);
+ rtems_test_assert (status == 0);
+ pos = lseek (fd, 0, SEEK_CUR);
+ rtems_test_assert (pos == len * 2);
- status=close(fd);
- rtems_test_assert(status==0);
+ status = close (fd);
+ rtems_test_assert (status == 0);
/*
* Go back to parent directory
*/
- status=chdir("..");
- rtems_test_assert(status==0);
+ status = chdir ("..");
+ rtems_test_assert (status == 0);
}
-void test(void )
+
+void
+test (void)
{
- read_write_test();
- lseek_test();
+ read_write_test ();
+ lseek_test ();
}
diff --git a/testsuites/fstests/fssymlink/test.c b/testsuites/fstests/fssymlink/test.c
index 387a210844..15c878797d 100644
--- a/testsuites/fstests/fssymlink/test.c
+++ b/testsuites/fstests/fssymlink/test.c
@@ -24,7 +24,7 @@
#include "fstest.h"
/*
- * Test the function of symlink
+ * Test the function of symlink
*/
void symlink_test01(void )
@@ -37,7 +37,7 @@ void symlink_test01(void )
struct stat statbuf;
size_t len=strlen(file01);
size_t name_len;
-
+
printf("Create a file named %s\n",file01);
fd=creat(file01,0777);
@@ -58,7 +58,7 @@ void symlink_test01(void )
rtems_test_assert(S_ISLNK(statbuf.st_mode));
rtems_test_assert(len==statbuf.st_size);
-
+
puts("call readlink ");
name_len=readlink(symlink_file01,name,sizeof(name)-1);
rtems_test_assert(name_len!=-1);
@@ -67,7 +67,7 @@ void symlink_test01(void )
puts(name);
puts("Unlink the file");
-
+
status=unlink(file01);
rtems_test_assert(status==0);
@@ -75,7 +75,7 @@ void symlink_test01(void )
rtems_test_assert(status==0);
rtems_test_assert(S_ISLNK(statbuf.st_mode));
rtems_test_assert(len==statbuf.st_size);
-
+
puts("call readlink ");
name_len=readlink(symlink_file01,name,sizeof(name)-1);
rtems_test_assert(name_len!=-1);
@@ -86,7 +86,7 @@ void symlink_test01(void )
printf("Create a dir named %s\n",file01);
status=mkdir (file01,0777);
-
+
printf("Create a symlink named %s to %s\n",symlink_file01,file01);
status=symlink(file01,symlink_file01);
rtems_test_assert(status==0);
@@ -96,7 +96,7 @@ void symlink_test01(void )
rtems_test_assert(S_ISLNK(statbuf.st_mode));
rtems_test_assert(len==statbuf.st_size);
-
+
puts("call readlink ");
name_len=readlink(symlink_file01,name,sizeof(name)-1);
rtems_test_assert(name_len!=-1);
@@ -141,7 +141,7 @@ void symlink_loop_error_test(void )
rtems_test_assert(status==0);
status=symlink(file02,file01);
rtems_test_assert(status==0);
-
+
EXPECT_ERROR(ELOOP,creat,path,mode);
EXPECT_ERROR(ELOOP,open,path,O_CREAT|O_WRONLY,mode);
diff --git a/testsuites/fstests/fstime/test.c b/testsuites/fstests/fstime/test.c
index a0e30d94a7..bf2c215223 100644
--- a/testsuites/fstests/fstime/test.c
+++ b/testsuites/fstests/fstime/test.c
@@ -80,7 +80,7 @@ void time_test01 (void)
mtime2 = statbuf.st_mtime;
/*
- * Make sure they are the same
+ * Make sure they are the same
*/
rtems_test_assert (TIME_EQUAL (ctime1, mtime1));
@@ -98,7 +98,7 @@ void time_test01 (void)
mtime2 = statbuf.st_mtime;
/*
- * Make sure they are the same
+ * Make sure they are the same
*/
rtems_test_assert (TIME_EQUAL (ctime1, mtime1));
rtems_test_assert (TIME_EQUAL (ctime1, mtime2));
@@ -112,7 +112,7 @@ void time_test01 (void)
sleep (TIME_PRECISION);
/*
- * Create an empty directory
+ * Create an empty directory
*/
status = mkdir (dir01, mode);
rtems_test_assert (status == 0);
@@ -133,11 +133,11 @@ void time_test01 (void)
* truncate shall not modify the file offset for any open file
* descriptions associated with the file. Upon successful completion,
* if the file size is changed, this function shall mark for update
- * the st_ctime and st_mtime fields of the file
+ * the st_ctime and st_mtime fields of the file
*/
/*
- * file01 shall not update
+ * file01 shall not update
*/
status = stat (file01, &statbuf);
rtems_test_assert (status == 0);
@@ -160,7 +160,7 @@ void time_test01 (void)
rtems_test_assert (!TIME_EQUAL (ctime1, ctime2));
/*
- * Upon successful completion, mkdir() shall mark for update the
+ * Upon successful completion, mkdir() shall mark for update the
* 5st_atime, st_ctime, and st_mtime fields of the directory.
* Also, the st_ctime and st_mtime fields of the directory that
* contains the new entry shall be marked for update.
@@ -252,7 +252,7 @@ void time_test01 (void)
}
/*
- * These tests only get time_t value, and test
+ * These tests only get time_t value, and test
* if they are changed. Thest tests don't check atime
*/
void test (void)
diff --git a/testsuites/fstests/mdosfs_support/fs_config.h b/testsuites/fstests/mdosfs_support/fs_config.h
index f48522dd70..247562eba2 100644
--- a/testsuites/fstests/mdosfs_support/fs_config.h
+++ b/testsuites/fstests/mdosfs_support/fs_config.h
@@ -15,6 +15,5 @@
#define MDOSFS_TEST
#define FILESYSTEM "MOUNTED DOSFS"
-#define BASE_FOR_TEST "/mnt/"
#endif
diff --git a/testsuites/fstests/mdosfs_support/fs_support.c b/testsuites/fstests/mdosfs_support/fs_support.c
index d5a2c736ed..8866c81297 100644
--- a/testsuites/fstests/mdosfs_support/fs_support.c
+++ b/testsuites/fstests/mdosfs_support/fs_support.c
@@ -20,7 +20,9 @@
#include <rtems/libio.h>
#include <rtems/dosfs.h>
+
#include "ramdisk_support.h"
+#include "fstest.h"
#define BLOCK_SIZE 512
diff --git a/testsuites/fstests/mimfs_support/fs_support.c b/testsuites/fstests/mimfs_support/fs_support.c
index da59d5e92f..34d410a8cb 100644
--- a/testsuites/fstests/mimfs_support/fs_support.c
+++ b/testsuites/fstests/mimfs_support/fs_support.c
@@ -53,7 +53,7 @@ test_shutdown_filesystem (void)
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_MAXIMUM_TASKS 10
+#define CONFIGURE_MAXIMUM_TASKS 10
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40
diff --git a/testsuites/fstests/mrfs_support/fs_config.h b/testsuites/fstests/mrfs_support/fs_config.h
index ba8bbdaa85..dd8221d855 100644
--- a/testsuites/fstests/mrfs_support/fs_config.h
+++ b/testsuites/fstests/mrfs_support/fs_config.h
@@ -1,5 +1,12 @@
/*
- * $Id$
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * 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.
+ *
+ * $Id Exp $
*/
#ifndef __MIMFS_SUPPORT_h
diff --git a/testsuites/fstests/support/fstest.h b/testsuites/fstests/support/fstest.h
index 94bf87b45c..b23a9d0a6b 100644
--- a/testsuites/fstests/support/fstest.h
+++ b/testsuites/fstests/support/fstest.h
@@ -22,7 +22,9 @@
#define FS_PASS() do {puts("PASS");} while (0)
-#define FS_FAIL() do {printf( "FAIL %s: %d \n", __FILE__, __LINE__ ); } while (0)
+#define FS_FAIL() do {\
+ printf( "FAIL %s: %d \n", __FILE__, __LINE__ );\
+ } while (0)
#define SHOW_MESSAGE(e, func, ...) printf(\
@@ -55,6 +57,6 @@
#define BASE_FOR_TEST "/mnt"
-#endif
+#endif
diff --git a/testsuites/fstests/support/fstest_support.c b/testsuites/fstests/support/fstest_support.c
index 4202a1040f..6c678891f7 100644
--- a/testsuites/fstests/support/fstest_support.c
+++ b/testsuites/fstests/support/fstest_support.c
@@ -8,14 +8,13 @@
*
* $Id Exp $
*/
-
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include "rtems.h"
@@ -24,57 +23,57 @@
#include "fstest.h"
-#define TEMP_DIR "waterbuffalo"
+#define TEMP_DIR "waterbuffalo"
-/* Break out of a chroot() environment in C */
+/* Break out of a chroot() environment in C */
void break_out_of_chroot(void)
{
- int dir_fd; /* File descriptor to directory */
- struct stat sbuf; /* The stat() buffer */
+ int dir_fd; /* File descriptor to directory */
+ struct stat sbuf; /* The stat() buffer */
chdir("/");
- if (stat(TEMP_DIR,&sbuf)<0) {
- if (errno==ENOENT) {
- if (mkdir(TEMP_DIR,0755)<0) {
- fprintf(stderr,"Failed to create %s - %s\n", TEMP_DIR,
- strerror(errno));
- exit(1);
- }
- } else {
- fprintf(stderr,"Failed to stat %s - %s\n", TEMP_DIR,
- strerror(errno));
- exit(1);
- }
- } else if (!S_ISDIR(sbuf.st_mode)) {
- fprintf(stderr,"Error - %s is not a directory!\n",TEMP_DIR);
- exit(1);
- }
-
- if ((dir_fd=open(".",O_RDONLY))<0) {
- fprintf(stderr,"Failed to open \".\" for reading - %s\n", strerror(errno));
- exit(1);
- }
-
- if (chroot(TEMP_DIR)<0) {
- fprintf(stderr,"Failed to chroot to %s - %s\n",TEMP_DIR,
- strerror(errno));
- exit(1);
- }
-
- if (fchdir(dir_fd)<0) {
- fprintf(stderr,"Failed to fchdir - %s\n",
- strerror(errno));
- exit(1);
- }
- close(dir_fd);
- chdir("..");
- chroot(".");
+ if (stat(TEMP_DIR,&sbuf)<0) {
+ if (errno==ENOENT) {
+ if (mkdir(TEMP_DIR,0755)<0) {
+ fprintf(stderr,"Failed to create %s - %s\n", TEMP_DIR,
+ strerror(errno));
+ exit(1);
+ }
+ } else {
+ fprintf(stderr,"Failed to stat %s - %s\n", TEMP_DIR,
+ strerror(errno));
+ exit(1);
+ }
+ } else if (!S_ISDIR(sbuf.st_mode)) {
+ fprintf(stderr,"Error - %s is not a directory!\n",TEMP_DIR);
+ exit(1);
+ }
+
+ if ((dir_fd=open(".",O_RDONLY))<0) {
+ fprintf(stderr,"Failed to open ""."
+ " for reading - %s\n", strerror(errno));
+ exit(1);
+ }
+
+ if (chroot(TEMP_DIR)<0) {
+ fprintf(stderr,"Failed to chroot to %s - %s\n",TEMP_DIR,
+ strerror(errno));
+ exit(1);
+ }
+
+ if (fchdir(dir_fd)<0) {
+ fprintf(stderr,"Failed to fchdir - %s\n",
+ strerror(errno));
+ exit(1);
+ }
+ close(dir_fd);
+ chdir("..");
+ chroot(".");
}
-
/*
* Main entry point of every filesystem test
*/
@@ -103,5 +102,4 @@ rtems_task Init(
puts( "*** END OF FILE SYSTEM TEST ( " FILESYSTEM " ) ***" );
rtems_test_exit(0);
-
}
diff --git a/testsuites/fstests/support/ramdisk_support.c b/testsuites/fstests/support/ramdisk_support.c
index dba0b32a4c..79389bb80f 100644
--- a/testsuites/fstests/support/ramdisk_support.c
+++ b/testsuites/fstests/support/ramdisk_support.c
@@ -15,42 +15,43 @@
#include "ramdisk_support.h"
#include "fstest.h"
/*
- * Ramdisk information
+ * Ramdisk information
*/
dev_t dev = 0;
-void init_ramdisk(void)
+void
+init_ramdisk (void)
{
- int rc=0;
- rc =rtems_disk_io_initialize();
- rtems_test_assert( rc == 0 );
- rc =ramdisk_register(RAMDISK_BLOCK_SIZE,RAMDISK_BLOCK_COUNT,\
- false,RAMDISK_PATH,&dev);
- rtems_test_assert( rc == 0 );
+ int rc = 0;
+ rc = rtems_disk_io_initialize ();
+ rtems_test_assert (rc == 0);
+ rc = ramdisk_register (RAMDISK_BLOCK_SIZE, RAMDISK_BLOCK_COUNT,
+ false, RAMDISK_PATH, &dev);
+ rtems_test_assert (rc == 0);
}
-void del_ramdisk(void )
+void
+del_ramdisk (void)
{
- int rc=0;
- rtems_device_major_number major=0;
- rtems_device_minor_number minor=0;
- rc=rtems_disk_delete (dev);
- rtems_test_assert( rc == 0 );
+ int rc = 0;
+ rtems_device_major_number major = 0;
+ rtems_device_minor_number minor = 0;
- rtems_filesystem_split_dev_t(dev,major,minor);
-
- rtems_test_assert(major>=0);
- rtems_test_assert(minor>=0);
-
- rc=rtems_io_unregister_driver(major);
- rtems_test_assert( rc == 0 );
+ rc = rtems_disk_delete (dev);
+ rtems_test_assert (rc == 0);
- rc=rtems_disk_io_done();
- rtems_test_assert( rc == 0 );
+ rtems_filesystem_split_dev_t (dev, major, minor);
-}
+ rtems_test_assert (major >= 0);
+ rtems_test_assert (minor >= 0);
+
+ rc = rtems_io_unregister_driver (major);
+ rtems_test_assert (rc == 0);
+ rc = rtems_disk_io_done ();
+ rtems_test_assert (rc == 0);
+}
diff --git a/testsuites/fstests/support/ramdisk_support.h b/testsuites/fstests/support/ramdisk_support.h
index 82f732f539..7c06c1e896 100644
--- a/testsuites/fstests/support/ramdisk_support.h
+++ b/testsuites/fstests/support/ramdisk_support.h
@@ -13,7 +13,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
+#endif
#define RAMDISK_BLOCK_SIZE (512)
#define RAMDISK_BLOCK_COUNT (1024)