components/python/xattr/patches/test.patch
author Vladimir Marek <Vladimir.Marek@oracle.com>
Mon, 10 Apr 2017 11:54:32 -0700
branchs11u3-sru
changeset 7853 87236a3c36b4
parent 3114 f0074f08c8db
permissions -rw-r--r--
25694511 xattr can't be built on recent CBE
Every file on Solaris 11 and on has two extended attributes, so if we find
them, we shouldn't fail.  Also, we don't support extended attributes on
symlinks, so just quietly pass that test.

Merged as of 0.7.6.

diff --git a/xattr/tests/test_xattr.py b/xattr/tests/test_xattr.py
--- a/xattr/tests/test_xattr.py	Mon Mar  3 10:12:24 2014
+++ b/xattr/tests/test_xattr.py	Wed Mar 26 16:29:24 2014
@@ -1,4 +1,5 @@
 import os
+import sys
 from unittest import TestCase
 from tempfile import mkdtemp, NamedTemporaryFile
 
@@ -8,10 +9,19 @@
 class BaseTestXattr(object):
     def test_attr(self):
         x = xattr.xattr(self.tempfile)
-        self.assertEqual(x.keys(), [])
-        self.assertEqual(x.list(), [])
-        self.assertEqual(dict(x), {})
 
+        # Solaris 11 and forward contain system attributes (file flags) in
+        # extended attributes present on all files, so cons them up into a
+        # comparison dict.
+        d = {}
+        if sys.platform == 'sunos5' and 'SUNWattr_ro' in x:
+            d['SUNWattr_ro'] = x['SUNWattr_ro']
+            d['SUNWattr_rw'] = x['SUNWattr_rw']
+
+        self.assertEqual(sorted(x.keys()), sorted(d.keys()))
+        self.assertEqual(sorted(x.list()), sorted(d.keys()))
+        self.assertEqual(dict(x), d)
+
         x['user.sopal'] = b'foo'
         x['user.sop.foo'] = b'bar'
         x[u'user.\N{SNOWMAN}'] = b'not a snowman'
@@ -38,6 +48,9 @@
         self.assertTrue('user.sop.foo' not in x)
 
     def test_symlink_attrs(self):
+        # Solaris doesn't support extended attributes on symlinks
+        if sys.platform == 'sunos5':
+            return
         symlinkPath = self.tempfilename + '.link'
         os.symlink(self.tempfilename, symlinkPath)
         try: