[rtems commit] fsdosfsname01: Improve test for duplicate names

Sebastian Huber sebh at rtems.org
Fri Nov 15 12:59:31 UTC 2013


Module:    rtems
Branch:    master
Commit:    a45b2ac992a12ccc0641ab08d5a99e2bb762ddf7
Changeset: http://git.rtems.org/rtems/commit/?id=a45b2ac992a12ccc0641ab08d5a99e2bb762ddf7

Author:    Ralf Kirchner <ralf.kirchner at embedded-brains.de>
Date:      Fri Nov 15 13:45:01 2013 +0100

fsdosfsname01: Improve test for duplicate names

---

 testsuites/fstests/fsdosfsname01/init.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/testsuites/fstests/fsdosfsname01/init.c b/testsuites/fstests/fsdosfsname01/init.c
index 2d3348e..72de7d9 100644
--- a/testsuites/fstests/fsdosfsname01/init.c
+++ b/testsuites/fstests/fsdosfsname01/init.c
@@ -19,6 +19,7 @@
 
 #include "tmacros.h"
 
+#include <errno.h>
 #include <fcntl.h>
 #include <dirent.h>
 
@@ -459,8 +460,10 @@ static void test_creating_duplicate_directories(
           ++index_duplicate ) {
       snprintf( dirname, sizeof( dirname ), "%s/%s", start_dir,
                 duplicates[index_dir].name_duplicates[index_duplicate] );
+      errno = 0;
       rc = mkdir( dirname, S_IRWXU | S_IRWXG | S_IRWXO );
-      rtems_test_assert( rc < 0 );
+      rtems_test_assert( rc == -1 );
+      rtems_test_assert( errno == EEXIST );
     }
   }
 }
@@ -608,6 +611,11 @@ static void test_duplicated_files( const char *dirname,
 
       rc = close( fd );
       rtems_test_assert( rc == 0 );
+
+      errno = 0;
+      fd = open( filename, O_RDWR | O_CREAT | O_EXCL );
+      rtems_test_assert( fd == -1 );
+      rtems_test_assert( errno == EEXIST );
     }
 
     rc = remove( filename );




More information about the vc mailing list