[pbs-devel] [PATCH v2 proxmox-backup 5/5] DO NOT MERGE: test script for reference
Robert Obkircher
r.obkircher at proxmox.com
Fri Dec 19 17:18:32 CET 2025
Signed-off-by: Robert Obkircher <r.obkircher at proxmox.com>
---
test-pipes.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100755 test-pipes.sh
diff --git a/test-pipes.sh b/test-pipes.sh
new file mode 100755
index 00000000..f58d0ab4
--- /dev/null
+++ b/test-pipes.sh
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+
+# expects env variables: PBS_REPOSITORY PBS_PASSWORD PBS_FINGERPRINT
+
+# big is a random 524288001 bytes file (not divisible by block size)
+F="${1:-big}"
+du --bytes "$F"
+
+sep() {
+ sleep 2
+ echo
+}
+title() {
+ sep
+ echo "$1"
+ echo
+}
+cmp-restored() {
+ rm -f restored
+ proxmox-backup-client restore "host/$HOSTNAME" "$1" restored
+ cmp --silent restored "$2" || echo "INVALID RESTORED FILE"
+}
+
+# modify the first block to test incremental backups
+M=modified
+cp "$F" "$M"
+printf 'modified' | dd of="$M" bs=1 conv=notrunc
+
+# links to /proc/self/fd/0 which links to something like /dev/pts/2
+title fifo
+cat "$F" | proxmox-backup-client backup fifo.img:/dev/stdin
+cmp-restored "fifo.img" "$F"
+sep
+cat "$M" | proxmox-backup-client backup fifo.img:/dev/stdin
+cmp-restored "fifo.img" "$M"
+
+# note: this version already worked before because it doesn't actually use a pipe
+title redirect
+< "$F" proxmox-backup-client backup redirect.img:/dev/stdin
+cmp-restored "redirect.img" "$F"
+sep
+< "$M" proxmox-backup-client backup redirect.img:/dev/stdin
+cmp-restored "redirect.img" "$M"
+
+# the client aliases - to /dev/stdin
+title catminus
+cat "$F" | proxmox-backup-client backup catminus.img:-
+cmp-restored "catminus.img" "$F"
+sep
+cat "$M" | proxmox-backup-client backup catminus.img:-
+cmp-restored "catminus.img" "$M"
+
+# substitutes something like "/dev/fd/63"
+title psubst
+proxmox-backup-client backup psubst.img:<(cat "$F")
+cmp-restored "psubst.img" "$F"
+sep
+proxmox-backup-client backup psubst.img:<(cat "$M")
+cmp-restored "psubst.img" "$M"
+
+# normal file based backup
+title normal
+proxmox-backup-client backup "normal.img:$F"
+cmp-restored "normal.img" "$F"
+sep
+proxmox-backup-client backup "normal.img:$M"
+cmp-restored "normal.img" "$M"
+
--
2.47.3
More information about the pbs-devel
mailing list