On 02/21/14 08:12, Sebastian Huber wrote:
On 2014-02-20 00:36, Andre Marques wrote:
- Testing errno values in error situations. There is already a
fstest named
fserror which purpose seems to be checking errno values for a
bunch of
functions (rename included, but with some errno values missing).
Not sure
if I
should put them in this test or add to fserror.
I would move all rename related tests to this new test program.
About the errno value testing, I'm currently missing EIO, ENOSPC,
EROFS and
EXDEV.
EROFS and EXDEV require mounting a second filesystem. How can I do
this in
RTEMS? Can it be done at runtime? I've been looking at the fileio
sample, which
uses the fsmount() function, but I need a disk to mount with it.
For EROFS there is already a test in fstests/fsrofs01.
So I leave EROFS out of this test?
Yes, I would leave the EROFS test out.
You can mount as many file system instances as you want. You can do
this
with mount(). The mount() parameters are file system dependent. The
generic
file system tests (and your rename test should be one of them) use a
support
file for this:
./testsuites/fstests/mrfs_support/fs_support.c
./testsuites/fstests/mimfs_support/fs_support.c
./testsuites/fstests/mdosfs_support/fs_support.c
./testsuites/fstests/imfs_support/fs_support.c
./testsuites/fstests/jffs2_support/fs_support.c
Yes I'm using support files on Makefile.am.
For mount() should I use a ramdisk for the device file?
I tried to create a ramdisk as in
http://www.rtems.org/onlinedocs/doxygen/cpukit/html/group__rtems__ramdisk.html#gac6c99eed9f3b92bb4cf5184b25972e65
but the program exits during the rtems_blkdev_create() call, if I use
"/dev/rda" as the device path.
How does the code look like?
With
rtems_status_code sc;
ramdisk *rd;
const char device [] = "/dev/rda";
uint32_t media_block_size = 512;
rtems_blkdev_bnum media_block_count = 4000;
rd = ramdisk_allocate(NULL, media_block_size, media_block_count, false);
if (rd != NULL) {
sc = rtems_blkdev_create(
device,
media_block_size,
media_block_count,
ramdisk_ioctl,
rd);
perror("rtems_blkdev_create -> ");
}
the program just exits without giving any reason before the perror()
call. I assumed it was because the /dev directory wasn't there, so I
created the /dev directory before the rtems_blkdev_create() call and
then it gives
rtems_blkdev_create -> : Not supported
This while using ./testsuites/fstests/mrfs_support/fs_support.c
You can use the system file system as the second file system for the
EXDEV test.
I'm reading this as mounting an instance of the system filesystem. Am
I right?
You need two file system instances. If you configure the system with
CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM, then it starts with the IMFS as
the root file system. For the file system tests you need a file
system instance to test. This is set up with the
test_initialize_filesystem() function, e.g.
void test_initialize_filesystem(void)
{
int rv;
erase_all();
rv = mkdir(BASE_FOR_TEST, S_IRWXU | S_IRWXG | S_IRWXO);
rtems_test_assert(rv == 0);
rtems_resource_snapshot_take(&before_mount);
rv = mount(
NULL,
BASE_FOR_TEST,
RTEMS_FILESYSTEM_TYPE_JFFS2,
RTEMS_FILESYSTEM_READ_WRITE,
&mount_data
);
rtems_test_assert(rv == 0);
}
void test_shutdown_filesystem(void)
{
int rv = unmount(BASE_FOR_TEST);
rtems_test_assert(rv == 0);
rtems_test_assert(rtems_resource_snapshot_check(&before_mount));
}
So for the EXDEV test you can use for example:
rename("/abc.txt", BASE_FOR_TEST "/abc.txt");
I used the equivalent functions on
./testsuites/fstests/mrfs_support/fs_support.c and it gave
../../../../../../../../Code/c/src/../../testsuites/fstests/mrfs_fsrename/../support/ramdisk_support.c:
40 rc == 0
which means it failed ramdisk_register().
But since I'm skipping the stafvfs() function call for now, I tried to
use mimfs (instead of mrfs) with
./testsuites/fstests/mimfs_support/fs_support.c and then I could finally
mount a second filesystem, so I will be working now with MIMFS.
A small issue I have with test_initialize_filesystem() and
test_shutdown_filesystem() is that I'm calling them from my code as
test_initialize_filesystem ();
... some code ...
test_shutdown_filesystem();
which generates
warning: nested extern declaration of 'test_initialize_filesystem'
because it is defined both on
./testsuites/fstests/mimfs_support/fs_support.c and
./testsuites/fstests/support/fstest_support.h and the first includes the
former, hence the warning (I believe).
What would be the best approach to solve this?
_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel