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