xref: /openbsd-src/regress/usr.bin/rsync/test11_middlediff.test (revision 3a0ab0b7dc0bc040bcb641a6f2b0af3eb7aa0dc1)
1*3a0ab0b7Sclaudio#! /bin/sh
2*3a0ab0b7Sclaudio
3*3a0ab0b7Sclaudio. ${tstdir-.}/lib.sh
4*3a0ab0b7Sclaudio. ${tstdir-.}/conf.sh
5*3a0ab0b7Sclaudio
6*3a0ab0b7Sclaudioumask 022
7*3a0ab0b7Sclaudiorm -rf dir1 dir2 dir3
8*3a0ab0b7Sclaudio# make the copy-from-here tree
9*3a0ab0b7Sclaudiomkdir dir1
10*3a0ab0b7Sclaudiocd dir1
11*3a0ab0b7Sclaudiogenerate_tree_1
12*3a0ab0b7Sclaudiorm foo/baz/three.txt
13*3a0ab0b7Sclaudio# make this file again the way we want it.
14*3a0ab0b7Sclaudiodd if=/dev/zero bs=1m count=1 status=none > foo/bar/baz/one.txt
15*3a0ab0b7Sclaudioecho foo >> foo/bar/baz/one.txt
16*3a0ab0b7Sclaudiodd if=/dev/zero bs=1m count=1 status=none >> foo/bar/baz/one.txt
17*3a0ab0b7Sclaudio# make the tree we want to compare to
18*3a0ab0b7Sclaudiomkdir ../dir2
19*3a0ab0b7Sclaudiocd ../dir2
20*3a0ab0b7Sclaudiogenerate_tree_1
21*3a0ab0b7Sclaudiorm foo/baz/three.txt
22*3a0ab0b7Sclaudio# make this file again the way we want it.
23*3a0ab0b7Sclaudiodd if=/dev/zero bs=1m count=1 status=none > foo/bar/baz/one.txt
24*3a0ab0b7Sclaudioecho foo >> foo/bar/baz/one.txt
25*3a0ab0b7Sclaudiodd if=/dev/zero bs=1m count=1 status=none >> foo/bar/baz/one.txt
26*3a0ab0b7Sclaudio
27*3a0ab0b7Sclaudiomkdir ../dir3
28*3a0ab0b7Sclaudiocd ../dir3
29*3a0ab0b7Sclaudiogenerate_tree_1
30*3a0ab0b7Sclaudiorm foo/baz/three.txt
31*3a0ab0b7Sclaudio# make this file different in the middle
32*3a0ab0b7Sclaudiodd if=/dev/zero bs=1m count=1 status=none > foo/bar/baz/one.txt
33*3a0ab0b7Sclaudioecho bar >> foo/bar/baz/one.txt
34*3a0ab0b7Sclaudiodd if=/dev/zero bs=1m count=1 status=none >> foo/bar/baz/one.txt
35*3a0ab0b7Sclaudio
36*3a0ab0b7Sclaudiocd ..
37*3a0ab0b7Sclaudio# openrsync needs the --ignore-times here since it doesn't have
38*3a0ab0b7Sclaudio# a flag to force checksumming.
39*3a0ab0b7Sclaudioecho $rsync -a --ignore-times dir1/ dir3
40*3a0ab0b7Sclaudio$rsync --rsync-path openrsync -a --ignore-times dir1/ dir3
41*3a0ab0b7Sclaudiocompare_trees dir2 dir3
42