chiark / gitweb /
Regression tests for text report output
authorRichard Kettlewell <rjk@greenend.org.uk>
Sat, 17 Aug 2013 17:24:18 +0000 (18:24 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sat, 17 Aug 2013 17:24:31 +0000 (18:24 +0100)
29 files changed:
src/Report.cc
tests/Makefile.am
tests/backup
tests/check-file
tests/expect/1.txt [new file with mode: 0644]
tests/expect/10.txt [new file with mode: 0644]
tests/expect/11.txt [new file with mode: 0644]
tests/expect/12.txt [new file with mode: 0644]
tests/expect/13.txt [new file with mode: 0644]
tests/expect/14.txt [new file with mode: 0644]
tests/expect/15.txt [new file with mode: 0644]
tests/expect/16.txt [new file with mode: 0644]
tests/expect/17.txt [new file with mode: 0644]
tests/expect/18.txt [new file with mode: 0644]
tests/expect/19.txt [new file with mode: 0644]
tests/expect/2.txt [new file with mode: 0644]
tests/expect/20.txt [new file with mode: 0644]
tests/expect/3.txt [new file with mode: 0644]
tests/expect/4.txt [new file with mode: 0644]
tests/expect/5.txt [new file with mode: 0644]
tests/expect/6.txt [new file with mode: 0644]
tests/expect/7.txt [new file with mode: 0644]
tests/expect/8.txt [new file with mode: 0644]
tests/expect/9.txt [new file with mode: 0644]
tests/prune
tests/retire-device
tests/retire-volume
tests/setup.sh
tests/store

index 23a0cd6..53456c2 100644 (file)
@@ -1,4 +1,4 @@
-// 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
@@ -20,6 +20,7 @@
 #include "Regexp.h"
 #include "IO.h"
 #include <cmath>
+#include <cstdlib>
 #include <stdexcept>
 
 // Split up a color into RGB components
@@ -295,9 +296,12 @@ void generateReport(Document &d) {
 
   // 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)));
+  }
 
 }
index 63997df..e321858 100644 (file)
@@ -1,4 +1,4 @@
-# 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
index 88f504a..e0f5800 100755 (executable)
@@ -19,7 +19,7 @@ set -e
 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
@@ -31,9 +31,10 @@ absent dryrun-post.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
@@ -47,26 +48,26 @@ absent store1/host1/volume2
 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
index f816023..0f066d4 100755 (executable)
@@ -20,11 +20,11 @@ setup
 
 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
diff --git a/tests/expect/1.txt b/tests/expect/1.txt
new file mode 100644 (file)
index 0000000..50469fc
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/10.txt b/tests/expect/10.txt
new file mode 100644 (file)
index 0000000..c8c8e2f
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/11.txt b/tests/expect/11.txt
new file mode 100644 (file)
index 0000000..50469fc
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/12.txt b/tests/expect/12.txt
new file mode 100644 (file)
index 0000000..3a7ed47
--- /dev/null
@@ -0,0 +1,19 @@
+==== 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>
diff --git a/tests/expect/13.txt b/tests/expect/13.txt
new file mode 100644 (file)
index 0000000..ac18460
--- /dev/null
@@ -0,0 +1,15 @@
+==== 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>
diff --git a/tests/expect/14.txt b/tests/expect/14.txt
new file mode 100644 (file)
index 0000000..773d892
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/15.txt b/tests/expect/15.txt
new file mode 100644 (file)
index 0000000..66e520c
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/16.txt b/tests/expect/16.txt
new file mode 100644 (file)
index 0000000..03199ee
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/17.txt b/tests/expect/17.txt
new file mode 100644 (file)
index 0000000..898205a
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/18.txt b/tests/expect/18.txt
new file mode 100644 (file)
index 0000000..8cac341
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/19.txt b/tests/expect/19.txt
new file mode 100644 (file)
index 0000000..98d3566
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/2.txt b/tests/expect/2.txt
new file mode 100644 (file)
index 0000000..458c1e6
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/20.txt b/tests/expect/20.txt
new file mode 100644 (file)
index 0000000..27cfac5
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/3.txt b/tests/expect/3.txt
new file mode 100644 (file)
index 0000000..15c2144
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/4.txt b/tests/expect/4.txt
new file mode 100644 (file)
index 0000000..4bd0a7b
--- /dev/null
@@ -0,0 +1,19 @@
+==== 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>
diff --git a/tests/expect/5.txt b/tests/expect/5.txt
new file mode 100644 (file)
index 0000000..3279474
--- /dev/null
@@ -0,0 +1,19 @@
+==== 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>
diff --git a/tests/expect/6.txt b/tests/expect/6.txt
new file mode 100644 (file)
index 0000000..04ef8b1
--- /dev/null
@@ -0,0 +1,19 @@
+==== 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>
diff --git a/tests/expect/7.txt b/tests/expect/7.txt
new file mode 100644 (file)
index 0000000..55ac96d
--- /dev/null
@@ -0,0 +1,22 @@
+==== 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>
diff --git a/tests/expect/8.txt b/tests/expect/8.txt
new file mode 100644 (file)
index 0000000..50469fc
--- /dev/null
@@ -0,0 +1,16 @@
+==== 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>
diff --git a/tests/expect/9.txt b/tests/expect/9.txt
new file mode 100644 (file)
index 0000000..a602236
--- /dev/null
@@ -0,0 +1,20 @@
+==== 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>
index 277de6b..c9e6aa8 100755 (executable)
@@ -21,12 +21,13 @@ setup
 ## 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
@@ -35,16 +36,18 @@ absent null-dev-pre.acted
 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
@@ -55,9 +58,10 @@ compare volume1 store1/host1/volume1/1980-01-01
 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
@@ -68,13 +72,15 @@ absent store1/host1/volume1/1980-01-01
 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
@@ -84,9 +90,11 @@ compare volume1 store1/host1/volume1/1980-01-02
 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
@@ -97,9 +105,11 @@ compare volume1 store1/host1/volume1/1980-01-02
 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
@@ -110,5 +120,7 @@ compare volume1 store1/host1/volume1/1980-01-02
 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
index 5ac4580..32bf521 100755 (executable)
@@ -19,7 +19,7 @@ set -e
 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
@@ -30,13 +30,14 @@ exists store1/host1/volume1/1980-01-01
 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
@@ -45,9 +46,10 @@ exists store1/host1/volume1/1980-01-01
 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
@@ -56,5 +58,6 @@ exists store1/host1/volume1/1980-01-01
 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
index bf59511..513d3f4 100755 (executable)
@@ -19,7 +19,7 @@ set -e
 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
@@ -30,13 +30,14 @@ exists store1/host1/volume1/1980-01-01
 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
@@ -49,9 +50,10 @@ exists store1/host1/volume1/1980-01-01
 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
@@ -64,5 +66,6 @@ exists store1/host1/volume1/1980-01-01
 absent store1/host1/volume2
 exists store2/host1/volume1/1980-01-01
 absent store2/host1/volume2
+compare ${srcdir:-.}/expect/13.txt got/13.txt
 
 cleanup
index f62c8ff..f506ef3 100644 (file)
@@ -68,6 +68,8 @@ setup() {
   echo six > volume3/file6
 
   rm -f hookdata
+
+  mkdir -p got
 }
 
 cleanup() {
@@ -79,6 +81,7 @@ cleanup() {
   rm -f diffs
   rm -f *.ran
   rm -f *.acted
+  rm -rf got
 }
 
 compare() {
index 3d598cf..48e92ad 100755 (executable)
@@ -21,7 +21,7 @@ setup
 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
@@ -30,5 +30,6 @@ absent store1/host1/volume1
 absent store1/host1/volume2
 absent store2/host1/volume1
 absent store2/host1/volume2
+compare ${srcdir:-.}/expect/14.txt got/14.txt
 
 cleanup