-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Automatic Linux test manifest generation #159
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
Conversation
@mxcl Before I can go any further, I need some answers on #156 (comment) and #156 (comment). |
@czechboy0 Sorry I never followed up on #156 (comment)
I agree that pushing for uniformity is very much in-line with SwiftPM's goals, but I'm not thrilled about the idea of committing to an approach that would be entirely incompatible with packages interested in writing tests with tools like Quick or Spectre. It seems to me that the convention of providing an |
Yeah I agree, but I was working with the assumption that the goals are to 1. get XCTest working on Linux without extra work required by the user, then 2. define a testing protocol to support non-XCTest runners. I feel like slowing down 1. will in turn also slow down 2. But I don't think we need to prematurely try to optimize for a future work flow which hasn't yet been defined by a proposal. I understand it might lead to a bit of work being thrown out when step 2. is defined, but I'd prefer to have a great user experience at all stages of SwiftPM's development, not just after custom test runners are supported. Does that make sense? |
Yup, it does make sense. In any case, I'm mostly just glad to see this work coming together so quickly after the initial landing of the |
I'd like to resurrect this PR (somehow combined with @aciidb0mb3r's #164). It's still very annoying to have to make changes to tests twice plus I constantly see projects not testing everything on Linux simply because they forget to add the tests to the Linux manifests. @mxcl Could you please chime in? I have a couple of questions in the comments above. We also need to figure out where this code will live. I'd be for putting it into SwiftPM, while keeping in mind the testing protocol being designed at the moment - so that we can easily disable it for 3rd party testing frameworks once we can detect them in the future. That way users can just run tests on both platform and it just works. |
Can we reiterate the questions and issues in this thread? The conversation has become a little all-over-the-place and I think it would help to clarify. |
=> The only viable solution (to me) seems to move the relevant test scanning code from SourceKit into libIDE, and provide a documented and supported driver option in the |
I added a comment on SR-710 with a summary of my understanding here. |
@mxcl Sure, I was mainly wondering where you'd like to see this code. I guess there's not much worth doing until we have access to the stable AST suggested by @gribozavr, so this PR is blocked by that work (does anyone have a SR-XXXX link to that work?) |
I think we should start the discussion about getting the proper implementation of that kind of work off of the ground. There are several important features for which we would like to have deeper integration with the Swift compiler:
I'm not necessarily convinced the right answer for SwiftPM is to live directly atop the SourceKit functionality (since as others have mentioned, we should support 3rd-party frameworks), but we should start figuring out the right production quality interfaces to design and build here. This is going to end up being a pretty big project, we should probably move the primary discussion to swift-build-dev. Someone will need to drive it, and I suspect neither @mxcl or myself will have time in the short term. I think independently we may want to see if there is any other short-term mitigation for the tests-on-linux problem we can put in. |
@ddunbar Check out the discussion in SR-710 if you haven't already. @drewcrawford is of the opinion that Swift reflection is already at a point that we can use it to implement this feature. I haven't been following the reflection work closely so I can't say either way. I'd love to help get this done, and I think the first step is to centralize the discussion. I personally would prefer SR-710, but if you'd like to start a mailing list thread, we can direct the discussion there. |
Closing this, as it's definitely not the way we'll take this feature. Although, if in the meantime you have a large test code base without a manifest, and would prefer to have it generated automatically, try this: https://github.com/czechboy0/SwiftXCTestLinuxNameGenerator It's the naive, text-based parser & manifest generator, saved me hours of time already. Not robust, but definitely better than having to write the manifests manually 😊 |
…-tests [BuildSystemTaskTests] Make sure first build system is closed before building with the second one
https://bugs.swift.org/browse/SR-710
(This is a reopened #156, see that for previous discussions)
This is first stab at automatically generating Linux test manifests. Generation seems to be working correctly, but I haven't written any tests yet, so it's not ready to merge. I wanted to present this early to get feedback.
describe()
that have anything to do with test manifests.DONE
XCTestMain.swift
file (replacement forLinuxMain.swift
) for each test product and aXCTestManifest.swift
file for each module. The files are now generated in folder.build/xctestmanifests
, meaning we don't add any user-visible files.Module
to allow for adding sources after creation with an array of absolute paths..build
, to avoid users having to manage those files with SCM etc.TODO with Questions
testGen
sound good to you?)swiftc -dump-ast
), @aciidb0mb3r working on that