summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-01-25 18:44:57 +0000
committerLars Wirzenius <liw@liw.fi>2014-01-25 18:44:57 +0000
commit99183871095a7cd0b1b588ec27522d0b27aa1723 (patch)
tree6214a6ac214891bc7a5123c04d2c5aa8b9f9eb65
parent45cfbb602d1a5d56e6d701df4786c41c1398586a (diff)
downloadobnam-99183871095a7cd0b1b588ec27522d0b27aa1723.tar.gz
Convert two-roots to a yarn
-rwxr-xr-xtests/two-roots.script44
-rw-r--r--yarns/0030-basics.yarn16
-rw-r--r--yarns/9000-implements.yarn6
3 files changed, 22 insertions, 44 deletions
diff --git a/tests/two-roots.script b/tests/two-roots.script
deleted file mode 100755
index 10417f53..00000000
--- a/tests/two-roots.script
+++ /dev/null
@@ -1,44 +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/>.
-
-# Backup two directoreis at once.
-
-set -e
-
-mkdir "$DATADIR/data2"
-echo foo > "$DATADIR/data2/foo"
-
-# The .../data directory is already specified by the backup script.
-$SRCDIR/tests/backup "$(cat $DATADIR/rooturl)2"
-
-$SRCDIR/tests/restore
-
-# Need to verify manually, since the verify script assumes data only.
-summain -r "$DATADIR/data" "$DATADIR/data2" > "$DATADIR/data.summain"
-summain -r "$DATADIR/restored/$DATADIR/data" \
- "$DATADIR/restored/$DATADIR/data2" > "$DATADIR/restored.summain"
-
-# Timestamps are whole seconds with sftp, so we need to mangle the
-# summain output to remove sub-second timestamps.
-if [ "$OBNAM_TEST_SFTP_ROOT" = yes ]
-then
- sed -i '/^Mtime:/s/\.[[:digit:]]\+ / /' \
- "$DATADIR/data.summain" \
- "$DATADIR/restored.summain"
-fi
-
-diff -u "$DATADIR/data.summain" "$DATADIR/restored.summain"
-
diff --git a/yarns/0030-basics.yarn b/yarns/0030-basics.yarn
index 4a89d64e..a0294484 100644
--- a/yarns/0030-basics.yarn
+++ b/yarns/0030-basics.yarn
@@ -86,6 +86,22 @@ duplication.
AND user U restores their latest generation in repository R into X
THEN L, restored to X, matches manifest M
+Backup to roots at once
+-----------------------
+
+Often it's useful to backup more than one location at once. We'll
+assume that if we can backup two, then it'll all work well.
+
+ SCENARIO backup two roots
+ GIVEN directory L1 with interesting filesystem objects
+ AND directory L2 with interesting filesystem objects
+ AND a manifest of directory L1 in M1
+ AND a manifest of directory L2 in M2
+ WHEN user U backs up directories L1 and L2 to repository R
+ AND user U restores their latest generation in repository R into X
+ THEN L1, restored to X, matches manifest M1
+ THEN L2, restored to X, matches manifest M2
+
Pretend backing up: the `--pretend` setting
-------------------------------------------
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn
index 5ac48997..1d005d77 100644
--- a/yarns/9000-implements.yarn
+++ b/yarns/9000-implements.yarn
@@ -166,6 +166,12 @@ addition to backing up, this makes a manifest of the data.
IMPLEMENTS WHEN user (\S+) backs up directory (\S+) to repository (\S+)
run_obnam "$MATCH_1" backup -r "$DATADIR/$MATCH_3" "$DATADIR/$MATCH_2"
+We may also need to backup two directories at once.
+
+ IMPLEMENTS WHEN user (\S+) backs up directories (\S+) and (\S+) to repository (\S+)
+ run_obnam "$MATCH_1" backup -r "$DATADIR/$MATCH_4" \
+ "$DATADIR/$MATCH_2" "$DATADIR/$MATCH_3"
+
We can also just pretend to make a backup.
IMPLEMENTS WHEN user (\S+) pretends to back up directory (\S+) to repository (\S+)