Debian Codegraph @

debian/tests/smoke

raw
1 #!/bin/sh
2 # Smoke test for the desync CLI.
3 #
4 # Chunks a file into a local store, indexes, reconstructs and confirms the round
5 # trip is byte-for-byte identical.
6 set -eu
7
8 WORKDIR="$(mktemp -d)"
9 trap 'rm -rf "$WORKDIR"' EXIT
10 cd "$WORKDIR"
11
12 # The tool should exist and report help output.
13 desync --help
14
15 # Generate a few MB of random input so the rolling-hash chunker produces
16 # several chunks rather than a single one.
17 dd if=/dev/urandom of=original.bin bs=1M count=8 status=none
18
19 mkdir store
20
21 # Chunk the input into the local store and write the index.
22 desync make -s store original.bin.caibx original.bin
23
24 # Show some index metadata as a further sanity check.
25 desync info original.bin.caibx
26
27 # Reconstruct the blob from the index and store.
28 desync extract -s store original.bin.caibx extracted.bin
29
30 cmp original.bin extracted.bin
31 echo "desync smoke test: round trip OK"