]> arthur.barton.de Git - bup.git/commitdiff
Don't even test for Linux xattrs if platform.system() doesn't include Linux.
authorRob Browning <rlb@defaultvalue.org>
Sat, 16 Mar 2013 16:00:24 +0000 (11:00 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 16 Mar 2013 16:00:29 +0000 (11:00 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/metadata.py
lib/bup/t/tmetadata.py
wvtest.py

index 58f2989fd795a8fedd44c4ffd86b07357df7cc1f..f25e470ab3ec57f5376734071ec1b2eca2244309 100644 (file)
@@ -4,7 +4,7 @@
 #
 # This code is covered under the terms of the GNU Library General
 # Public License as described in the bup LICENSE file.
-import errno, os, sys, stat, time, pwd, grp
+import errno, os, sys, stat, time, platform, pwd, grp
 from cStringIO import StringIO
 from bup import vint, xstat
 from bup.drecurse import recursive_dirlist
@@ -12,18 +12,20 @@ from bup.helpers import add_error, mkdirp, log, is_superuser
 from bup.helpers import pwd_from_uid, pwd_from_name, grp_from_gid, grp_from_name
 from bup.xstat import utime, lutime
 
-try:
-    import xattr
-except ImportError:
-    log('Warning: Linux xattr support missing; install python-pyxattr.\n')
-    xattr = None
-if xattr:
+if 'Linux' in platform.system():
     try:
-        xattr.get_all
-    except AttributeError:
-        log('Warning: python-xattr module is too old; '
-            'install python-pyxattr instead.\n')
+        import xattr
+    except ImportError:
+        log('Warning: Linux xattr support missing; install python-pyxattr.\n')
         xattr = None
+    if xattr:
+        try:
+            xattr.get_all
+        except AttributeError:
+            log('Warning: python-xattr module is too old; '
+                'install python-pyxattr instead.\n')
+            xattr = None
+
 try:
     import posix1e
 except ImportError:
index 65c012a54d8a07c8a77035749d9cb5a0ab7cf729..c24ec09ad065172f5832ba96d04de2b23a279424 100644 (file)
@@ -1,4 +1,4 @@
-import glob, grp, pwd, stat, tempfile, subprocess
+import glob, grp, platform, pwd, stat, tempfile, subprocess
 import bup.helpers as helpers
 from bup import git, metadata, vfs
 from bup.helpers import clear_errors, detect_fakeroot, is_superuser
@@ -28,6 +28,7 @@ def ex(*cmd):
 
 
 def setup_testfs():
+    assert('Linux' in platform.system())
     # Set up testfs with user_xattr, etc.
     subprocess.call(['umount', 'testfs'])
     ex('dd', 'if=/dev/zero', 'of=testfs.img', 'bs=1M', 'count=32')
@@ -238,14 +239,11 @@ if not posix1e:
 
 
 from bup.metadata import xattr
-if not xattr:
-    @wvtest
-    def LINUX_XATTR_SUPPORT_IS_MISSING():
-        pass
-else:
+if xattr:
     @wvtest
     def test_handling_of_incorrect_existing_linux_xattrs():
         if not is_superuser():
+            WVMSG('skipping test -- not superuser')
             return
         setup_testfs()
         for f in glob.glob('testfs/*'):
index 833cfc403c6fddef36a3ff8dca2f7a94f2f9551c..4c4b4b99d0469e668c8241f8007230ac41a6a3f5 100755 (executable)
--- a/wvtest.py
+++ b/wvtest.py
@@ -73,6 +73,10 @@ if __name__ != '__main__':   # we're imported as a module
         return text
 
 
+    def WVMSG(message):
+        ''' Issues a notification. '''
+        return _result(message, traceback.extract_stack()[-3], 'ok')
+
     def WVPASS(cond = True):
         ''' Counts a test failure unless cond is true. '''
         return _check(cond, _code())