shithub: riscv

ref: fe1eb39db7ae6904924f3ab1f6f9b34416f2eb1b
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=()