summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxfile01
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-12-08 17:52:53 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-12-08 17:52:53 +0000
commit2317457e101509ca16a669d99719ae44b0c60599 (patch)
tree76c26f4c12c18c55f067f00e644a28dded70c79b /testsuites/psxtests/psxfile01
parent2009-12-08 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-2317457e101509ca16a669d99719ae44b0c60599.tar.bz2
2009-12-08 Joel Sherrill <joel.sherrill@oarcorp.com>
* include/pmacros.h, psx01/task.c, psx02/init.c, psx02/task.c, psx03/init.c, psx03/task.c, psx04/init.c, psx04/task1.c, psx04/task2.c, psx04/task3.c, psx05/init.c, psx05/task.c, psx05/task2.c, psx05/task3.c, psx06/init.c, psx06/task.c, psx06/task2.c, psx07/init.c, psx08/init.c, psx08/task2.c, psx08/task3.c, psx09/init.c, psx10/init.c, psx10/task.c, psx10/task2.c, psx10/task3.c, psx11/init.c, psx11/task.c, psx12/init.c, psxalarm01/init.c, psxbarrier01/test.c, psxcancel01/init.c, psxchroot01/test.c, psxclock/init.c, psxfile01/test.c, psxfile01/test_cat.c, psxfile01/test_extend.c, psxfile01/test_write.c, psxitimer/init.c, psxkey01/task.c, psxkey02/init.c, psxkey03/init.c, psxmount/test.c, psxmsgq01/init.c, psxmsgq03/init.c, psxmsgq04/init.c, psxreaddir/test.c, psxrwlock01/test.c, psxsem01/init.c, psxsignal01/init.c, psxsignal01/task1.c, psxsignal02/init.c, psxsignal03/init.c, psxsignal05/init.c, psxspin01/test.c, psxspin02/test.c, psxstack01/init.c, psxstat/test.c, psxtime/test.c, psxualarm/init.c: Use rtems_test_assert() consistently instead of system assert(). rtems_test_assert() is designed to integrate into the RTEMS test suite infrastructure.
Diffstat (limited to 'testsuites/psxtests/psxfile01')
-rw-r--r--testsuites/psxtests/psxfile01/test.c125
-rw-r--r--testsuites/psxtests/psxfile01/test_cat.c16
-rw-r--r--testsuites/psxtests/psxfile01/test_extend.c13
-rw-r--r--testsuites/psxtests/psxfile01/test_write.c13
4 files changed, 91 insertions, 76 deletions
diff --git a/testsuites/psxtests/psxfile01/test.c b/testsuites/psxtests/psxfile01/test.c
index 45e1967f33..a9efab4c76 100644
--- a/testsuites/psxtests/psxfile01/test.c
+++ b/testsuites/psxtests/psxfile01/test.c
@@ -31,7 +31,6 @@
#include <string.h>
#include <ctype.h>
-#include <assert.h>
#include <rtems.h>
#include <rtems/libio.h>
@@ -100,7 +99,7 @@ void stat_a_file(
int status;
struct stat statbuf;
- assert( file );
+ rtems_test_assert( file );
printf( "stat( %s ) returned ", file );
fflush( stdout );
@@ -169,7 +168,7 @@ int main(
puts( "stat of /dev/console" );
status = stat( "/dev/console", &buf );
- assert( !status );
+ rtems_test_assert( !status );
dump_statbuf( &buf );
@@ -180,47 +179,47 @@ int main(
puts( "" );
puts( "mkdir /dev/tty" );
status = mkdir( "/dev/tty", S_IRWXU );
- assert( !status );
+ rtems_test_assert( !status );
puts( "" );
puts( "mkdir /usr" );
status = mkdir( "/usr", S_IRWXU );
- assert( !status );
+ rtems_test_assert( !status );
puts( "mkdir /etc" );
status = mkdir( "/etc", S_IRWXU );
- assert( !status );
+ rtems_test_assert( !status );
puts( "mkdir /tmp" );
status = mkdir( "/tmp", S_IRWXU );
- assert( !status );
+ rtems_test_assert( !status );
/* this tests the ".." path in path name evaluation */
puts( "mkdir /tmp/.." );
status = mkdir( "/tmp/..", S_IRWXU );
- assert( status == -1 );
- assert( errno == EEXIST );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == EEXIST );
/* now check out trailing separators */
puts( "mkdir /tmp/" );
status = mkdir( "/tmp/", S_IRWXU );
- assert( status == -1 );
- assert( errno == EEXIST );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == EEXIST );
/* try to make a directory under a non-existent subdirectory */
puts( "mkdir /j/j1" );
status = mkdir( "/j/j1", S_IRWXU );
- assert( status == -1 );
- assert( errno == ENOENT );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENOENT );
/* this tests the ability to make a directory in the current one */
puts( "mkdir tmp" );
status = mkdir( "tmp", S_IRWXU );
- assert( status == -1 );
- assert( errno == EEXIST );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == EEXIST );
/* test rtems_filesystem_evaluate_path by sending NULL path */
status = chdir( NULL );
- assert( status == -1 );
+ rtems_test_assert( status == -1 );
/*
* Now switch gears and exercise rmdir().
@@ -229,37 +228,37 @@ int main(
puts( "" );
puts( "rmdir /usr" );
status = rmdir( "/usr" );
- assert( !status );
+ rtems_test_assert( !status );
puts( "rmdir /dev" );
status = rmdir( "/dev" );
- assert( status == -1 );
- assert( errno == ENOTEMPTY);
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENOTEMPTY);
puts( "rmdir /fred" );
status = rmdir ("/fred");
- assert (status == -1);
- assert( errno == ENOENT );
+ rtems_test_assert (status == -1);
+ rtems_test_assert( errno == ENOENT );
puts( "mknod /dev/test_console" );
status = mknod( "/dev/test_console", S_IFCHR, 0LL );
- assert( !status );
+ rtems_test_assert( !status );
puts( "mknod /dev/tty/S3" );
status = mknod( "/dev/tty/S3", S_IFCHR, 0xFF00000080LL );
- assert( !status );
+ rtems_test_assert( !status );
puts ("mknod /etc/passwd");
status = mknod( "/etc/passwd", (S_IFREG | S_IRWXU), 0LL );
- assert( !status );
+ rtems_test_assert( !status );
puts( "mkdir /tmp/my_dir");
status = mkdir( "/tmp/my_dir", S_IRWXU );
- assert( status == 0 );
+ rtems_test_assert( status == 0 );
puts("mkfifo /c/my_dir" );
status = mkfifo( "/c/my_dir", S_IRWXU );
- assert( status == -1 );
+ rtems_test_assert( status == -1 );
/*
* Try to make a directory under a file -- ERROR
@@ -267,8 +266,8 @@ int main(
puts( "mkdir /etc/passwd/j" );
status = mkdir( "/etc/passwd/j", S_IRWXU );
- assert( status == -1 );
- assert( errno == ENOTDIR );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENOTDIR );
/*
* Simple open failure case on non-existent file
@@ -276,8 +275,8 @@ int main(
puts( "open /tmp/joel - should fail with ENOENT" );
fd = open( "/tmp/joel", O_RDONLY );
- assert( fd == -1 );
- assert( errno == ENOENT );
+ rtems_test_assert( fd == -1 );
+ rtems_test_assert( errno == ENOENT );
/*
* Simple open case where the file is created.
@@ -285,24 +284,24 @@ int main(
puts( "open /tmp/j" );
fd = open( "/tmp/j", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
- assert( fd != -1 );
+ rtems_test_assert( fd != -1 );
printf( "open returned file descriptor %d\n", fd );
puts( "close /tmp/j" );
status = close( fd );
- assert( !status );
+ rtems_test_assert( !status );
puts( "close /tmp/j again" );
status = close( fd );
- assert( status == -1 );
+ rtems_test_assert( status == -1 );
puts( "unlink /tmp/j" );
status = unlink( "/tmp/j" );
- assert( !status );
+ rtems_test_assert( !status );
puts( "unlink /tmp" );
status = unlink( "/tmp" );
- assert( status );
+ rtems_test_assert( status );
/*
* Simple open failure. Trying to create an existing file.
@@ -310,22 +309,22 @@ int main(
puts("create and close /tmp/tom");
fd = open( "/tmp/tom", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
- assert( fd != -1 );
+ rtems_test_assert( fd != -1 );
status = close( fd );
- assert( status == 0 );
+ rtems_test_assert( status == 0 );
puts("Attempt to recreate /tmp/tom");
fd = open( "/tmp/tom", O_CREAT | O_EXCL, S_IRWXU|S_IRWXG|S_IRWXO );
- assert( fd == -1 );
- assert( errno == EEXIST );
+ rtems_test_assert( fd == -1 );
+ rtems_test_assert( errno == EEXIST );
puts("create /tmp/john");
fd = open( "/tmp/john", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
- assert( fd != -1 );
+ rtems_test_assert( fd != -1 );
puts("tcdrain /tmp/john" );
status = tcdrain( fd );
- assert( status == 0 );
+ rtems_test_assert( status == 0 );
/*
* Test simple write to a file at offset 0
@@ -341,10 +340,10 @@ int main(
*/
status = unlink( "/tmp/joel" );
- assert( !status );
+ rtems_test_assert( !status );
status = mknod( "/tmp/joel", (S_IFREG | S_IRWXU), 0LL );
- assert( !status );
+ rtems_test_assert( !status );
test_write( "/tmp/joel", 10, "the first write!!!\n" );
test_cat( "/tmp/joel", 0, 0 );
@@ -357,17 +356,17 @@ int main(
puts("unlink /tmp/joel");
status = unlink( "/tmp/joel" );
- assert( !status );
+ rtems_test_assert( !status );
/* Test a failure path */
puts( "unlink /tmp/joel" );
status = unlink( "/tmp/joel" );
- assert( status == -1 );
+ rtems_test_assert( status == -1 );
puts( "mknod /tmp/joel");
status = mknod( "/tmp/joel", (S_IFREG | S_IRWXU), 0LL );
- assert( !status );
+ rtems_test_assert( !status );
test_write( "/tmp/joel", 514, "the first write!!!\n" );
test_write( "/tmp/joel", 1, test_write_buffer );
@@ -410,19 +409,19 @@ int main(
puts( "fopen of /tmp/j" );
file = fopen( "/tmp/j", "w+" );
- assert( file );
+ rtems_test_assert( file );
puts( "fprintf to /tmp/j" );
for (i=1 ; i<=5 ; i++) {
status = fprintf( file, "This is call %d to fprintf\n", i );
- assert( status );
+ rtems_test_assert( status );
printf( "(%d) %d characters written to the file\n", i, status );
}
fflush( file );
status = stat( "/tmp/j", &buf );
- assert( !status );
+ rtems_test_assert( !status );
dump_statbuf( &buf );
atime2 = buf.st_atime;
mtime2 = buf.st_mtime;
@@ -438,14 +437,14 @@ int main(
* Verify only atime changed for a read.
*/
status = stat( "/tmp/j", &buf );
- assert( !status );
+ rtems_test_assert( !status );
dump_statbuf( &buf );
atime1 = buf.st_atime;
mtime1 = buf.st_mtime;
ctime1 = buf.st_ctime;
- assert( atime1 != atime2);
- assert( mtime1 == mtime2);
- assert( ctime1 == ctime2);
+ rtems_test_assert( atime1 != atime2);
+ rtems_test_assert( mtime1 == mtime2);
+ rtems_test_assert( ctime1 == ctime2);
IMFS_dump();
@@ -458,41 +457,41 @@ int main(
status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
puts( "truncate /tmp/j to length of 40" );
status = truncate( "/tmp/j", 40 );
- assert( !status );
+ rtems_test_assert( !status );
/*
* Verify truncate changed only atime.
*/
status = stat( "/tmp/j", &buf );
- assert( !status );
+ rtems_test_assert( !status );
dump_statbuf( &buf );
atime2 = buf.st_atime;
mtime2 = buf.st_mtime;
ctime2 = buf.st_ctime;
- assert( atime1 != atime2);
- assert( mtime1 == mtime2);
- assert( ctime1 == ctime2);
+ rtems_test_assert( atime1 != atime2);
+ rtems_test_assert( mtime1 == mtime2);
+ rtems_test_assert( ctime1 == ctime2);
IMFS_dump();
/* try to truncate the console and see what happens */
status = truncate( "/dev/console", 40 );
- assert( status == 0 );
+ rtems_test_assert( status == 0 );
puts( "truncate /tmp/j to length of 0" );
status = truncate( "/tmp/j", 0 );
- assert( !status );
+ rtems_test_assert( !status );
puts( "truncate /tmp to length of 0 should fail with EISDIR\n");
status = truncate( "/tmp", 0 );
- assert( status == -1 );
+ rtems_test_assert( status == -1 );
printf( "%d: %s\n", errno, strerror( errno ) );
- assert( errno == EISDIR );
+ rtems_test_assert( errno == EISDIR );
IMFS_dump();
status = truncate( "/tmp/fred", 10 );
- assert( status == -1);
+ rtems_test_assert( status == -1);
rtems_status = rtems_io_register_name( "/dev/console", 0, 0 );
diff --git a/testsuites/psxtests/psxfile01/test_cat.c b/testsuites/psxtests/psxfile01/test_cat.c
index 0dfcd3975b..38eaf3ac88 100644
--- a/testsuites/psxtests/psxfile01/test_cat.c
+++ b/testsuites/psxtests/psxfile01/test_cat.c
@@ -2,6 +2,14 @@
* A test support function which performs a crude version of
* "cat" so you can look at specific parts of a file.
*
+ * COPYRIGHT (c) 1989-2009.
+ * 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$
*/
@@ -15,8 +23,6 @@
#include <string.h>
#include <ctype.h>
-#include <assert.h>
-
#include <pmacros.h>
/*
@@ -41,7 +47,7 @@ void test_cat(
off_t offset = (off_t)offset_arg;
my_length = (length) ? length : sizeof( test_cat_buffer );
- assert( my_length <= sizeof( test_cat_buffer ) );
+ rtems_test_assert( my_length <= sizeof( test_cat_buffer ) );
fd = open( file, O_RDONLY );
if ( fd == -1 ) {
@@ -51,7 +57,7 @@ void test_cat(
for ( ;; ) {
status = lseek( fd, offset, SEEK_SET );
- assert( status != -1 );
+ rtems_test_assert( status != -1 );
status = read( fd, test_cat_buffer, sizeof(test_cat_buffer) );
if ( status <= 0 ) {
@@ -79,5 +85,5 @@ void test_cat(
}
status = close( fd );
- assert( !status );
+ rtems_test_assert( !status );
}
diff --git a/testsuites/psxtests/psxfile01/test_extend.c b/testsuites/psxtests/psxfile01/test_extend.c
index bbc5b7b5d7..2de748d238 100644
--- a/testsuites/psxtests/psxfile01/test_extend.c
+++ b/testsuites/psxtests/psxfile01/test_extend.c
@@ -6,6 +6,13 @@
* The defined behavior is a seek() followed by a write() extends the file
* and zero fills the new length part.
*
+ * COPYRIGHT (c) 1989-2009.
+ * 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$
*/
@@ -19,8 +26,6 @@
#include <string.h>
#include <ctype.h>
-#include <assert.h>
-
#include <pmacros.h>
/*
@@ -43,7 +48,7 @@ void test_extend(
}
status = lseek( fd, offset - 1, SEEK_SET );
- assert( status != -1 );
+ rtems_test_assert( status != -1 );
status = write( fd, &c, 1 );
if ( status == -1 ) {
@@ -58,5 +63,5 @@ void test_extend(
}
status = close( fd );
- assert( !status );
+ rtems_test_assert( !status );
}
diff --git a/testsuites/psxtests/psxfile01/test_write.c b/testsuites/psxtests/psxfile01/test_write.c
index b87ba06624..ed33962d01 100644
--- a/testsuites/psxtests/psxfile01/test_write.c
+++ b/testsuites/psxtests/psxfile01/test_write.c
@@ -2,6 +2,13 @@
* A test support function which performs a write() and
* handles implied open(), lseek(), write(), and close() operations.
*
+ * COPYRIGHT (c) 1989-2009.
+ * 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$
*/
@@ -14,8 +21,6 @@
#include <errno.h>
#include <string.h>
-#include <assert.h>
-
#include <pmacros.h>
/*
@@ -42,7 +47,7 @@ void test_write(
}
status = lseek( fd, offset, SEEK_SET );
- assert( status != -1 );
+ rtems_test_assert( status != -1 );
status = write( fd, buffer, length );
if ( status == -1 ) {
@@ -57,5 +62,5 @@ void test_write(
}
status = close( fd );
- assert( !status );
+ rtems_test_assert( !status );
}