shithub: riscv

ref: bdd385803dcbccdf2750f7259a1784744541dec4
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 multifile^(1 2)^.in.tmp
cp multifile1.in multifile1.in.tmp
cp multifile2.in multifile2.in.tmp
chmod 640 multifile1.in.tmp
chmod 400 multifile2.in.tmp
../../$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=()