summaryrefslogtreecommitdiff
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-12-31 10:56:05 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-01-27 06:54:22 +0100
commitcf36b70e8dd8755e7dac6eb516169f586e78566d (patch)
tree97200818ec5dfeaa4e137a572fcbb4db746842b1 /testsuites
parent369328f00ff65a7657135351589a4676d106abbb (diff)
IMFS: Replace node union with individual struct
This reduces the average node size. Add and use IMFS_GENERIC_INITIALIZER().
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/fstests/fsimfsgeneric01/init.c37
-rw-r--r--testsuites/libtests/newlib01/init.c12
-rw-r--r--testsuites/libtests/tar02/init.c1
-rw-r--r--testsuites/libtests/tar02/tar02.scn14
-rw-r--r--testsuites/psxtests/psxfile01/psxfile01.scn75
-rw-r--r--testsuites/psxtests/psxfile01/test.c14
-rw-r--r--testsuites/psxtests/psximfs02/init.c3
-rw-r--r--testsuites/psxtests/psximfs02/psximfs02.scn32
8 files changed, 27 insertions, 161 deletions
diff --git a/testsuites/fstests/fsimfsgeneric01/init.c b/testsuites/fstests/fsimfsgeneric01/init.c
index 03e4c190d9..671ad14a48 100644
--- a/testsuites/fstests/fsimfsgeneric01/init.c
+++ b/testsuites/fstests/fsimfsgeneric01/init.c
@@ -262,12 +262,12 @@ static const rtems_filesystem_file_handlers_r node_handlers = {
static IMFS_jnode_t *node_initialize(
IMFS_jnode_t *node,
- const IMFS_types_union *info
+ void *arg
)
{
test_state *state = NULL;
- node = IMFS_node_initialize_generic(node, info);
+ node = IMFS_node_initialize_generic(node, arg);
state = IMFS_generic_get_context_by_node(node);
rtems_test_assert(*state == TEST_NEW);
@@ -286,19 +286,19 @@ static IMFS_jnode_t *node_remove(IMFS_jnode_t *node)
return node;
}
-static IMFS_jnode_t *node_destroy(IMFS_jnode_t *node)
+static void node_destroy(IMFS_jnode_t *node)
{
test_state *state = IMFS_generic_get_context_by_node(node);
rtems_test_assert(*state == TEST_REMOVED);
*state = TEST_DESTROYED;
- return node;
+ IMFS_node_destroy_default(node);
}
static const IMFS_node_control node_control = {
- .imfs_type = IMFS_GENERIC,
.handlers = &node_handlers,
+ .node_size = sizeof(IMFS_generic_t),
.node_initialize = node_initialize,
.node_remove = node_remove,
.node_destroy = node_destroy
@@ -370,7 +370,7 @@ static void test_imfs_make_generic_node(void)
static IMFS_jnode_t *node_initialize_error(
IMFS_jnode_t *node,
- const IMFS_types_union *info
+ void *arg
)
{
errno = EIO;
@@ -385,24 +385,14 @@ static IMFS_jnode_t *node_remove_inhibited(IMFS_jnode_t *node)
return node;
}
-static IMFS_jnode_t *node_destroy_inhibited(IMFS_jnode_t *node)
+static void node_destroy_inhibited(IMFS_jnode_t *node)
{
rtems_test_assert(false);
-
- return node;
}
-static const IMFS_node_control node_invalid_control = {
- .imfs_type = IMFS_DIRECTORY,
- .handlers = &node_handlers,
- .node_initialize = node_initialize_error,
- .node_remove = node_remove_inhibited,
- .node_destroy = node_destroy_inhibited
-};
-
static const IMFS_node_control node_initialization_error_control = {
- .imfs_type = IMFS_GENERIC,
.handlers = &node_handlers,
+ .node_size = sizeof(IMFS_generic_t),
.node_initialize = node_initialize_error,
.node_remove = node_remove_inhibited,
.node_destroy = node_destroy_inhibited
@@ -424,17 +414,6 @@ static void test_imfs_make_generic_node_errors(void)
errno = 0;
rv = IMFS_make_generic_node(
path,
- S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
- &node_invalid_control,
- NULL
- );
- rtems_test_assert(rv == -1);
- rtems_test_assert(errno == EINVAL);
- rtems_test_assert(rtems_resource_snapshot_check(&before));
-
- errno = 0;
- rv = IMFS_make_generic_node(
- path,
S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO,
&node_control,
NULL
diff --git a/testsuites/libtests/newlib01/init.c b/testsuites/libtests/newlib01/init.c
index 036160731b..f9d39368d2 100644
--- a/testsuites/libtests/newlib01/init.c
+++ b/testsuites/libtests/newlib01/init.c
@@ -232,13 +232,11 @@ static const rtems_filesystem_file_handlers_r node_handlers = {
.writev_h = handler_writev
};
-static const IMFS_node_control node_control = {
- .imfs_type = IMFS_GENERIC,
- .handlers = &node_handlers,
- .node_initialize = IMFS_node_initialize_default,
- .node_remove = IMFS_node_remove_default,
- .node_destroy = IMFS_node_destroy_default
-};
+static const IMFS_node_control node_control = IMFS_GENERIC_INITIALIZER(
+ &node_handlers,
+ IMFS_node_initialize_default,
+ IMFS_node_destroy_default
+);
static void test(void)
{
diff --git a/testsuites/libtests/tar02/init.c b/testsuites/libtests/tar02/init.c
index ebf87f8222..8d790f6e61 100644
--- a/testsuites/libtests/tar02/init.c
+++ b/testsuites/libtests/tar02/init.c
@@ -68,7 +68,6 @@ rtems_task Init(
TEST_BEGIN();
test_tarfs_load();
- IMFS_dump();
TEST_END();
exit( 0 );
diff --git a/testsuites/libtests/tar02/tar02.scn b/testsuites/libtests/tar02/tar02.scn
index f4ba9ce0f2..e7a9165220 100644
--- a/testsuites/libtests/tar02/tar02.scn
+++ b/testsuites/libtests/tar02/tar02.scn
@@ -1,4 +1,4 @@
-*** TAR02 TEST ***
+*** BEGIN OF TEST TAR 2 ***
Loading tarfs image ... successful
========= /home/test_file =========
(0)This is a test of loading an RTEMS filesystem from an
@@ -8,14 +8,4 @@ initial tar image.
(0)This is a test of loading an RTEMS filesystem from an
initial tar image.
-*************** Dump of Entire IMFS ***************
-/
-....dev/
-........ttyS0 (device 0, 0)
-........console (device 0, 0)
-........ttyS1 (device 0, 1)
-....home/
-........test_file (file 73 0x390f8)
-....symlink links not printed
-*************** End of Dump ***************
-*** END OF TAR02 TEST ***
+*** END OF TEST TAR 2 ***
diff --git a/testsuites/psxtests/psxfile01/psxfile01.scn b/testsuites/psxtests/psxfile01/psxfile01.scn
index 5cdd609613..605fef176e 100644
--- a/testsuites/psxtests/psxfile01/psxfile01.scn
+++ b/testsuites/psxtests/psxfile01/psxfile01.scn
@@ -1,11 +1,4 @@
-*** FILE TEST 1 ***
-*************** Dump of Entire IMFS ***************
-/
-....dev/
-........console_a (device 0, 0)
-........console (device 0, 0)
-........console_b (device 0, 1)
-*************** End of Dump ***************
+*** BEGIN OF TEST PSXFILE 1 ***
stat of /dev/console
....st_dev (0xfffe:0x0)
....st_rdev (0x0:0x0)
@@ -181,26 +174,6 @@ This is call 5 to fprintf
....ctime = Sat Dec 31 09:00:00 1988
....st_blksize 80
....st_blocks 0
-*************** Dump of Entire IMFS ***************
-/
-....dev/
-........console_a (device 0, 0)
-........console (device 0, 0)
-........console_b (device 0, 1)
-........tty/
-............S3 (device 255, 128)
-........test_console (device 0, 0)
-....etc/
-........passwd (file 0)
-....tmp/
-........my_dir/
-........tom (file 0)
-........john (file 0)
-........joel (file 533)
-........j (file 130)
-....imfs/
-........hidden_on_mount/
-*************** End of Dump ***************
truncate /tmp/j to length of 40
....st_dev (0xfffe:0x0)
....st_rdev (0x0:0x0)
@@ -209,53 +182,15 @@ truncate /tmp/j to length of 40
....nlink = 1
....uid = 0
....gid = 0
-....atime = Sat Dec 31 09:00:02 1988
-....mtime = Sat Dec 31 09:00:00 1988
-....ctime = Sat Dec 31 09:00:00 1988
+....atime = Sat Dec 31 09:00:01 1988
+....mtime = Sat Dec 31 09:00:02 1988
+....ctime = Sat Dec 31 09:00:02 1988
....st_blksize 80
....st_blocks 0
-*************** Dump of Entire IMFS ***************
-/
-....dev/
-........console_a (device 0, 0)
-........console (device 0, 0)
-........console_b (device 0, 1)
-........tty/
-............S3 (device 255, 128)
-........test_console (device 0, 0)
-....etc/
-........passwd (file 0)
-....tmp/
-........my_dir/
-........tom (file 0)
-........john (file 0)
-........j (file 40)
-....imfs/
-........hidden_on_mount/
-*************** End of Dump ***************
truncate /tmp/j to length of 0
truncate /tmp to length of 0 should fail with EISDIR
21: Is a directory
-*************** Dump of Entire IMFS ***************
-/
-....dev/
-........console_a (device 0, 0)
-........console (device 0, 0)
-........console_b (device 0, 1)
-........tty/
-............S3 (device 255, 128)
-........test_console (device 0, 0)
-....etc/
-........passwd (file 0)
-....tmp/
-........my_dir/
-........tom (file 0)
-........john (file 0)
-........j (file 0)
-....imfs/
-........hidden_on_mount/
-*************** End of Dump ***************
Writing First File
Writing Second File
(0)this is a test line
@@ -264,4 +199,4 @@ this is a test line
(0)this is a test line
this is a test line
-*** END OF FILE TEST 1 ***
+*** END OF TEST PSXFILE 1 ***
diff --git a/testsuites/psxtests/psxfile01/test.c b/testsuites/psxtests/psxfile01/test.c
index 94f80c8b2e..abc9295053 100644
--- a/testsuites/psxtests/psxfile01/test.c
+++ b/testsuites/psxtests/psxfile01/test.c
@@ -166,19 +166,13 @@ int main(
* Grab the maximum size of an in-memory file.
*/
- max_size = IMFS_memfile_maximum_size();
+ max_size = IMFS_MEMFILE_MAXIMUM_SIZE;
build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
rtems_status = rtems_clock_set( &time );
directive_failed( rtems_status, "clock set" );
/*
- * Dump an empty file system
- */
-
- IMFS_dump();
-
- /*
* Simple stat() of /dev/console.
*/
@@ -605,8 +599,6 @@ since new path is not valid");
rtems_test_assert( mtime1 == mtime2);
rtems_test_assert( ctime1 == ctime2);
- IMFS_dump();
-
unlink( "/tmp/joel" );
/*
@@ -631,8 +623,6 @@ since new path is not valid");
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 );
rtems_test_assert( status == 0 );
@@ -647,8 +637,6 @@ since new path is not valid");
printf( "%d: %s\n", errno, strerror( errno ) );
rtems_test_assert( errno == EISDIR );
- IMFS_dump();
-
status = truncate( "/tmp/fred", 10 );
rtems_test_assert( status == -1);
diff --git a/testsuites/psxtests/psximfs02/init.c b/testsuites/psxtests/psximfs02/init.c
index 9d45b75d52..c7e2d3c807 100644
--- a/testsuites/psxtests/psximfs02/init.c
+++ b/testsuites/psxtests/psximfs02/init.c
@@ -31,7 +31,6 @@ extern int seteuid(uid_t euid);
/* forward declarations to avoid warnings */
rtems_task Init(rtems_task_argument argument);
-void IMFS_dump(void);
rtems_task Init(
rtems_task_argument argument
@@ -183,8 +182,6 @@ rtems_task Init(
puts( "Creating a fifo -- OK" );
status = mkfifo( "/fifo", S_IRWXU );
rtems_test_assert( status == 0 );
-
- IMFS_dump();
puts( "chown /fifo to 10 -- OK" );
status = chown( "/fifo", 10, 10 );
diff --git a/testsuites/psxtests/psximfs02/psximfs02.scn b/testsuites/psxtests/psximfs02/psximfs02.scn
index f86e975821..930a0fa781 100644
--- a/testsuites/psxtests/psximfs02/psximfs02.scn
+++ b/testsuites/psxtests/psximfs02/psximfs02.scn
@@ -1,4 +1,4 @@
-*** TEST IMFS 02 ***
+*** BEGIN OF TEST PSXIMFS 2 ***
Creating directory /dir00
Creating directory /dir00/dir01
Changing directory to /dir00
@@ -24,42 +24,22 @@ Opening /node-link in WRONLY mode -- expect EACCES
Creating a symlink /node-slink for /node
Opening /node-slink in WRONLY mode -- expect EACCES
Allocate most of heap
-Attempt to mount a fs at /dir01 -- expect ENOMEM
-Freeing allocated memory
-Allocate most of heap
+Attempt to mount a fs at dir01 -- expect ENOMEMFreeing allocated memory
Changing directory to /
+Allocate most of heap
Attempt to create /node-link-2 for /node -- expect ENOMEM
Attempt to create /node-slink-2 for /node -- expect ENOMEM
Freeing allocated memory
Allocate most of heap
-Attempt to create /node-slink-2 for /node -- expect ENOMEM
-Freeing allocated memory
-Attempt to stat a hardlink -- expect ENOTSUP
+Attempt to create node-slink-2 for /node -- expect ENOMEMFreeing allocated memory
+Attempt to stat a hardlink
Changing euid to 10
Attempt chmod on /node -- expect EPERM
Attempt chown on /node -- expect EPERM
Changing euid back to 0 [root]
Creating a fifo -- OK
-*************** Dump of Entire IMFS ***************
-/
-....dev/
-........console (device 0, 0)
-....dir00/
-........dir01/
-........dir01-link0 links not printed
-........dir01-link1 links not printed
-........dir01-link2 links not printed
-........dir01-link3 links not printed
-........dir01-link4 links not printed
-........dir01-link5 links not printed
-........dir01-link6 links not printed
-....node (file 0)
-....node-link links not printed
-....node-slink links not printed
-....fifo FIFO not printed
-*************** 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 ***
+*** END OF TEST PSXIMFS 2 ***