-// Copyright © 2011, 2012 Richard Kettlewell.
+// Copyright © 2011-2013 Richard Kettlewell.
//
// 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
#include "Regexp.h"
#include "IO.h"
#include <cmath>
+#include <cstdlib>
#include <stdexcept>
// Split up a color into RGB components
// Generation time ----------------------------------------------------------
Document::Paragraph *p = d.para("Generated ");
- time_t now;
- time(&now);
- p->append(new Document::String(ctime(&now)));
-
+ if(getenv("RSBACKUP_TODAY"))
+ p->append(new Document::String("<timestamp>"));
+ else {
+ time_t now;
+ time(&now);
+ p->append(new Document::String(ctime(&now)));
+ }
}
-# Copyright © 2011, 2012 Richard Kettlewell.
+# Copyright © 2011-2013 Richard Kettlewell.
#
# 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
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
TESTS=backup prune retire-device retire-volume store check-file
-EXTRA_DIST=${TESTS} setup.sh hook
+EXTRA_DIST=${TESTS} setup.sh hook \
+ expect/10.txt expect/11.txt expect/12.txt expect/13.txt \
+ expect/14.txt expect/15.txt expect/16.txt expect/17.txt \
+ expect/18.txt expect/19.txt expect/1.txt expect/20.txt \
+ expect/2.txt expect/3.txt expect/4.txt expect/5.txt \
+ expect/6.txt expect/7.txt expect/8.txt expect/9.txt
TESTS_ENVIRONMENT=bash
setup
echo "| --dry-run should do nothing"
-RUN=dryrun RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --dry-run --backup host1:volume1
+RUN=dryrun RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --dry-run --backup --text got/15.txt host1:volume1
exists dryrun-dev-pre.ran
exists dryrun-dev-post.ran
absent dryrun-dev-pre.acted
absent store1/host1/volume1/1980-01-01
absent store1/host1/volume2
absent store2/host1
+compare ${srcdir:-.}/expect/15.txt got/15.txt
echo "| Create backup for one volume"
-RUN=volume1 RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --backup host1:volume1
+RUN=volume1 RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --backup --text got/16.txt host1:volume1
exists volume1-dev-pre.ran
exists volume1-dev-post.ran
exists volume1-dev-pre.ran
absent store1/host1/volume3
absent store2/host1/volume2
absent store2/host1/volume3
-s ${RSBACKUP} -T -
+compare ${srcdir:-.}/expect/16.txt got/16.txt
echo "| Create backup for one host"
-RUN=host1 RSBACKUP_TODAY=1980-01-02 s ${RSBACKUP} --backup host1
+RUN=host1 RSBACKUP_TODAY=1980-01-02 s ${RSBACKUP} --backup --text got/17.txt host1
exists host1-pre.acted
exists host1-post.acted
compare volume1 store1/host1/volume1/1980-01-02
compare volume2 store1/host1/volume2/1980-01-02
absent store1/host1/volume3
compare volume3 store2/host1/volume3/1980-01-02
-s ${RSBACKUP} -T -
+compare ${srcdir:-.}/expect/17.txt got/17.txt
echo "| Create backup for everything"
-RUN=all RSBACKUP_TODAY=1980-01-03 s ${RSBACKUP} --backup
+RUN=all RSBACKUP_TODAY=1980-01-03 s ${RSBACKUP} --backup --text got/18.txt
exists all-pre.acted
exists all-post.acted
compare volume1 store1/host1/volume1/1980-01-03
compare volume2 store1/host1/volume2/1980-01-03
absent store1/host1/volume3
compare volume3 store2/host1/volume3/1980-01-03
-s ${RSBACKUP} -T -
+compare ${srcdir:-.}/expect/18.txt got/18.txt
cleanup
echo "| Backup is skipped if check-file missing"
rm -f volume1/file1
-RSBACKUP_TODAY=1980-01-03 s ${RSBACKUP} --backup --verbose
+RSBACKUP_TODAY=1980-01-03 s ${RSBACKUP} --backup --verbose --text got/19.txt
absent store1/host1/volume1
compare volume2 store1/host1/volume2/1980-01-03
absent store1/host1/volume3
compare volume3 store2/host1/volume3/1980-01-03
-s ${RSBACKUP} -T -
+compare ${srcdir:-.}/expect/19.txt got/19.txt
cleanup
--- /dev/null
+==== Backup report (1980-01-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume2 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume3 | 1980-01-01 | 1 | none | 0 | 1980-01-01 | 1 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 |
+| | | | | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume3 | none | 0 | none | 0 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume2 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume3 | 1980-01-01 | 1 | none | 0 | 1980-01-01 | 1 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-01) ====
+
+=== Warnings ===
+
+ * Unknown volume volume2 on host host1
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume3 | 1980-01-01 | 1 | none | 0 | 1980-01-01 | 1 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume3 | 1980-01-01 | 1 | none | 0 | 1980-01-01 | 1 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 1 | 1980-01-01 | 1 | none | 0 |
+| | volume2 | 1980-01-01 | 1 | 1980-01-01 | 1 | none | 0 |
+| | volume3 | none | 0 | none | 0 | none | 0 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | none | 0 | none | 0 | none | 0 |
+| | volume2 | none | 0 | none | 0 | none | 0 |
+| | volume3 | none | 0 | none | 0 | none | 0 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume2 | none | 0 | none | 0 | none | 0 |
+| | volume3 | none | 0 | none | 0 | none | 0 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-02) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 4 | 1980-01-02 | 2 | 1980-01-02 | 2 |
+| | volume2 | 1980-01-02 | 2 | 1980-01-02 | 1 | 1980-01-02 | 1 |
+| | volume3 | 1980-01-02 | 1 | none | 0 | 1980-01-02 | 1 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-03) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 6 | 1980-01-03 | 3 | 1980-01-03 | 3 |
+| | volume2 | 1980-01-02 | 4 | 1980-01-03 | 2 | 1980-01-03 | 2 |
+| | volume3 | 1980-01-02 | 2 | none | 0 | 1980-01-03 | 2 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-03) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | none | 0 | none | 0 | none | 0 |
+| | volume2 | 1980-01-03 | 2 | 1980-01-03 | 1 | 1980-01-03 | 1 |
+| | volume3 | 1980-01-03 | 1 | none | 0 | 1980-01-03 | 1 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-02-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume2 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume3 | 1980-01-01 | 1 | none | 0 | 1980-01-01 | 1 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-02) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 4 | 1980-01-02 | 2 | 1980-01-02 | 2 |
+| | volume2 | 1980-01-01 | 4 | 1980-01-02 | 2 | 1980-01-02 | 2 |
+| | volume3 | 1980-01-01 | 2 | none | 0 | 1980-01-02 | 2 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-02-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 4 | 1980-01-02 | 2 | 1980-01-02 | 2 |
+| | volume2 | 1980-01-01 | 4 | 1980-01-02 | 2 | 1980-01-02 | 2 |
+| | volume3 | 1980-01-01 | 2 | none | 0 | 1980-01-02 | 2 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-02-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-02 | 2 | 1980-01-02 | 1 | 1980-01-02 | 1 |
+| | volume2 | 1980-01-01 | 4 | 1980-01-02 | 2 | 1980-01-02 | 2 |
+| | volume3 | 1980-01-01 | 2 | none | 0 | 1980-01-02 | 2 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+1980-02-01: removed <SRCDIR>/store1/host1/volume1/1980-01-01 because: age 31 = today 1980-02-01 - backup date 1980-01-01 > minimum 2 and copies 2 - removable 0 > minimum 1
+1980-02-01: removed <SRCDIR>/store2/host1/volume1/1980-01-01 because: age 31 = today 1980-02-01 - backup date 1980-01-01 > minimum 2 and copies 2 - removable 0 > minimum 1
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-03) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-02 | 4 | 1980-01-03 | 2 | 1980-01-03 | 2 |
+| | volume2 | 1980-01-01 | 6 | 1980-01-03 | 3 | 1980-01-03 | 3 |
+| | volume3 | 1980-01-01 | 3 | none | 0 | 1980-01-03 | 3 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+1980-02-01: removed <SRCDIR>/store1/host1/volume1/1980-01-01 because: age 31 = today 1980-02-01 - backup date 1980-01-01 > minimum 2 and copies 2 - removable 0 > minimum 1
+1980-02-01: removed <SRCDIR>/store2/host1/volume1/1980-01-01 because: age 31 = today 1980-02-01 - backup date 1980-01-01 > minimum 2 and copies 2 - removable 0 > minimum 1
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-04) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-02 | 4 | 1980-01-03 | 2 | 1980-01-03 | 2 |
+| | volume2 | 1980-01-01 | 6 | 1980-01-03 | 3 | 1980-01-03 | 3 |
+| | volume3 | 1980-01-01 | 3 | none | 0 | 1980-01-03 | 3 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+1980-02-01: removed <SRCDIR>/store1/host1/volume1/1980-01-01 because: age 31 = today 1980-02-01 - backup date 1980-01-01 > minimum 2 and copies 2 - removable 0 > minimum 1
+1980-02-01: removed <SRCDIR>/store2/host1/volume1/1980-01-01 because: age 31 = today 1980-02-01 - backup date 1980-01-01 > minimum 2 and copies 2 - removable 0 > minimum 1
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-04) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-02 | 4 | 1980-01-03 | 2 | 1980-01-03 | 2 |
+| | volume2 | 1980-01-02 | 4 | 1980-01-03 | 2 | 1980-01-03 | 2 |
+| | volume3 | 1980-01-01 | 3 | none | 0 | 1980-01-03 | 3 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+1980-02-01: removed <SRCDIR>/store1/host1/volume1/1980-01-01 because: age 31 = today 1980-02-01 - backup date 1980-01-01 > minimum 2 and copies 2 - removable 0 > minimum 1
+1980-02-01: removed <SRCDIR>/store2/host1/volume1/1980-01-01 because: age 31 = today 1980-02-01 - backup date 1980-01-01 > minimum 2 and copies 2 - removable 0 > minimum 1
+
+1980-01-04: removed <SRCDIR>/store1/host1/volume2/1980-01-01 because: age 3 = today 1980-01-04 - backup date 1980-01-01 > minimum 2 and copies 3 - removable 0 > minimum 2
+1980-01-04: removed <SRCDIR>/store2/host1/volume2/1980-01-01 because: age 3 = today 1980-01-04 - backup date 1980-01-01 > minimum 2 and copies 3 - removable 0 > minimum 2
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-01) ====
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 | device2 |
+| | | | | Newest | Count | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume2 | 1980-01-01 | 2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume3 | 1980-01-01 | 1 | none | 0 | 1980-01-01 | 1 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
--- /dev/null
+==== Backup report (1980-01-01) ====
+
+=== Warnings ===
+
+ * Unknown device device2
+
+=== Summary ===
+
+| Host | Volume | Oldest | Total | Devices |
+| | | | | device1 |
+| | | | | Newest | Count|
+| host1 | volume1 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume2 | 1980-01-01 | 1 | 1980-01-01 | 1 |
+| | volume3 | none | 0 | none | 0 |
+
+=== Logfiles ===
+
+== Pruning logs ==
+
+Generated <timestamp>
## Check that min-backups is honored correctly
echo "| Create backup"
-RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --backup
+RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --backup --text got/1.txt
compare volume1 store1/host1/volume1/1980-01-01
compare volume2 store1/host1/volume2/1980-01-01
+compare ${srcdir:-.}/expect/1.txt got/1.txt
echo "| Null prune"
-RUN=null RSBACKUP_TODAY=1980-02-01 s ${RSBACKUP} --prune
+RUN=null RSBACKUP_TODAY=1980-02-01 s ${RSBACKUP} --prune --text got/2.txt
absent null-pre.ran
absent null-pos.ran
absent null-dev-pre.ran
absent null-dev-post.acted
compare volume1 store1/host1/volume1/1980-01-01
compare volume2 store1/host1/volume2/1980-01-01
+compare ${srcdir:-.}/expect/2.txt got/2.txt
echo "| Create second backup"
-RSBACKUP_TODAY=1980-01-02 s ${RSBACKUP} --backup
+RSBACKUP_TODAY=1980-01-02 s ${RSBACKUP} --backup --text got/20.txt
# volume1: 1980-01-01 1980-01-02
# volume2: 1980-01-01 1980-01-02
compare volume1 store1/host1/volume1/1980-01-02
compare volume2 store1/host1/volume2/1980-01-02
+compare ${srcdir:-.}/expect/20.txt got/20.txt
echo "| --dry-run should do nothing"
-RUN=dryrun RSBACKUP_TODAY=1980-02-01 s ${RSBACKUP} --prune --dry-run
+RUN=dryrun RSBACKUP_TODAY=1980-02-01 s ${RSBACKUP} --prune --dry-run --text got/3.txt
absent dryrun-pre.ran
absent dryrun-post.ran
exists dryrun-dev-pre.ran
compare volume2 store1/host1/volume2/1980-01-01
compare volume1 store1/host1/volume1/1980-01-02
compare volume2 store1/host1/volume2/1980-01-02
+compare ${srcdir:-.}/expect/3.txt got/3.txt
echo "| Prune affecting volume1"
-RUN=prune1 RSBACKUP_TODAY=1980-02-01 s ${RSBACKUP} --prune
+RUN=prune1 RSBACKUP_TODAY=1980-02-01 s ${RSBACKUP} --prune --text got/4.txt
absent prune1-pre.ran
absent prune1-post.ran
exists prune1-dev-pre.ran
compare volume2 store1/host1/volume2/1980-01-01
compare volume1 store1/host1/volume1/1980-01-02
compare volume2 store1/host1/volume2/1980-01-02
+sed < got/4.txt > got/4sed.txt "s,${PWD},<SRCDIR>,g"
+compare ${srcdir:-.}/expect/4.txt got/4sed.txt
# volume1: 1980-01-02
# volume2: 1980-01-01 1980-01-02
## Check that prune-age is honored correctly
echo "| Create third backup"
-RSBACKUP_TODAY=1980-01-03 s ${RSBACKUP} --backup
+RSBACKUP_TODAY=1980-01-03 s ${RSBACKUP} --backup --text got/5.txt
# volume1: 1980-01-02 1980-01-03
# volume2: 1980-01-01 1980-01-02 1980-01-03
RSBACKUP_TODAY=1980-01-03 s ${RSBACKUP} --prune
compare volume2 store1/host1/volume2/1980-01-02
compare volume1 store1/host1/volume1/1980-01-03
compare volume2 store1/host1/volume2/1980-01-03
+sed < got/5.txt > got/5sed.txt "s,${PWD},<SRCDIR>,g"
+compare ${srcdir:-.}/expect/5.txt got/5sed.txt
echo "| Prune affecting unselected volume"
-RUN=prune2 RSBACKUP_TODAY=1980-01-04 s ${RSBACKUP} --prune host1:volume1
+RUN=prune2 RSBACKUP_TODAY=1980-01-04 s ${RSBACKUP} --prune --text got/6.txt host1:volume1
absent store1/host1/volume1/1980-01-01
absent prune2-dev-pre.ran
absent prune2-dev-post.ran
compare volume2 store1/host1/volume2/1980-01-02
compare volume1 store1/host1/volume1/1980-01-03
compare volume2 store1/host1/volume2/1980-01-03
+sed < got/6.txt > got/6sed.txt "s,${PWD},<SRCDIR>,g"
+compare ${srcdir:-.}/expect/6.txt got/6sed.txt
echo "| Prune affecting volume2"
-RUN=prune3 RSBACKUP_TODAY=1980-01-04 s ${RSBACKUP} --prune host1:volume2
+RUN=prune3 RSBACKUP_TODAY=1980-01-04 s ${RSBACKUP} --prune --text got/7.txt host1:volume2
absent store1/host1/volume1/1980-01-01
absent store1/host1/volume2/1980-01-01
exists prune3-dev-pre.ran
compare volume2 store1/host1/volume2/1980-01-02
compare volume1 store1/host1/volume1/1980-01-03
compare volume2 store1/host1/volume2/1980-01-03
+sed < got/7.txt > got/7sed.txt "s,${PWD},<SRCDIR>,g"
+compare ${srcdir:-.}/expect/7.txt got/7sed.txt
cleanup
setup
echo "| Create backup"
-RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --backup
+RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --backup --text got/8.txt
# volume1: 1980-01-01
# volume2: 1980-01-01
exists logs/1980-01-01-device1-host1-volume1.log
exists store1/host1/volume2/1980-01-01
exists store2/host1/volume1/1980-01-01
exists store2/host1/volume2/1980-01-01
+compare ${srcdir:-.}/expect/8.txt got/8.txt
echo "| Edit config"
sed < config > config.new 's/^device device2//'
mv config.new config
echo "| --dry-run should do nothing"
-s ${RSBACKUP} --retire-device --dry-run device2
+RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --retire-device --dry-run --text got/9.txt device2
exists logs/1980-01-01-device1-host1-volume1.log
exists logs/1980-01-01-device1-host1-volume2.log
exists logs/1980-01-01-device2-host1-volume1.log
exists store1/host1/volume2/1980-01-01
exists store2/host1/volume1/1980-01-01
exists store2/host1/volume2/1980-01-01
+compare ${srcdir:-.}/expect/9.txt got/9.txt
echo "| Retire device2"
-s ${RSBACKUP} --retire-device device2
+RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --retire-device --text got/10.txt device2
exists logs/1980-01-01-device1-host1-volume1.log
exists logs/1980-01-01-device1-host1-volume2.log
absent logs/1980-01-01-device2-host1-volume1.log
exists store1/host1/volume2/1980-01-01
exists store2/host1/volume1/1980-01-01
exists store2/host1/volume2/1980-01-01
+compare ${srcdir:-.}/expect/10.txt got/10.txt
cleanup
setup
echo "| Create backup"
-RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --backup
+RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --backup --text got/11.txt
# volume1: 1980-01-01
# volume2: 1980-01-01
exists logs/1980-01-01-device1-host1-volume1.log
exists store1/host1/volume2/1980-01-01
exists store2/host1/volume1/1980-01-01
exists store2/host1/volume1/1980-01-01
+compare ${srcdir:-.}/expect/11.txt got/11.txt
echo "| Edit config"
sed < config > config.new 's/^ *volume volume2.*//;s/^ *min-backups 2//'
mv config.new config
echo "| --dry-run should do nothing"
-RUN=dryrun s ${RSBACKUP} --retire --dry-run host1:volume2
+RSBACKUP_TODAY=1980-01-01 RUN=dryrun s ${RSBACKUP} --retire --dry-run --text got/12.txt host1:volume2
exists dryrun-dev-pre.ran
exists dryrun-dev-post.ran
absent dryrun-dev-pre.acted
exists store1/host1/volume2/1980-01-01
exists store2/host1/volume1/1980-01-01
exists store2/host1/volume1/1980-01-01
+compare ${srcdir:-.}/expect/12.txt got/12.txt
echo "| Retire volume2"
-RUN=retire s ${RSBACKUP} --verbose --retire host1:volume2
+RSBACKUP_TODAY=1980-01-01 RUN=retire s ${RSBACKUP} --verbose --retire --text got/13.txt host1:volume2
exists retire-dev-pre.ran
exists retire-dev-post.ran
exists retire-dev-pre.acted
absent store1/host1/volume2
exists store2/host1/volume1/1980-01-01
absent store2/host1/volume2
+compare ${srcdir:-.}/expect/13.txt got/13.txt
cleanup
echo six > volume3/file6
rm -f hookdata
+
+ mkdir -p got
}
cleanup() {
rm -f diffs
rm -f *.ran
rm -f *.acted
+ rm -rf got
}
compare() {
mv store1 store3
echo "| Create backup with overridden store"
-RUN=store RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --backup --store `pwd`/store3
+RUN=store RSBACKUP_TODAY=1980-01-01 s ${RSBACKUP} --backup --store `pwd`/store3 --text got/14.txt
exists store-pre.ran
exists store-post.ran
compare volume1 store3/host1/volume1/1980-01-01
absent store1/host1/volume2
absent store2/host1/volume1
absent store2/host1/volume2
+compare ${srcdir:-.}/expect/14.txt got/14.txt
cleanup