shithub: riscv

ref: c1d40df49550393f3afe53fb6e6d500dfa8eb7a8
dir: /sys/src/cmd/test/patch/patch.rc/

View raw version
#!/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=()