From 38e9c2a327865da6134fd3ecc45f8cd025eca3c3 Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 9 Jul 2025 05:04:35 +0000 Subject: libcrypto regress: move GOCACHE to obj/ While it may be acceptable for Go to fill regular users' homedirs with a compiler cache that is unable to deal with corruption and full disks, this is terrible for people running regress as root since the cache can quickly grow to hundreds of megs and can thus result in all sorts hilarity below /root. Move the GOCACHE under ${.OBJDIR} and use a cleanup target to get rid of it again. This makes these tests a bit slower for regular users as well, but so be it. Let's see how this goes before I switch libtls to the same model. discussed with claudio and jsing --- src/regress/lib/libcrypto/c2sp/Makefile | 11 +++++++++-- src/regress/lib/libcrypto/certs/Makefile | 19 +++++++++++-------- src/regress/lib/libcrypto/wycheproof/Makefile | 10 ++++++++-- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/regress/lib/libcrypto/c2sp/Makefile b/src/regress/lib/libcrypto/c2sp/Makefile index d16d06975b..062d83e99c 100644 --- a/src/regress/lib/libcrypto/c2sp/Makefile +++ b/src/regress/lib/libcrypto/c2sp/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2025/04/27 08:51:24 tb Exp $ +# $OpenBSD: Makefile,v 1.6 2025/07/09 05:04:35 tb Exp $ C2SP_TESTVECTORS = /usr/local/share/c2sp-testvectors/ @@ -13,7 +13,7 @@ PROGS += cctv SRCS_cctv = cctv: cctv.go - go build -o $@ ${.CURDIR}/cctv.go + env GOCACHE=${.OBJDIR}/go-build go build -o $@ ${.CURDIR}/cctv.go OSSL_LIB = /usr/local/lib/eopenssl OSSL_INC = /usr/local/include/eopenssl @@ -29,10 +29,17 @@ CGO_LDFLAGS_$V += -L${OSSL_LIB}$V cctv-openssl$V: cctv.go env CGO_CFLAGS="${CGO_CFLAGS_$V}" CGO_LDFLAGS="${CGO_LDFLAGS_$V}" \ + GOCACHE=${.OBJDIR}/go-build \ go build -o $@ ${.CURDIR}/cctv.go . endif . endfor +REGRESS_CLEANUP = clean-go-cache + +clean-go-cache: + env GOCACHE=${.OBJDIR}/go-build go clean -cache + rm -rf ${.OBJDIR}/go-build + .endif .include diff --git a/src/regress/lib/libcrypto/certs/Makefile b/src/regress/lib/libcrypto/certs/Makefile index 621c60907f..f7ba9fcad8 100644 --- a/src/regress/lib/libcrypto/certs/Makefile +++ b/src/regress/lib/libcrypto/certs/Makefile @@ -1,21 +1,24 @@ -# $OpenBSD: Makefile,v 1.1 2020/07/14 18:27:28 jsing Exp $ +# $OpenBSD: Makefile,v 1.2 2025/07/09 05:04:35 tb Exp $ -.if ! (make(clean) || make(cleandir) || make(obj)) -GO_VERSION != sh -c "(go version) 2>/dev/null || true" -.endif - -.if empty(GO_VERSION) +.if !exists(/usr/local/bin/go) regress: @echo package go is required for this regress @echo SKIPPED -.endif +.else REGRESS_TARGETS=regress-go-verify +REGRESS_CLEANUP=clean-go-cache certs: cd ${.CURDIR} && sh ./make-certs.sh regress-go-verify: - cd ${.CURDIR} && go test -test.v . + cd ${.CURDIR} && env GOCACHE=${.OBJDIR}/go-build go test -test.v . + +clean-go-cache: + env GOCACHE=${.OBJDIR}/go-build go clean -cache + rm -rf ${.OBJDIR}/go-build + +.endif .include diff --git a/src/regress/lib/libcrypto/wycheproof/Makefile b/src/regress/lib/libcrypto/wycheproof/Makefile index f2f7910b5b..a68a270580 100644 --- a/src/regress/lib/libcrypto/wycheproof/Makefile +++ b/src/regress/lib/libcrypto/wycheproof/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.9 2023/07/08 19:41:07 tb Exp $ +# $OpenBSD: Makefile,v 1.10 2025/07/09 05:04:35 tb Exp $ WYCHEPROOF_TESTVECTORS = /usr/local/share/wycheproof/testvectors/ @@ -18,11 +18,17 @@ REGRESS_TARGETS += regress-wycheproof CLEANFILES += wycheproof wycheproof: wycheproof.go - go build -o wycheproof ${.CURDIR}/wycheproof.go + env GOCACHE=${.OBJDIR}/go-build go build -o wycheproof ${.CURDIR}/wycheproof.go regress-wycheproof: wycheproof ./wycheproof +REGRESS_CLEANUP = clean-go-cache + +clean-go-cache: + env GOCACHE=${.OBJDIR}/go-build go clean -cache + rm -rf ${.OBJDIR}/go-build + . endif PROGS += wycheproof-primes -- cgit v1.2.3-55-g6feb