Skip to content

Some Improvements to Cross-Module Incremental Build Testing #541

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

Merged
merged 4 commits into from
Mar 16, 2021

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Mar 15, 2021

Add some more tests, and touch up some of the internals of the test framework.

CodaFi added 4 commits March 15, 2021 16:09
* Document paths
* Use build directory terminology that is consistent with XCBuild
* Fixup the executable path computation for Windows
writeFileContents can fail if the file already exists.
@CodaFi CodaFi requested a review from davidungar March 15, 2021 23:12
@CodaFi
Copy link
Contributor Author

CodaFi commented Mar 15, 2021

@swift-ci test

Copy link
Contributor

@davidungar davidungar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice tests and improvements to the framework! The only change I can think of to suggest: When defining a module in a test that may not import some other module, define a different module object (with the same name) that does not claim to import the other module.

Example:

let M1 = Module(named: "M", containing: "X", importing: [], ...)
let M2 = Module(named: "M", containing: "X", importing: [N], ...)

Then use M1 in a step in which there is no import line (or it's commented-out) in X, and use M2 when there is.

@@ -0,0 +1,107 @@
//===---------------- Antisymmetry.swift - Swift Testing ------------------===//
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole file is beautiful! Well-done!! I wonder if, in the future, we'll want to add other sorts of uses and definitions, and/or test removals as well?

static var A = Module(named: "A", containing: [
.A,
], importing: [
.B, .C,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I read this--haven't absorbed the whole thing yet--I'm wondering why A also imports C? Or would that be a different test we might need?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... if the import is optional, maybe there should be different Module A objects, one with- and another without the import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All imports does is configure search paths, right? I'm not worried about having to state this conditional dependency edge all the time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a slightly tighter test without the imports because then it relies a bit less on our assumptions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll also be noisier because the change in search paths will force us to discard the incremental build state. We need separate tests for that case if we don't have them already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent point! Thank you for thinking of it.

.expecting(.init(always: [ .A ]))),
// Finally, add a member to a struct in C, which influences the layout of
// the struct in B, which influences the layout of the struct in A.
// Everything rebuilds!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see this test!

@CodaFi
Copy link
Contributor Author

CodaFi commented Mar 16, 2021

@CodaFi CodaFi merged commit 4343bed into swiftlang:main Mar 16, 2021
@CodaFi CodaFi deleted the i-was-framed branch March 16, 2021 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants