I noticed two problems with go's 'make test' when PORTS_PRIVSEP=Yes:
both having to do with _pbuild's home being /nonexistent:

failed to initialize build cache at /nonexistent/.cache/go-build: mkdir 
/nonexistent: permission denied

and

--- FAIL: TestUserHomeDir (0.00s)
    os_test.go:2350: stat /nonexistent: no such file or directory
    FAIL

both problems can be worked around by setting the GOCACHE and HOME
environment variables to something different than /nonexistent.

Since do-build alreday sets GOCACHE=${WRKDIST}/go-cache, it seems
reasonable to do the same for do-test independently of PORTS_PRIVSEP.

I'm less sure about the proper solution for TestHomeDir and would like
to have some advice on that.  Setting HOME to ${WRKDIST} or a temporary
directory works and is in line with the custom PATH, but seems very
kludgy and might have undesirable side effects for other tests in the
future. One could patch the TestHomeDir test to skip the Stat and IsDir
part if the user is _pbuild. I'm not too worried about the TestHomeDir
per se but rather the fact that its failure takes out a sizable number
of later tests.

Index: Makefile
===================================================================
RCS file: /var/cvs/ports/lang/go/Makefile,v
retrieving revision 1.71
diff -u -p -r1.71 Makefile
--- Makefile    15 Sep 2019 02:00:34 -0000      1.71
+++ Makefile    26 Sep 2019 07:15:03 -0000
@@ -96,6 +96,7 @@ do-test:
                ulimit -d $$(ulimit -H -d) -n 256 && \
                CC="${CC}" \
                CXX="${CXX}" \
+               GOCACHE=${WRKDIST}/go-cache \
                PATH=${WRKDIST}/bin:${PATH} \
                    /bin/ksh -c "exec 3>&-; exec 4>&-; ./run.bash"
 

Reply via email to