-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
- Loading branch information
Showing
4 changed files
with
111 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.