Changeset 514a3fe in rtems


Ignore:
Timestamp:
May 17, 2010, 5:56:13 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
baf64cdb
Parents:
377c0cb0
Message:

2010-05-17 Bharath Suri <bharath.s.jois@…>

  • psxfile01/test.c, psxfile01/psxfile01.scn: This file now exercises the _rename_r in libcsupport. For now, it also provides two fsmount_me_h handlers to enable certain error checking paths
Location:
testsuites/psxtests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    r377c0cb0 r514a3fe  
     12010-05-17      Bharath Suri <bharath.s.jois@gmail.com>
     2
     3        * psxfile01/test.c, psxfile01/psxfile01.scn: This file now
     4        exercises the _rename_r in libcsupport. For now, it also
     5        provides two fsmount_me_h handlers to enable certain error
     6        checking paths
     7
    182010-04-28      Joel Sherrill <joel.sherrill@oarcorp.com>
    29
  • testsuites/psxtests/psxfile01/psxfile01.scn

    r377c0cb0 r514a3fe  
    1 NOTE: If you get the following assertion, then your target does not
    2 have enough memory in the heap used by malloc to allocate all the
    3 files used during this test:
    4 
    5 assertion "memory" failed: file "...../c/src/lib/libc/memfile.c", line 340
     1Could not open '/dev/kqemu' - QEMU acceleration layer not activated: No such file or directory
     2Initialized console on port COM1 9600-8-N-1
     3
     4
    65
    76*** FILE TEST 1 ***
     
    1413....st_dev     (0x0:0x0)
    1514....st_ino     3  may vary by small amount
    16 ....mode  = 00020771
     15....mode  = 00020755
    1716....nlink = 1
    1817....uid = 0
     
    2120....mtime = Fri Jan  1 00:00:00 1988
    2221....ctime = Fri Jan  1 00:00:00 1988
     22....st_blksize 0
     23....st_blocks  0
    2324
    2425mkdir /dev/tty
     
    5556(0)the first write!!!
    5657
     58rename /tmp/joel to /tmp/drjoel
     59rename /tmp/drjoel to /tmp/joel
     60rename /tmp/drjoel to /tmp/joel - Should result in an error since old path is not valid
     61rename /tmp/joel to /tmp/drjoel/joel - Should result in an error since new path is not valid
     62changing dir to /tmp
     63rename joel to drjoel
     64rename drjoel to joel
     65creating directory /imfs
     66creating directory /imfs/hidden_on_mount
     67mounting filesystem with IMFS_ops at /imfs
     68creating directory /imfs/test (on newly mounted filesystem)
     69attempt to rename directory joel to /imfs/test/joel - should fail with EXDEV
     70changing dir to /
     71attempt to rename across filesystem, with old path having a parent node
     72attempt to rename tmp/joel to /imfs/test/joel
     73Unmounting /imfs
     74Mounting filesystem @ /imfs with no support for evalformake
     75change directory to /imfs
     76exercise _rename_r, with target on /imfs - expected ENOTSUP
     77attempt to rename /tmp/joel to joel
     78change directory to /
     79Mounting filesystem @ /imfs with no support for rename
     80creating directory /imfs/test
     81creating directory /imfs/test/old_dir
     82changing to /
     83attempt to rename imfs/old_dir to imfs/new_dir
     84unmounting /imfs
     85End of _rename_r tests
    5786(10)the first write!!!
    5887
    59 stat( /tmp/joel ) returned
    60 ....st_dev     (0x0:0x0)
    61 ....st_ino     10  may vary by small amount
     88stat( /tmp/joel ) returned 
     89....st_dev     (0x0:0x0)
     90....st_ino     12  may vary by small amount
    6291....mode  = 00100700
    6392....nlink = 1
     
    6796....mtime = Sat Dec 31 09:00:00 1988
    6897....ctime = Sat Dec 31 09:00:00 1988
     98....st_blksize 0
     99....st_blocks  0
    69100unlink /tmp/joel
    70101unlink /tmp/joel
     
    86117(513)the first write!!!
    87118
    88 (139743)
    89 stat( /tmp/joel ) returned
    90 ....st_dev     (0x0:0x0)
    91 ....st_ino     11  may vary by small amount
     119Skipping maximum file size test since max_size is 4329344 bytes
     120That is likely to be bigger than the available RAM on many targets.
     121stat( /tmp/joel ) returned
     122....st_dev     (0x0:0x0)
     123....st_ino     13  may vary by small amount
    92124....mode  = 00100700
    93125....nlink = 1
     
    97129....mtime = Sat Dec 31 09:00:00 1988
    98130....ctime = Sat Dec 31 09:00:00 1988
     131....st_blksize 0
     132....st_blocks  0
    99133stat of /tmp/j
    100134stat(/tmp/j) returned -1 (errno=2)
    101135....st_dev     (0x0:0x0)
    102136....st_ino     3  may vary by small amount
    103 ....mode  = 00020771
     137....mode  = 00020755
    104138....nlink = 1
    105139....uid = 0
     
    108142....mtime = Fri Jan  1 00:00:00 1988
    109143....ctime = Fri Jan  1 00:00:00 1988
     144....st_blksize 0
     145....st_blocks  0
    110146fopen of /tmp/j
    111147fprintf to /tmp/j
     
    116152(5) 26 characters written to the file
    117153....st_dev     (0x0:0x0)
    118 ....st_ino     12  may vary by small amount
    119 ....mode  = 00100660
     154....st_ino     14  may vary by small amount
     155....mode  = 00100644
    120156....nlink = 1
    121157....uid = 0
     
    124160....mtime = Sat Dec 31 09:00:00 1988
    125161....ctime = Sat Dec 31 09:00:00 1988
     162....st_blksize 0
     163....st_blocks  0
    126164This is call 1 to fprintf
    127165This is call 2 to fprintf
     
    130168This is call 5 to fprintf
    131169....st_dev     (0x0:0x0)
    132 ....st_ino     12  may vary by small amount
    133 ....mode  = 00100660
     170....st_ino     14  may vary by small amount
     171....mode  = 00100644
    134172....nlink = 1
    135173....uid = 0
     
    138176....mtime = Sat Dec 31 09:00:00 1988
    139177....ctime = Sat Dec 31 09:00:00 1988
     178....st_blksize 0
     179....st_blocks  0
    140180*************** Dump of Entire IMFS ***************
    141181/
     
    143183........console (device 0, 0)
    144184........tty/
    145 ............S3 (device 255, 128)
     185............S3 (device 128, 255)
    146186........test_console (device 0, 0)
    147187....etc/
     
    151191........tom (file 0)
    152192........john (file 0)
    153 ........joel (file 279487)
     193........joel (file 533)
    154194........j (file 130)
     195....imfs/
     196........hidden_on_mount/
    155197***************       End of Dump        ***************
    156198truncate /tmp/j to length of 40
    157199....st_dev     (0x0:0x0)
    158 ....st_ino     12  may vary by small amount
    159 ....mode  = 00100660
     200....st_ino     14  may vary by small amount
     201....mode  = 00100644
    160202....nlink = 1
    161203....uid = 0
     
    164206....mtime = Sat Dec 31 09:00:00 1988
    165207....ctime = Sat Dec 31 09:00:00 1988
     208....st_blksize 0
     209....st_blocks  0
    166210*************** Dump of Entire IMFS ***************
    167211/
     
    169213........console (device 0, 0)
    170214........tty/
    171 ............S3 (device 255, 128)
     215............S3 (device 128, 255)
    172216........test_console (device 0, 0)
    173217....etc/
     
    178222........john (file 0)
    179223........j (file 40)
     224....imfs/
     225........hidden_on_mount/
    180226***************       End of Dump        ***************
    181227truncate /tmp/j to length of 0
     
    188234........console (device 0, 0)
    189235........tty/
    190 ............S3 (device 255, 128)
     236............S3 (device 128, 255)
    191237........test_console (device 0, 0)
    192238....etc/
     
    197243........john (file 0)
    198244........j (file 0)
     245....imfs/
     246........hidden_on_mount/
    199247***************       End of Dump        ***************
    200248Writing First File
     
    205253(0)this is a test line
    206254this is a test line
     255
    207256*** END OF FILE TEST 1 ***
    208 
  • testsuites/psxtests/psxfile01/test.c

    r377c0cb0 r514a3fe  
    3131#include <string.h>
    3232#include <ctype.h>
     33#include <rtems/imfs.h>
    3334
    3435#include <rtems.h>
     
    3839
    3940char test_write_buffer[ 1024 ];
    40 
     41rtems_filesystem_operations_table  IMFS_ops_no_evalformake;
     42rtems_filesystem_operations_table  IMFS_ops_no_rename;
    4143/*
    4244 *  File test support routines.
     
    114116  }
    115117
     118}
     119
     120int no_evalformake_IMFS_initialize(
     121  rtems_filesystem_mount_table_entry_t *temp_mt_entry
     122)
     123{
     124   return IMFS_initialize_support(
     125     temp_mt_entry,
     126     &IMFS_ops_no_evalformake,
     127     &IMFS_memfile_handlers,
     128     &IMFS_directory_handlers
     129   );
     130}
     131
     132int no_rename_IMFS_initialize(
     133  rtems_filesystem_mount_table_entry_t *temp_mt_entry
     134)
     135{
     136   return IMFS_initialize_support(
     137     temp_mt_entry,
     138     &IMFS_ops_no_rename,
     139     &IMFS_memfile_handlers,
     140     &IMFS_directory_handlers
     141   );
    116142}
    117143
     
    145171  rtems_status_code rtems_status;
    146172  rtems_time_of_day time;
     173  rtems_filesystem_mount_table_entry_t *mt_entry;
     174
     175  IMFS_ops_no_evalformake = IMFS_ops;
     176  IMFS_ops_no_rename = IMFS_ops;
     177
     178  IMFS_ops_no_evalformake.fsmount_me_h = no_evalformake_IMFS_initialize;
     179  IMFS_ops_no_evalformake.evalformake_h = NULL;
     180
     181  IMFS_ops_no_rename.fsmount_me_h = no_rename_IMFS_initialize;
     182  IMFS_ops_no_rename.rename_h = NULL;
     183
    147184
    148185  printf( "\n\n*** FILE TEST 1 ***\n" );
     
    336373  test_write( "/tmp/joel", 0, "the first write!!!\n" );
    337374  test_cat( "/tmp/joel", 0, 0 );
     375
     376  /* Exercise _rename_r */
     377
     378  /* Simple rename test */
     379  puts( "rename /tmp/joel to /tmp/drjoel");
     380  status = _rename_r(NULL,"/tmp/joel","/tmp/drjoel");
     381  rtems_test_assert(status == 0);
     382
     383  /* Simple rename test */
     384  puts("rename /tmp/drjoel to /tmp/joel");
     385  status = _rename_r(NULL,"/tmp/drjoel","/tmp/joel");
     386  rtems_test_assert(status == 0);
     387
     388  /* Invalid old path */
     389  puts("rename /tmp/drjoel to /tmp/joel - Should result in an error \
     390since old path is not valid");
     391  status = _rename_r(NULL,"/tmp/drjoel","/tmp/joel");
     392  rtems_test_assert(status == -1);
     393
     394  /* Invalid new path */
     395  puts("rename /tmp/joel to /tmp/drjoel/joel - Should result in an error \
     396since new path is not valid");
     397  status = _rename_r(NULL,"/tmp/joel","/tmp/drjoel/joel");
     398  rtems_test_assert(status == -1);
     399
     400  puts("changing dir to /tmp");
     401  status = chdir("/tmp/");
     402  rtems_test_assert(status == 0);
     403
     404  puts("rename joel to drjoel");
     405  status = _rename_r(NULL,"joel","drjoel");
     406  rtems_test_assert(status == 0);
     407
     408  puts("rename drjoel to joel");
     409  status = _rename_r(NULL,"drjoel","joel");
     410  rtems_test_assert(status == 0);
     411
     412  /* Rename across file systems */
     413  puts("creating directory /imfs");
     414  status = mkdir("/imfs",0777);
     415  rtems_test_assert(status == 0);
     416  puts("creating directory /imfs/hidden_on_mount");
     417  status = mkdir("/imfs/hidden_on_mount",0777);
     418  rtems_test_assert(status == 0);
     419
     420  puts("mounting filesystem with IMFS_ops at /imfs");
     421  status = mount(&mt_entry, &IMFS_ops,
     422                 RTEMS_FILESYSTEM_READ_WRITE,
     423                 NULL, "/imfs");
     424  rtems_test_assert(status == 0);
     425  rtems_test_assert(mt_entry != NULL);
     426  puts("creating directory /imfs/test (on newly mounted filesystem)");
     427  status = mkdir("/imfs/test", 0777);
     428  rtems_test_assert(status == 0);
     429
     430  puts("attempt to rename directory joel to /imfs/test/joel - should fail with EXDEV");
     431  status = _rename_r(NULL, "joel", "/imfs/test/joel");
     432  rtems_test_assert(status == -1);
     433  rtems_test_assert(errno == EXDEV);
     434
     435  puts("changing dir to /");
     436  status = chdir("/");
     437  rtems_test_assert(status == 0);
     438
     439  puts("attempt to rename across filesystem, with old path having a parent node");
     440  puts("attempt to rename tmp/joel to /imfs/test/joel");
     441  status = _rename_r(NULL, "tmp/joel", "/imfs/test/joel");
     442  rtems_test_assert(status == -1);
     443  rtems_test_assert(errno == EXDEV);
     444
     445  puts("Unmounting /imfs");
     446  status = unmount("/imfs");
     447  rtems_test_assert(status == 0);
     448
     449  puts("Mounting filesystem @ /imfs with no support for evalformake");
     450 
     451  status = mount(&mt_entry, &IMFS_ops_no_evalformake,
     452                 RTEMS_FILESYSTEM_READ_WRITE,
     453                 NULL, "/imfs");
     454  rtems_test_assert(status == 0);
     455  rtems_test_assert(mt_entry != NULL);
     456
     457  puts("change directory to /imfs");
     458  status = chdir("/imfs");
     459  rtems_test_assert(status == 0);
     460
     461  puts("exercise _rename_r, with target on /imfs - expected ENOTSUP");
     462  puts("attempt to rename /tmp/joel to joel");
     463  status = _rename_r(NULL, "/tmp/joel", "joel");
     464  rtems_test_assert(status == -1);
     465  rtems_test_assert(errno == ENOTSUP);
     466
     467  puts("change directory to /");
     468  status = chdir("/");
     469  rtems_test_assert(status == 0);
     470 
     471  status = unmount("/imfs");
     472  rtems_test_assert(status == 0);
     473
     474
     475  puts("Mounting filesystem @ /imfs with no support for rename");
     476  status = mount(&mt_entry, &IMFS_ops_no_rename,
     477                 RTEMS_FILESYSTEM_READ_WRITE,
     478                 NULL, "/imfs");
     479  rtems_test_assert(status == 0);
     480  rtems_test_assert(mt_entry != NULL);
     481
     482  puts("creating directory /imfs/test");
     483  status = mkdir("/imfs/test", 0777);
     484  rtems_test_assert(status == 0);
     485
     486  puts("creating directory /imfs/test/old_dir");
     487  status = mkdir("/imfs/test/old_dir", 0777);
     488  rtems_test_assert(status == 0);
     489
     490  puts("changing to /");
     491  status = chdir("/");
     492 
     493  puts("attempt to rename imfs/old_dir to imfs/new_dir");
     494  status = _rename_r(NULL, "imfs/test/old_dir", "imfs/test/new_dir");
     495  rtems_test_assert(status == -1);
     496  rtems_test_assert(errno == ENOTSUP);
     497
     498  puts("unmounting /imfs");
     499  status = unmount("/imfs");
     500  rtems_test_assert(status == 0);
     501
     502  puts("End of _rename_r tests");
    338503
    339504  /*
Note: See TracChangeset for help on using the changeset viewer.