]> arthur.barton.de Git - bup.git/commitdiff
t/test-meta.sh: detect and handle fakeroot.
authorRob Browning <rlb@defaultvalue.org>
Fri, 28 Jan 2011 03:31:40 +0000 (21:31 -0600)
committerRob Browning <rlb@defaultvalue.org>
Fri, 28 Jan 2011 03:31:40 +0000 (21:31 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
t/test-meta.sh

index 4fdd1f9b16db384d38e3ae615c02f296a34ee41a..c0dd89a97f23a2b212240fe6ebdb83fd194fed9b 100755 (executable)
@@ -25,9 +25,14 @@ genstat()
   )
 }
 
+actually-root()
+{
+  test "$(whoami)" == root -a -z "${FAKEROOTKEY}"
+}
+
 force-delete()
 {
-  if test "$(whoami)" != root
+  if ! actually-root
   then
     rm -rf "$@"
   else
@@ -67,7 +72,7 @@ test-src-create-extract()
   )
 }
 
-if test "$(whoami)" == root
+if actually-root
 then
   umount "${TOP}/bupmeta.tmp/testfs" || true
 fi
@@ -91,7 +96,7 @@ WVSTART 'meta - general'
 )
 
 # Root-only tests: ACLs, Linux attr, Linux xattr, etc.
-if test "$(whoami)" == root
+if actually-root
 then
   (
     cleanup_at_exit()
@@ -116,7 +121,7 @@ then
     cp -a src testfs/src
     (cd testfs && test-src-create-extract)
 
-    WVSTART 'meta - atime'
+    WVSTART 'meta - atime (as root)'
     force-delete testfs/src
     mkdir testfs/src
     (