Skip to content

[Tests] - FIX - several tests to run on linux target. #41

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 1 commit into from
Dec 18, 2019

Conversation

JhonnyBillM
Copy link
Contributor

This PR removes several target specific arguments and/or platform conditional checks in some SwiftDriverTests. We still need to determine what to do with tests that use specific macOS tooling such as dsymutil or libtool.


Questions:

  1. Do we want to get completely rid of the /usr/bin/ hack or should we keep it to have some cleaner tests? ¹

  2. We can remove the specific platform target in testMultiThreadedWholeModuleOptimizationCompiles and in testWholeModuleOptimizationOutputFileMap and they are going to work on both platforms. Can I remove the specific target or is it there for any other reason to have it there?

¹ Right now if we completely remove the hack, testLinking and testSanitizerArgs will fail because they require macOS specific tools such as dsymutil and libtool, we could probably update those tests similar to what we did in testDSYMGeneration, or just do a platform conditional check (but I understand that we are also trying to get rid of those platforms checks). So what I would like to know is the way we would like to proceed on those situations.

@DougGregor
Copy link
Member

@swift-ci please test

@DougGregor
Copy link
Member

This PR removes several target specific arguments and/or platform conditional checks in some SwiftDriverTests. We still need to determine what to do with tests that use specific macOS tooling such as dsymutil or libtool.

Questions:

  1. Do we want to get completely rid of the /usr/bin/ hack or should we keep it to have some cleaner tests? ¹

I'd like a way to replace the /usr/bin hack with something that doesn't run outside of the specific unit tests that need it. Perhaps use an environment variable to pass through a flag that says it can fall back? That'll make the tests themselves cleaner.

  1. We can remove the specific platform target in testMultiThreadedWholeModuleOptimizationCompiles and in testWholeModuleOptimizationOutputFileMap and they are going to work on both platforms. Can I remove the specific target or is it there for any other reason to have it there?

You can remove the specific target. Those tests don't need to be target-specific.

¹ Right now if we completely remove the hack, testLinking and testSanitizerArgs will fail because they require macOS specific tools such as dsymutil and libtool, we could probably update those tests similar to what we did in testDSYMGeneration, or just do a platform conditional check (but I understand that we are also trying to get rid of those platforms checks). So what I would like to know is the way we would like to proceed on those situations.

Hmm. testDSYMGeneration really does want to check for the dSYM generation command, so it probably makes sense to keep it target-specific. testLinking and testSanitizerArgs are cross-platform tests, though, so the test could expect dSYM generation when the selected toolchain is Darwin and not otherwise.

It's interesting, because we benefit both from the tests checking the driver on the host platform and for checking the cross-compile case. Maybe there's some future factoring where we can run the target-independent tests with a couple of different target triples that are independent from the host's triple, to make sure the driver behaves the same way when cross-compiling.

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

This is looking very good! Just the one dSYM bit I'd like to get cleaned up before we merge, thank you!

let cmd = generateDSYMJob.commandLine

if generateDSYMJob.kind == .generateDSYM {
Copy link
Member

Choose a reason for hiding this comment

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

Here, I'd rather either keep the test target-specific (since we're testing a Darwin target feature) or use an isDarwin check on the selected toolchain to determine whether we should expect a .generateDSYM option. As this test is written, it will pass even if we made a mistake and stopped generating dSYMs on Darin

ADD - environment variable to enable cross compiling in tests that depends on macOS specific tooling such as libtool.

ADD - testExecutableFallbackPath to validate we respect the new environment variable when searching for tools.

REMOVE - several target specific arguments and platform conditional checks in some SwiftDriverTests.
Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

@DougGregor
Copy link
Member

@swift-ci please test

Comment on lines +114 to +116
private var fallbackToExecutableDefaultPath: Bool {
env["SWIFT_DRIVER_TESTS_ENABLE_EXEC_PATH_FALLBACK"] == "1"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DougGregor

  1. I would like to know your opinion about the naming here.

  2. Should we have all the environment variables listed in one place?
    I tried to look how other swift projects handles this but found nothing in particular. I think it would be nice to have a place where we define our environment variables, the naming convention and their purpose 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with the name as is; it clearly indicates that it's for testing purposes. It would certainly be good for us to document the environment variables we respond to... we don't really have user-level documentation yet, but we could create a docs/EnvironmentVariables.md for now and figure out how we want to evolve the docs over time.

@DougGregor
Copy link
Member

@swift-ci please test

@DougGregor DougGregor merged commit 4efb328 into swiftlang:master Dec 18, 2019
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