ref: c69d458eccd4f93752e6d8daf06d0f00831d1a83
parent: 4705576f844f536cdf46d581d4d1ad8776aaa4e9
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Nov 11 11:28:22 EST 2023
patch: delete files for tests before test run we shouldn't mutate the stae of checked in files in place in tests
--- a/sys/src/cmd/test/patch/mkfile
+++ b/sys/src/cmd/test/patch/mkfile
@@ -2,4 +2,8 @@
TEST=patch
+CLEANFILES=\
+ multifile.1.in.tmp\
+ multifile.2.in.tmp\
+
</sys/src/cmd/mktest
--- a/sys/src/cmd/test/patch/multifile.patch
+++ b/sys/src/cmd/test/patch/multifile.patch
@@ -1,4 +1,4 @@
---- multifile2.in
+--- multifile2.in.tmp
+++ multifile2.out
@@ -1,21 +1,19 @@
-77777
@@ -31,7 +31,7 @@
of course, each patch can have its own comment
lines mixed in, so we should handle these.
---- multifile1.in
+--- multifile1.in.tmp
+++ multifile1.out
@@ -14,16 +14,6 @@
12
--- a/sys/src/cmd/test/patch/patch.rc
+++ b/sys/src/cmd/test/patch/patch.rc
@@ -23,9 +23,11 @@
../../$O.patch delete.patch
test ! -f delete.out
-rm -f multifile^(1 2)^.out
-chmod 640 multifile1.in
-chmod 400 multifile2.in
+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
@@ -34,6 +36,4 @@
exit misperm1
if(! ~ `{walk -ex multifile2.out} --rw-------)
exit misperm2
-
-
status=()