-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/go/ssa: add support to CreateTestMainPackage for testing.M #9553
Comments
Note to self: do this after Go 1.6. Also, think about an alternative approach to generating the testmain package. Half of the work can be done in a way that doesn't depend on SSA. For example, in typeutil, we could add utility functions that, given a *types.Package, return a struct describing the tests within it, or a generated source file containing a main function like what |
CL https://golang.org/cl/25102 mentions this issue. |
Supporting user-defined TestMain functions requires that we generate a "testmain" package for each testable package, rather than a single one for the entire program. This entails these API changes: 1. (*ssa.Program).{CreateTestMainPackage,FindTests} both now accept only a single package. Existing clients that pass them multiple packages must call them from a loop. 2. (*ssa.Program).FindTests returns an additional result, the the optional TestMain *ssa.Function. Existing clients may discard it. Also: - Test the new logic using the SSA interpreter - add ssautil.MainPackages helper - callgraph: allow multiple main packages, and analyze them all - ssadump -run: allow multiple main/test packages, and run each in a new interpreter - minor simplifications to some callers (e.g. guru) Fixes golang/go#9553 Change-Id: Ia7de9bd27448fb08b8d172ba5cdbcf37a762b7a0 Reviewed-on: https://go-review.googlesource.com/25102 Reviewed-by: Robert Griesemer <gri@golang.org>
The generated code for packages using *testing.M is slightly different than for other tests.
The ssa package's function to synthesize testmain packages needs updating.
The text was updated successfully, but these errors were encountered: