summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-03-27 20:47:02 +0000
committerLars Wirzenius <liw@liw.fi>2014-03-27 20:47:02 +0000
commit4bae8d8b01bbbc816f202d79e50135bf0bf26d5d (patch)
tree33cce20d5752f547b4f61e345cc0c680666954e6
parenta17cdfe3eca1aa308809697ddc2c170a7cc6b501 (diff)
downloadobnam-4bae8d8b01bbbc816f202d79e50135bf0bf26d5d.tar.gz
Convert unreadable-dir cmdtest to yarn
-rw-r--r--tests/unreadable-dir.exit1
-rwxr-xr-xtests/unreadable-dir.script46
-rw-r--r--tests/unreadable-dir.stderr2
-rw-r--r--yarns/0030-basics.yarn15
-rw-r--r--yarns/9000-implements.yarn5
5 files changed, 20 insertions, 49 deletions
diff --git a/tests/unreadable-dir.exit b/tests/unreadable-dir.exit
deleted file mode 100644
index d00491fd..00000000
--- a/tests/unreadable-dir.exit
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/tests/unreadable-dir.script b/tests/unreadable-dir.script
deleted file mode 100755
index 71fe28aa..00000000
--- a/tests/unreadable-dir.script
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-# Copyright 2011 Lars Wirzenius
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-echo aaa > "$DATADIR/data/aaa"
-mkdir -m 0 "$DATADIR/data/bbb"
-echo ccc > "$DATADIR/data/ccc"
-
-if $SRCDIR/tests/backup
-then
- exit=0
-else
- exit=1
-fi
-$SRCDIR/tests/restore
-
-# Remove the problematic directory so that verify works.
-# Don't do this if running as root, since in that case
-# obnam _can_ back it up. (Yes, this is convoluted.)
-# When removing the directory, make sure the mtime doesn't
-# change of the parent.
-if [ "$(whoami)" != root ]
-then
- touch -r "$DATADIR/data" "$DATADIR/timestamp"
- rmdir "$DATADIR/data/bbb"
- touch -r "$DATADIR/timestamp" "$DATADIR/data"
-fi
-
-$SRCDIR/tests/verify
-
-exit $exit
-
diff --git a/tests/unreadable-dir.stderr b/tests/unreadable-dir.stderr
deleted file mode 100644
index 4c7ac5b7..00000000
--- a/tests/unreadable-dir.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-ERROR: Can't back up TMP/data/bbb: RD5FA4X: System error: TMP/data/bbb: 13: Permission denied
-ERROR: R4C3BCX: There were errors during the backup
diff --git a/yarns/0030-basics.yarn b/yarns/0030-basics.yarn
index 0a04c98b..22ca0f1d 100644
--- a/yarns/0030-basics.yarn
+++ b/yarns/0030-basics.yarn
@@ -141,6 +141,21 @@ Create some live data, and a file that is unreadable.
AND file L/unreadable-file with permissions 000
WHEN user U attempts to back up directory L to repository R
THEN the error message matches "RCE08AX.*L/unreadable-file"
+ WHEN user U attempts to verify L against repository R
+ THEN the attempt succeeded
+
+Next, let's do the same thing again, but with an unreadable directory
+instead of a file.
+
+ SCENARIO unreadable live data directory
+ ASSUMING not running as root
+ GIVEN 1k of new data in directory L
+ AND directory L/unreadable-dir with permissions 000
+ WHEN user U attempts to back up directory L to repository R
+ THEN the error message matches "RD5FA4X.*L/unreadable-dir"
+ WHEN user U attempts to verify L against repository R
+ THEN the attempt succeeded
+
Backup to roots at once
-----------------------
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn
index 26716143..f2dab5f4 100644
--- a/yarns/9000-implements.yarn
+++ b/yarns/9000-implements.yarn
@@ -93,6 +93,11 @@ Create a file with given permissions.
touch "$DATADIR/$MATCH_1"
chmod "$MATCH_2" "$DATADIR/$MATCH_1"
+Create a directory with given permissions.
+
+ IMPLEMENTS GIVEN directory (\S+) with permissions (\S+)
+ install -d -m "$MATCH_2" "$DATADIR/$MATCH_1"
+
We need to manipulate extended attributes.
IMPLEMENTS GIVEN file (\S+) has extended attribute (\S+) set to (\S+)