Re: Mk/Uses/go.mk: TEST_ENV is not passed to test build

From: Ronald Klop <ronald-lists_at_klop.ws>
Date: Sun, 09 Feb 2025 19:32:27 UTC
Any thoughts about this?

I also created an issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284387.

Regards,

Ronald.

 
Van: Ronald Klop <ronald-lists@klop.ws>
Datum: vrijdag, 24 januari 2025 14:13
Aan: freebsd-ports@freebsd.org, freebsd-go@freebsd.org
Onderwerp: Mk/Uses/go.mk: TEST_ENV is not passed to test build
> 
> Hi,
> 
> According to bsd.port.mk TEST_ENV is passed as environment to the default make test target.
> I tried that in my databases/mongodb-tools port and it didn't work.
> 
> A small diff fixes this.
> diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk
> index d7e932daee73..2a4ff76db199 100644
> --- a/Mk/Uses/go.mk
> +++ b/Mk/Uses/go.mk
> @@ -276,7 +276,7 @@ do-test:
>         (cd ${GO_WRKSRC}; \
>         for t in ${GO_TESTTARGET}; do \
>                 ${ECHO_MSG} "===>  Testing $${t}"; \
> -               ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${GO_ENV} GOPROXY=off ${GO_CMD} test ${GO_TESTFLAGS} $${t}; \
> +               ${SETENVI} ${WRK_ENV} ${TEST_ENV} ${GO_ENV} GOPROXY=off ${GO_CMD} test ${GO_TESTFLAGS} $${t}; \
>         done)
>  .  endif
> 
> Just a question.
> In bsd.port.mk the line TEST_ENV?=${MAKE_ENV} copies MAKE_ENV into TEST_ENV, unless you set TEST_ENV yourself in the ports Makefile.
> 
> 1. Should I replace MAKE_ENV with TEST_ENV in go.mk (see diff above)? This looks like how cmake.mk, perl5.mk and python.mk pass TEST_ENV. This might break the test target in existing ports which do no add MAKE_ENV to TEST_ENV themselves.
> 2. Or should I add TEST_ENV to the line above together with MAKE_ENV which might duplicate the env variables because TEST_ENV=MAKE_ENV in bsd.port.mk?
> 
> I would prefer 1 and document the change in /usr/ports/CHANGES as it is more in line with the other languages.
> 
> What do you think?
> 
> Regards,
> Ronald.
>