aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/cgo/internal/testshared
AgeCommit message (Collapse)Author
2025-09-15all: replace os.Getenv("GO_BUILDER_NAME") with testenv.Builder in testsMichael Anthony Knyszek
Some tests still reach for GO_BUILDER_NAME directly. This change makes it so that they go through testenv.Builder. There are a couple more, but changing them may also cause tests to start failing. Done in a follow-up. Change-Id: Id2453b7b62f5ebf3594e92fa53724a577a97440f Reviewed-on: https://go-review.googlesource.com/c/go/+/703135 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-03-20all: use exec.Command.String in test logsqmuntal
There is no need to manually construct a human-friendly string for a exec.Command. The String method does that for us. Change-Id: Iff1033478000bade9cbdc079f6143a7690374258 Reviewed-on: https://go-review.googlesource.com/c/go/+/659475 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-03-20cmd/cgo/internal/testshared: log stdout when go command failsqmuntal
Understanding a failure in the goCmd call is difficult because the important information might be in the stdout instead of stderr. Change-Id: Icf42974679103c69016129fe2ebb15d5a0a3b51a Reviewed-on: https://go-review.googlesource.com/c/go/+/659456 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-06-07cmd/link: don't include deadcoded function symbols in shared build modeCherry Mui
In shared build mode, we include all symbols. This includes function symbols that are deadcoded by the compiler. They don't really get compiled, and their metadata may be missing, causing linker failures. Skip them. Fixes #67635. Change-Id: Ic0e64bd032be499cca26da5e9e3ffbe9998bac05 Reviewed-on: https://go-review.googlesource.com/c/go/+/588316 Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-20cmd/link, runtime: initialize packages in shared build modeCherry Mui
Currently, for the shared build mode, we don't generate the module inittasks. Instead, we rely on the main executable to do the initialization, for both the executable and the shared library. But, with the model as of CL 478916, the main executable only has relocations to packages that are directly imported. It won't see the dependency edges between packages within a shared library. Therefore indirect dependencies are not included, and thus not initialized. E.g. main imports a, which imports b, but main doesn't directly import b. a and b are in a shared object. When linking main, it sees main depends on a, so it generates main's inittasks to run a's init before main's, but it doesn't know b, so b's init doesn't run. This CL makes it initialize all packages in a shared library when the library is loaded, as any of them could potentially be imported, directly or indirectly. Also, in the runtime, when running the init functions, make sure to go through the DSOs in dependency order. Otherwise packages can be initialized in the wrong order. Fixes #61973. Change-Id: I2a090336fe9fa0d6c7e43912f3ab233c9c47e247 Reviewed-on: https://go-review.googlesource.com/c/go/+/520375 Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-08-26cmd/compile: un-hide closure func in init functionCuong Manh Le
Same as CL 492135, but for init function. Fixes #62277 Change-Id: If5ff9bc2ce2a73193b1f7ee5f7f14045d1354f56 Reviewed-on: https://go-review.googlesource.com/c/go/+/522956 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2023-07-21cmd/cgo/internal/testshared: skip in short mode and not on buildersCherry Mui
We already skip testcarchive, testcshared, and testplugin in short mode and not on builders. The shared build mode is not more supported than the c-archive, c-shared, and plugin build modes. No need to run it everywhere by default. Updates #61025. Change-Id: I6a06e04c1a1dc78f0f85456320d128bd67277915 Reviewed-on: https://go-review.googlesource.com/c/go/+/511696 Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2023-06-16cmd/cgo/internal/testshared: disable gccgo tests on PPC64Paul E. Murphy
Disable PPC64 gccgo tests until issue #60798 is fixed in gcc. Change-Id: I4d330e3d0ab6d4174ee6d8ff2cbedf53c8c4e3d9 Reviewed-on: https://go-review.googlesource.com/c/go/+/504095 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-06-16cmd/cgo/internal/testshared: strip newline from gccgo -dumpversionPaul E. Murphy
Otherwise, gccgo tests may be quietly skipped. For #60798 Change-Id: Iaad6b53c95ad4d407b917d8f62978979b82a4e81 Reviewed-on: https://go-review.googlesource.com/c/go/+/503495 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-22cmd/cgo/internal: skip in tests, not in TestMainAustin Clements
Many cgo integration tests do a lot of common setup in TestMain, and that means they require a lot from the test environment to even get off the ground. If something is missing, right now they print a "SKIP" message to stderr and exit without running any tests. Make these behave more like normal tests by instead setting a global skip function if some precondition isn't satisfied, and having every test call that. This way we run the tests and see them skip. I would prefer something much more structured. For example, if we replaced the global state set up by TestMain in these tests by instead calling a function that returned that state (after setting it up on the first call), that function could do the appropriate skips and there would be no way to accidentally access this state without checking the preconditions. But that's substantially more work and may be much easier after we do further cleanup of these tests. Change-Id: I92de569fd27596798c5e478402449cd735ec53a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/497096 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-22cmd/cgo: merge overlayDir into one packageAustin Clements
There are many copies of overlaydir_test.go between the cgo tests from when these couldn't share code. Now that they can, merge these copies into a cmd/cgo/internal/cgotest package. Change-Id: I203217f5d08e6306cb049a13718652cf7c447b80 Reviewed-on: https://go-review.googlesource.com/c/go/+/497078 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19cmd/dist: refine test conditions and enable more cgo tests on Android, iOSAustin Clements
This CL moves many cgo test conditions out of dist and into the tests themselves, now that they can use the testenv.Must* helpers. This refines a lot of the conditions, which happens to have the effect of enabling many tests on Android and iOS that are disabled by too-coarse GOOS checks in dist today. Fixes #15919. Change-Id: I2947526b08928d2f7f89f107b5b2403b32092ed8 Reviewed-on: https://go-review.googlesource.com/c/go/+/495918 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-12misc/cgo: move easy tests to cmd/cgo/internalAustin Clements
This moves most misc/cgo tests to cmd/cgo/internal. This is mostly a trivial rename and updating dist/test.go for the new paths, plus excluding these packages from regular dist test registration. A few tests were sensitive to what path they ran in, so we update those. This will let these tests access facilities in internal/testenv. For #37486. Change-Id: I3ed417c7c22d9b667f2767c0cb1f59118fcd4af6 Reviewed-on: https://go-review.googlesource.com/c/go/+/492720 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>