<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/internal/testenv/exec.go, branch fix-runtime-test-GOMAXPROCS</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=fix-runtime-test-GOMAXPROCS</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=fix-runtime-test-GOMAXPROCS'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2025-07-20T06:09:31Z</updated>
<entry>
<title>internal/testenv: exclude GOMAXPROCS when building test program</title>
<updated>2025-07-20T06:09:31Z</updated>
<author>
<name>Shulhan</name>
<email>m.shulhan@gmail.com</email>
</author>
<published>2025-07-20T05:45:21Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=60302d4951164495cfbdd97c755e0f44cab64c60'/>
<id>urn:sha1:60302d4951164495cfbdd97c755e0f44cab64c60</id>
<content type='text'>
In the environment where GOMAXPROCS set explicitly, for example to 3 in
shell profile, the runtime tests will fail with the following error,

----
ok      regexp/syntax   0.428s
--- FAIL: TestCgroupGOMAXPROCS (0.81s)
    crash_test.go:186: running /home/ms/src/go/bin/go build -o /tmp/go-build1753772192/testprog.exe
    crash_test.go:208: built testprog in 796.664277ms
    --- FAIL: TestCgroupGOMAXPROCS/containermaxprocs=0 (0.00s)
        cgroup_linux_test.go:60: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (907.06µs): ok
        cgroup_linux_test.go:63: output got "3\n" want "4\n"
--- FAIL: TestCgroupGOMAXPROCSNoLimit (0.00s)
    cgroup_linux_test.go:82: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (879.194µs): ok
    cgroup_linux_test.go:85: output got "3\n" want "4\n"
--- FAIL: TestCgroupGOMAXPROCSHigherThanNumCPU (0.00s)
    cgroup_linux_test.go:102: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (852.396µs): ok
    cgroup_linux_test.go:105: output got "3\n" want "4\n"
--- FAIL: TestCgroupGOMAXPROCSRound (0.01s)
    --- FAIL: TestCgroupGOMAXPROCSRound/50000 (0.00s)
        cgroup_linux_test.go:156: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (852.099µs): ok
        cgroup_linux_test.go:159: output got "3\n" want "2\n"
    --- FAIL: TestCgroupGOMAXPROCSRound/100000 (0.00s)
        cgroup_linux_test.go:156: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (894.001µs): ok
        cgroup_linux_test.go:159: output got "3\n" want "2\n"
    --- FAIL: TestCgroupGOMAXPROCSRound/150000 (0.00s)
        cgroup_linux_test.go:156: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (850.897µs): ok
        cgroup_linux_test.go:159: output got "3\n" want "2\n"
--- FAIL: TestCgroupGOMAXPROCSSchedAffinity (0.00s)
    cgroup_linux_test.go:229: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (867.987µs): ok
    cgroup_linux_test.go:232: output got "3\n" want "2\n"
FAIL
FAIL    runtime 23.088s
----

This changes exclude the GOMAXPROCS when building program for testing so it
does not affect the tests.

Change-Id: I590d9eca57026539413cf4c93b37f624f179d534
</content>
</entry>
<entry>
<title>math,os,os/*: use testenv.Executable</title>
<updated>2024-09-03T20:11:30Z</updated>
<author>
<name>Kir Kolyshkin</name>
<email>kolyshkin@gmail.com</email>
</author>
<published>2024-08-30T02:51:22Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=c3f346a485f2fa97a7bdee82d587419b3823a1ba'/>
<id>urn:sha1:c3f346a485f2fa97a7bdee82d587419b3823a1ba</id>
<content type='text'>
As some callers don't have a testing context, modify testenv.Executable
to accept nil (similar to how testenv.GOROOT works).

Change-Id: I39112a7869933785a26b5cb6520055b3cc42b847
Reviewed-on: https://go-review.googlesource.com/c/go/+/609835
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Dmitri Shuralyov &lt;dmitshur@google.com&gt;
</content>
</entry>
<entry>
<title>internal/testenv: add missing t.Helper calls</title>
<updated>2024-09-03T19:33:06Z</updated>
<author>
<name>Kir Kolyshkin</name>
<email>kolyshkin@gmail.com</email>
</author>
<published>2024-08-30T01:23:25Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=76a42d74356e3c5bee0851c99665b21bf29f0c27'/>
<id>urn:sha1:76a42d74356e3c5bee0851c99665b21bf29f0c27</id>
<content type='text'>
...and move a few so they won't be called when not needed.

Change-Id: I024b9552ed5ed839cde4fbae4815ec6ba8b67265
Reviewed-on: https://go-review.googlesource.com/c/go/+/609300
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Reviewed-by: Dmitri Shuralyov &lt;dmitshur@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>internal/testenv: add Executable</title>
<updated>2024-09-03T18:03:03Z</updated>
<author>
<name>Kir Kolyshkin</name>
<email>kolyshkin@gmail.com</email>
</author>
<published>2024-08-30T01:51:10Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=b4d4744059c0c9632c034af145deb161995f2f32'/>
<id>urn:sha1:b4d4744059c0c9632c034af145deb161995f2f32</id>
<content type='text'>
Tests commonly use code to get os.Executable value, and some cache the
resulting value.

To reduce code duplication, add a helper that does just that.

Change-Id: I9dd7eb24e24a3abd92be2b87227e823f0fca5cb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/609301
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Alan Donovan &lt;adonovan@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
</content>
</entry>
<entry>
<title>internal/testenv: MustHaveExec: use sync.OnceValue</title>
<updated>2024-08-30T16:26:31Z</updated>
<author>
<name>Kir Kolyshkin</name>
<email>kolyshkin@gmail.com</email>
</author>
<published>2024-08-29T23:46:16Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=46985f4ec2a83241de4c0cec522df0ed19a3635d'/>
<id>urn:sha1:46985f4ec2a83241de4c0cec522df0ed19a3635d</id>
<content type='text'>
Change-Id: I048474fc93bb8c149672b66f98d71eec0eb8aad7
Reviewed-on: https://go-review.googlesource.com/c/go/+/609795
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Alan Donovan &lt;adonovan@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
</content>
</entry>
<entry>
<title>internal/testenv: use cmd.Environ in CleanCmdEnv</title>
<updated>2023-10-27T17:53:23Z</updated>
<author>
<name>Cherry Mui</name>
<email>cherryyz@google.com</email>
</author>
<published>2023-10-27T16:30:53Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=5613882df7555484680ecabc0462b7c23c6f5205'/>
<id>urn:sha1:5613882df7555484680ecabc0462b7c23c6f5205</id>
<content type='text'>
In CleanCmdEnv, use cmd.Environ instead of os.Environ, so it
sets the PWD environment variable if cmd.Dir is set. This ensures
the child process sees a canonical path for its working directory.

Change-Id: Ia769552a488dc909eaf6bb7d21937adba06d1072
Reviewed-on: https://go-review.googlesource.com/c/go/+/538215
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Bryan Mills &lt;bcmills@google.com&gt;
</content>
</entry>
<entry>
<title>all: fix typos and remove repeated words</title>
<updated>2023-07-12T23:26:34Z</updated>
<author>
<name>Dan Kortschak</name>
<email>dan@kortschak.io</email>
</author>
<published>2023-07-12T12:56:57Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=49d42128fd8594c172162961ead19ac95e247d24'/>
<id>urn:sha1:49d42128fd8594c172162961ead19ac95e247d24</id>
<content type='text'>
Change-Id: I5f06a4ef1d827eb0fe32a8d98444142108b0d573
Reviewed-on: https://go-review.googlesource.com/c/go/+/508996
Run-TryBot: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Keith Randall &lt;khr@golang.org&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Run-TryBot: Keith Randall &lt;khr@golang.org&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
Reviewed-by: Keith Randall &lt;khr@google.com&gt;
</content>
</entry>
<entry>
<title>internal/testenv: reduce init-time work for MustHaveExec</title>
<updated>2023-05-05T23:33:02Z</updated>
<author>
<name>Bryan C. Mills</name>
<email>bcmills@google.com</email>
</author>
<published>2023-05-05T13:29:34Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=3e35df5edbb02ecf8efd6dd6993aabd5053bfc66'/>
<id>urn:sha1:3e35df5edbb02ecf8efd6dd6993aabd5053bfc66</id>
<content type='text'>
In CL 486275 I added a somewhat complex init function that sets up a
callback to probe for exec support. A lot of the complexity was simply
to avoid an unnecessary call to os.Environ during init.

In CL 491660, I made the os.Environ call unconditional on all
platforms anyway in order to make HasGoBuild more robust.

Since the init-function indirection no longer serves a useful purpose,
I would like to simplify it to a package-level function, avoiding the
complexity of changing package variables at init time.

Change-Id: Ie0041d52cbde06ff14540192c8fba869a851158e
Reviewed-on: https://go-review.googlesource.com/c/go/+/492977
Run-TryBot: Bryan Mills &lt;bcmills@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Bryan Mills &lt;bcmills@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>internal/testenv: remove HasExec and simplify other support checks again</title>
<updated>2023-05-04T19:52:29Z</updated>
<author>
<name>Bryan C. Mills</name>
<email>bcmills@google.com</email>
</author>
<published>2023-05-02T17:07:26Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=79723f389b630e61c5e9635235b7f4c624ac1379'/>
<id>urn:sha1:79723f389b630e61c5e9635235b7f4c624ac1379</id>
<content type='text'>
HasExec is an attractive nuisance: it is tempting to check in a
TestMain function, but TestMain really shouldn't be running
subprocesses eagerly anyway (they add needless overhead for operations
like 'go test -list=.'), and the trick of re-executing the test binary
to determine whether 'exec' works ends up in infinite recursion if
TestMain itself calls HasExec.

Instead, tests that need to execute a subprocess should call
MustHaveExec or MustHaveExecPath from within a specific test,
or just try to exec the program and check its error status
(perhaps using testenv.SyscallIsNotSupported).

While I'm in here and testing on the SlowBots anyway, a few other
cleanups relating to subprocesses:

- Add more t.Helper calls to support checks where appropriate.

- Remove findGoTool, which can be simplified to exec.LookPath as of
  CL 404134.

- Add tests confirming the expected behavior of the support functions
  on the Go project's builders.

Change-Id: I163c701b2dd6eb6b7a036c6848f99b64dd9f0838
Reviewed-on: https://go-review.googlesource.com/c/go/+/491660
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Run-TryBot: Bryan Mills &lt;bcmills@google.com&gt;
Auto-Submit: Bryan Mills &lt;bcmills@google.com&gt;
</content>
</entry>
<entry>
<title>internal/testenv: actually try to exec on ios and wasm</title>
<updated>2023-04-24T20:39:25Z</updated>
<author>
<name>Bryan C. Mills</name>
<email>bcmills@google.com</email>
</author>
<published>2023-04-24T14:09:17Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=3f987ae61d4c52ddc364abf6472227d7821c9e43'/>
<id>urn:sha1:3f987ae61d4c52ddc364abf6472227d7821c9e43</id>
<content type='text'>
Due to a stray edit in CL 486275, the assignment to tryExecOk
in tryExec on ios would be immediately overwritten back to false.
This change fixes the stray edit.

Change-Id: I4f45fbf130dc912305e5f453b0d1a622ba199ad4
Reviewed-on: https://go-review.googlesource.com/c/go/+/488076
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Auto-Submit: Bryan Mills &lt;bcmills@google.com&gt;
Run-TryBot: Bryan Mills &lt;bcmills@google.com&gt;
</content>
</entry>
</feed>
