On 2025/01/12 17:18, Klemens Nanni wrote:
> There are tests and they pass except for some xattr stuff (chflags(1) for 
> Linux)
> and some basic stuff like reading from stdin (worth looking into).
> 
> One test runs 'python -c ...', hence the module.
> 
> Either I'm holding it wrong or that one google/go-cmp module comes with bad
> permissions which need amending to allow _pbuild to remove everything 
> afterwards.
> 
> Thoughts?

AFAICT the Python module is doing nothing here. The stdin-related tests
that are failing are due to trying to run python (not python3). I
think a simple TEST_DEPENDS and symlinking the binary would be better,
go.port.mk is hairy enough I'd rather not pull in more modules unless
really necessary.

(Perhaps we should add /usr/local/bin/python to lang/python/3 ...)

The missing +w are because build.go is compiling without using
MODGO_FLAGS (which normally includes -modcacherw, to fix exactly this,
and which also set -p=${MAKE_JOBS} to avoid running on all cores as done
by default by go). I guess go-cmp is _only_ used in the tests so not
compiled normally.

Compared to your diff, this fixes the failures in tests using python -c, 
and runs "go test" directly, with flags, rather than via build.go.
Exclude our default -v which is quite noisy in these tests.
"make clean" now works.

Had we not been able to do this, FIX_CLEANUP_PERMISSIONS would be the
simpler way to fix permissions.

ok?

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/restic/Makefile,v
diff -u -p -r1.44 Makefile
--- Makefile    11 Nov 2024 09:36:33 -0000      1.44
+++ Makefile    13 Jan 2025 11:04:56 -0000
@@ -17,7 +17,15 @@ PERMIT_PACKAGE=      Yes
 WANTLIB += c pthread
 
 MODULES=       lang/go
-NO_TEST=       Yes
+TEST_DEPENDS=  lang/python/3
+
+# allow cleanup after test, which runs the go compiler without the correct
+# flags so -modcacherw (and -p=${MAKE_JOBS} are lost.
+#FIX_CLEANUP_PERMISSIONS= Yes
+
+do-test:
+       ln -fs ${LOCALBASE}/bin/python3 ${WRKDIR}/bin/python
+       cd ${WRKSRC}; ${SRTENV} ${MAKE_ENV} ${MODGO_CMD} test 
${MODGO_FLAGS:N-v} -count 1 ./...
 
 do-install:
        ${MODGO_INSTALL_TARGET}

Reply via email to