Skip to content

Change main file tests to define sources inline and remove tibs testing infrastructure #952

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 2 commits into from
Oct 31, 2023

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 30, 2023

Migrate the last tests that used the tibs workspace to define sources inline and remove the testing infrastructure that relied on TIBS.

Resolves #879

@ahoppen
Copy link
Member Author

ahoppen commented Oct 30, 2023

@swift-ci Please test

@ahoppen ahoppen force-pushed the ahoppen/no-more-tibs branch from 27e988b to 86c33aa Compare October 30, 2023 23:15
@ahoppen
Copy link
Member Author

ahoppen commented Oct 30, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 30, 2023

@swift-ci Please test Windows

targets: [
.target(
name: "MyLibrary",
cSettings: [.define("VARIABLE_NAME", to: "fromMyLibrary"), .unsafeFlags(["-Wunused-variable"])]
Copy link
Contributor

Choose a reason for hiding this comment

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

Took me a little bit to realize why we were doing this - worth a comment IMO (ie. that we're defining VARIABLE_NAME here to make sure that the build settings from the main file are being used for the header).

Copy link
Member Author

Choose a reason for hiding this comment

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

I mentioned that we use VARIABLE_NAME to communicate the build settings in all test cases now.

"Sources/MyLibrary/MyLibrary.c": """
#include "$TEST_DIR/Sources/shared.h"
""",
"Sources/MyFancyLibrary/include/MyFancyLibraryh": "",
Copy link
Contributor

Choose a reason for hiding this comment

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

This file is unused isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

SwiftPM refuses to build if a C target does not have an include directory. And in the current infrastructure, the only way to create a directory is to put a file in there.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. That's... okay. Could just add a dummy or something though (to make that more clear)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. Renamed to dummy.h.

@@ -134,81 +134,6 @@ Where "N" configures the log verbosity and is one of the following numbers: 0 (e

As much as is practical, all code should be covered by tests. New tests can be added under the `Tests` directory and should use `XCTest`. The rest of this section will describe the additional tools available in the `SKTestSupport` module to make it easier to write good and efficient tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

I assume your opinion here is that the tests are now obvious enough without any description?

Copy link
Member Author

Choose a reason for hiding this comment

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

My opinion here is that we should write more documentation that’s up-to-date.

This paragraph in particular doesn’t add any value IMO. It’s mostly just: There should be tests and we use XCTest, which, I think is obvious.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear, my comment was just on the first changed line.

My opinion here is that we should write more documentation that’s up-to-date.

Sounds good 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, for those, I would say that

As much as is practical, all code should be covered by tests. New tests can be added under the Tests directory and should use XCTest.

is obvious and not something that needs to be mentioned in documentation.

@ahoppen ahoppen force-pushed the ahoppen/no-more-tibs branch from 86c33aa to 2020c98 Compare October 31, 2023 16:07
@ahoppen
Copy link
Member Author

ahoppen commented Oct 31, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 31, 2023

@swift-ci Please test Windows

The tests are structured quite differently now but I think the new, smaller test cases cover all the interesting cases from the old test.
All test have been migrated to define their sources inline, so we can remove the usage of the TIBS test infrastructure, also removing our dependency on `ninja` to run tests.
@ahoppen ahoppen force-pushed the ahoppen/no-more-tibs branch from 2020c98 to 2d0c818 Compare October 31, 2023 16:57
@ahoppen
Copy link
Member Author

ahoppen commented Oct 31, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 31, 2023

@swift-ci Please test Windows

@ahoppen ahoppen merged commit af794f7 into swiftlang:main Oct 31, 2023
@ahoppen ahoppen deleted the ahoppen/no-more-tibs branch October 31, 2023 22:45
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.

Change staticSourceKitTibsWorkspace to define the sources in-line with the test instead of in a directory
3 participants