[PATCH testsuite v2 3/4] tests/[fs_]filesystem: fix unwanted error output when testing vfat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The tests currently output "fsetfilecon(3) Failed: Operation not
supported" during a clean run. Since testing that fsetfilecon(3) returns
-EOPNOTSUPP on vfat is not all that useful, rather than conditionally
silencing the error output, just skip the fsetfilecon(3) tests for vfat.

Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
---
 tests/filesystem/test    | 30 +++++++++++++++---------------
 tests/fs_filesystem/test | 30 +++++++++++++++---------------
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/tests/filesystem/test b/tests/filesystem/test
index 7d4654d..5a9f0f6 100755
--- a/tests/filesystem/test
+++ b/tests/filesystem/test
@@ -104,6 +104,9 @@ BEGIN {
     }
     elsif ($vfat_enabled) {
 
+        # For setfilecon tests as not supported
+        $test_count -= 2;
+
         # For hooks.c may_create() FILESYSTEM__ASSOCIATE as not supported
         $test_count -= 3;
 
@@ -243,15 +246,12 @@ if ($test_type_trans) {
     ok( $result eq 0 );
 }
 
-print "Creating 'test_file' and changing its context via setfilecon(3)\n";
-$result =
-  system(
+if ( not $vfat_enabled ) {
+    print "Creating 'test_file' and changing its context via setfilecon(3)\n";
+    $result =
+      system(
 "runcon -t test_filesystem_t $basedir/create_file_change_context -t test_filesystem_filecon_t -f $private_path/mp1/test_file $v"
-  );
-if ($vfat_enabled) {
-    ok( $result >> 8 eq 95 );    # EOPNOTSUPP
-}
-else {
+      );
     ok( $result eq 0 );
 }
 
@@ -981,16 +981,16 @@ if ( not $nfs_enabled ) {
     ok( $result eq 0 );
 
     # Create file with 'test_filesystem_filecon_t' context
-    print "Creating test file $basedir/mntpoint/mp1/test_file\n";
-    $result =
-      system(
+    if ( not $vfat_enabled ) {
+        print "Creating test file $basedir/mntpoint/mp1/test_file\n";
+        $result =
+          system(
 "runcon -t test_filesystem_context_t $basedir/create_file_change_context -t test_filesystem_filecon_t -f $private_path/mp1/test_file $v"
-      );
-    if ($vfat_enabled) {
-        ok( $result >> 8 eq 95 );    # EOPNOTSUPP
+          );
+        ok( $result eq 0 );
     }
     else {
-        ok( $result eq 0 );
+        system("touch $private_path/mp1/test_file");
     }
 
     print "Unmount filesystem from $basedir/mntpoint/mp1\n";
diff --git a/tests/fs_filesystem/test b/tests/fs_filesystem/test
index 5dedf83..4462438 100755
--- a/tests/fs_filesystem/test
+++ b/tests/fs_filesystem/test
@@ -112,6 +112,9 @@ BEGIN {
     }
     elsif ($vfat_enabled) {
 
+        # For setfilecon tests as not supported
+        $test_count -= 2;
+
         # For hooks.c may_create() FILESYSTEM__ASSOCIATE as not supported
         $test_count -= 3;
 
@@ -243,15 +246,12 @@ if ($test_type_trans) {
     ok( $result eq 0 );
 }
 
-print "Creating 'test_file' and changing its context via setfilecon(3)\n";
-$result =
-  system(
+if ( not $vfat_enabled ) {
+    print "Creating 'test_file' and changing its context via setfilecon(3)\n";
+    $result =
+      system(
 "runcon -t test_filesystem_t $filesystem_dir/create_file_change_context -t test_filesystem_filecon_t -f $private_path/mp1/test_file $v"
-  );
-if ($vfat_enabled) {
-    ok( $result >> 8 eq 95 );    # EOPNOTSUPP
-}
-else {
+      );
     ok( $result eq 0 );
 }
 
@@ -1010,16 +1010,16 @@ if ( not $nfs_enabled ) {
     ok( $result eq 0 );
 
     # Create file with 'test_filesystem_filecon_t' context
-    print "Creating test file $basedir/mntpoint/mp1/test_file\n";
-    $result =
-      system(
+    if ( not $vfat_enabled ) {
+        print "Creating test file $basedir/mntpoint/mp1/test_file\n";
+        $result =
+          system(
 "runcon -t test_filesystem_context_t $filesystem_dir/create_file_change_context -t test_filesystem_filecon_t -f $private_path/mp1/test_file $v"
-      );
-    if ($vfat_enabled) {
-        ok( $result >> 8 eq 95 );    # EOPNOTSUPP
+          );
+        ok( $result eq 0 );
     }
     else {
-        ok( $result eq 0 );
+        system("touch $private_path/mp1/test_file");
     }
 
     print "Unmount filesystem from $basedir/mntpoint/mp1\n";
-- 
2.26.2




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux