]> arthur.barton.de Git - bup.git/blobdiff - t/test-restore-map-owner.sh
test-restore-map-owner: accommodate python 3 and test there
[bup.git] / t / test-restore-map-owner.sh
index e5eeee3756862f90deee5601a0dc6ca0450a2d57..84f3b08a2cc145ff6eddb0b0c556f098a62e0fd1 100755 (executable)
@@ -1,7 +1,10 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh || exit $?
+. t/lib.sh || exit $?
 
-if [ $(t/root-status) != root ]; then
+root_status="$(t/root-status)" || exit $?
+
+if [ "$root_status" != root ]; then
     echo 'Not root: skipping restore --map-* tests.'
     exit 0 # FIXME: add WVSKIP.
 fi
@@ -79,15 +82,15 @@ WVPASS grep -qE "^uid: $other_uid\$" foo-xstat
 WVPASS grep -qE "^group: $other_group\$" foo-xstat
 WVPASS grep -qE "^gid: $other_gid\$" foo-xstat
 
-has_uid_gid_0=$(WVPASS python -c "
+has_uid_gid_0=$(WVPASS bup-python -c "
 import grp, pwd
 try:
   pwd.getpwuid(0)
   grp.getgrgid(0)
-  print 'yes'
-except KeyError, ex:
+  print('yes')
+except KeyError as ex:
   pass
-" 2>/dev/null) || exit $?
+") || exit $?
 if [ "$has_uid_gid_0" == yes ]
 then
     WVSTART "restore --map-user/group/uid/gid (zero uid/gid trumps all)"