summaryrefslogtreecommitdiff
path: root/sys/src/cmd/test/patch/patch.rc
blob: 28c222939ae4fb6eb64e52592827d617fe62132e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/rc -e

fn check{
	if(! cmp $1 $2){
		>[2=1] echo fail: $1 $2
		>[2=1] diff -u $1 $2
		exit mismatch
	}
	status=()
}

fn checkpatch{
	rm -f $1.out
	../../$O.patch $1.patch
	check $1.out $1.expected
}

checkpatch basic
checkpatch header
checkpatch create

seq 12 > delete.out
../../$O.patch delete.patch
test ! -f delete.out

rm -f multifile^(1 2)^.out
chmod 640 multifile1.in
chmod 400 multifile2.in
../../$O.patch multifile.patch
check multifile1.out multifile1.expected
check multifile2.out multifile2.expected

if(! ~ `{walk -ex multifile1.out} --rw-r-----)
	exit misperm1
if(! ~ `{walk -ex multifile2.out} --rw-------)
	exit misperm2


status=()