summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@datawire.io>2022-08-14 20:52:06 -0600
committerLuke Shumaker <lukeshu@datawire.io>2022-08-15 10:14:02 -0600
commit2ae2ebe2a5ac712db6f9221cb1ad8cfa76aad180 (patch)
tree8bf8b651affc35394af9af02c66119b21fbe6993 /Makefile
parent801fdb54ba1bb14433fad810c832a5df530f0a25 (diff)
Makefile: Add tools for diffing borrowed files against upstream
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 23 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index d825ce9..652906d 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,8 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
+SHELL = bash
+
# main
check:
@@ -50,3 +52,24 @@ go-mod-tidy/tools/%: tools/src/%/go.mod
rm -f tools/src/$*/go.sum
cd tools/src/$* && go mod tidy -go $(goversion) -compat $(goversion)
.PHONY: go-mod-tidy/tools/%
+
+# utilities for managing borrowed tests
+
+borrowed.patch: stock patched
+ diff -ru $^ > $@ || true
+stock: FORCE
+ rm -rf $@ $@.tmp
+ mkdir $@.tmp
+ echo module ignore > $@.tmp/go.mod
+ set -e; for file in "$$(go env GOROOT)"/src/encoding/json/{*_test.go,tags.go}; do \
+ cp "$$file" $@.tmp/borrowed_$${file##*/}; \
+ done
+ mv $@.tmp $@
+patched: FORCE
+ rm -rf $@ $@.tmp
+ mkdir $@.tmp
+ echo module ignore > $@.tmp/go.mod
+ cp $$(git ls-files :*/borrowed_*.go :borrowed_*.go :!borrowed_misc.go :!*/borrowed_misc.go) $@.tmp
+ mv $@.tmp $@
+
+.PHONY: FORCE