Changeset ca835e56 in rtems for testsuites/fstests


Ignore:
Timestamp:
Nov 28, 2017, 3:42:00 PM (2 years ago)
Author:
Christian Mauderer <Christian.Mauderer@…>
Branches:
master
Children:
61bd8cd6
Parents:
fd5471b
git-author:
Christian Mauderer <Christian.Mauderer@…> (11/28/17 15:42:00)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/05/17 07:00:34)
Message:

dosfs: Fix files with same name as volume name.

Take care that a file in the root directory with the same name as the
volume name can be found.

Update #3257.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/fstests/fsdosfsname01/init.c

    rfd5471b rca835e56  
    4747#define BLOCK_NUM 47
    4848#define BLOCK_SIZE 512
     49#define VOLUME_LABEL "MyDisk"
    4950
    5051#define NUMBER_OF_DIRECTORIES 8
     
    7980static const msdos_format_request_param_t rqdata = {
    8081  .OEMName             = "RTEMS",
    81   .VolLabel            = "RTEMSDisk",
     82  .VolLabel            = VOLUME_LABEL,
    8283  .sectors_per_cluster = 2,
    8384  .fat_num             = 0,
     
    11131114}
    11141115
     1116static void test_dir_with_same_name_as_volume_label( void )
     1117{
     1118  int  rc;
     1119  DIR *dirp;
     1120
     1121  rc = mkdir( MOUNT_DIR "/" VOLUME_LABEL, S_IRWXU | S_IRWXG | S_IRWXO );
     1122  rtems_test_assert( rc == 0 );
     1123
     1124  dirp = opendir( MOUNT_DIR "/" VOLUME_LABEL );
     1125  rtems_test_assert( NULL != dirp );
     1126
     1127  rc = closedir( dirp );
     1128  rtems_test_assert( rc == 0 );
     1129
     1130  rc = unlink( MOUNT_DIR "/" VOLUME_LABEL );
     1131  rtems_test_assert( rc == 0 );
     1132}
     1133
     1134static void test_file_with_same_name_as_volume_label( void )
     1135{
     1136  int rc;
     1137  int fd;
     1138
     1139  fd = open( MOUNT_DIR "/" VOLUME_LABEL, O_RDWR | O_CREAT,
     1140             S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );
     1141  rtems_test_assert( fd >= 0 );
     1142
     1143  rc = close( fd );
     1144  rtems_test_assert( rc == 0 );
     1145
     1146  fd = open( MOUNT_DIR "/" VOLUME_LABEL, O_RDWR );
     1147  rtems_test_assert( fd >= 0 );
     1148
     1149  rc = close( fd );
     1150  rtems_test_assert( rc == 0 );
     1151
     1152  rc = unlink( MOUNT_DIR "/" VOLUME_LABEL );
     1153  rtems_test_assert( rc == 0 );
     1154}
     1155
    11151156static void test_special_cases( void )
    11161157{
    11171158  test_end_of_string_matches();
    11181159  test_full_8_3_name();
     1160  test_file_with_same_name_as_volume_label();
     1161  test_dir_with_same_name_as_volume_label();
    11191162}
    11201163
Note: See TracChangeset for help on using the changeset viewer.