aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2023-05-22 15:19:49 -0400
committerAustin Clements <austin@google.com>2023-05-22 20:56:11 +0000
commit5abfdc8c75b13edbe3ccc918df47dd2da85454d8 (patch)
tree58da26821f29fd48ef28ce9b77c843ebca13e896 /test/codegen
parenta1f3dc33dced2d337261b693b1ef1bf6a5bbce8d (diff)
downloadgo-5abfdc8c75b13edbe3ccc918df47dd2da85454d8.tar.xz
cmd/cgo/internal: skip in tests, not in TestMain
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>
Diffstat (limited to 'test/codegen')
0 files changed, 0 insertions, 0 deletions