generic/377: filter out xattrs that don't start with 'user.'
authorJeff Layton <jlayton@kernel.org>
Wed, 5 Aug 2020 13:53:07 +0000 (09:53 -0400)
committerEryu Guan <guaneryu@gmail.com>
Sun, 9 Aug 2020 16:31:28 +0000 (00:31 +0800)
Most hosts that I've been testing on seem to display security.selinux in
listxattr. 377.out doesn't account for that so it routinely fails for me
in testing.

When testing the output of listxattr in generic/377, filter out any xattr
names that don't start with 'user.'. That should help ensure consistent
output on SELinux-enabled hosts.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/377

index f7835ee8ff9ec5902924a0829b9224a8a691759f..f08abdca60a642af759e2dfc60bcfc187ecf95e2 100755 (executable)
@@ -48,7 +48,7 @@ $SETFATTR_PROG -n user.ping -v pong $testfile
 $SETFATTR_PROG -n user.hello -v there $testfile
 
 # 1. Call listxattr without buffer length argument. This should succeed.
 $SETFATTR_PROG -n user.hello -v there $testfile
 
 # 1. Call listxattr without buffer length argument. This should succeed.
-$listxattr $testfile | sort
+$listxattr $testfile | grep '^xattr: user\.' | sort
 
 # 2. Calling listxattr on nonexistant file should fail with -ENOENT.
 $listxattr ""
 
 # 2. Calling listxattr on nonexistant file should fail with -ENOENT.
 $listxattr ""
@@ -66,7 +66,7 @@ $listxattr $testfile 9
 $listxattr $testfile 11
 
 # 6. Calling listxattr with buffersize bigger than needed should succeed.
 $listxattr $testfile 11
 
 # 6. Calling listxattr with buffersize bigger than needed should succeed.
-$listxattr $testfile 500 | sort
+$listxattr $testfile 500 | grep '^xattr: user\.' | sort
 
 status=0
 exit
 
 status=0
 exit