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