Skip to content

test: add and use prefix substitutions for libraries #21152

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 3 commits into from
Dec 12, 2018

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Dec 8, 2018

The naming convention is different on Windows than on Unix-like
environments. In order to follow the convention we need to substitute
the prefix and the suffix. Take the opportunity to rename the
target-dylib-extension to the CMake-like variable
target-shared-library-suffix and introduce
target-shared-library-prefix. This helps linking the test suite
binaries on Windows.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@compnerd
Copy link
Member Author

compnerd commented Dec 8, 2018

@swift-ci please test

@@ -1,15 +1,15 @@
// RUN: %empty-directory(%t)

// RUN: %target-build-swift-dylib(%t/libresilient_struct.%target-dylib-extension) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct
// RUN: %target-codesign %t/libresilient_struct.%target-dylib-extension
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}resilient_struct%{target-shared-library-suffix}) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct
Copy link
Contributor

Choose a reason for hiding this comment

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

This pattern is very verbose. Maybe we should make it another regex-based substitution? %target-shared-library(resilient_struct).

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 tried to do that, but failed at that, but I thought it would be possible to do that substitution. But, since you also seem to think that it should be possible to have that substitution, I want to give that a second shot.

@compnerd
Copy link
Member Author

compnerd commented Dec 9, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 9, 2018

Build failed
Swift Test Linux Platform
Git Sha - 521373d0c6c70d9bcec4e71bd8d1d268ea4f555d

@swift-ci
Copy link
Contributor

swift-ci commented Dec 9, 2018

Build failed
Swift Test OS X Platform
Git Sha - 521373d0c6c70d9bcec4e71bd8d1d268ea4f555d

@compnerd compnerd force-pushed the library-prefix-suffix branch from 521373d to cf07dac Compare December 9, 2018 06:22
@compnerd
Copy link
Member Author

compnerd commented Dec 9, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 9, 2018

Build failed
Swift Test Linux Platform
Git Sha - 521373d0c6c70d9bcec4e71bd8d1d268ea4f555d

@swift-ci
Copy link
Contributor

swift-ci commented Dec 9, 2018

Build failed
Swift Test OS X Platform
Git Sha - 521373d0c6c70d9bcec4e71bd8d1d268ea4f555d

The naming convention is different on Windows than on Unix-like
environments.  In order to follow the convention we need to substitute
the prefix and the suffix.  Take the opportunity to rename the
`target-dylib-extension` to the CMake-like variable
`target-shared-library-suffix` and introduce
`target-shared-library-prefix`.  This helps linking the test suite
binaries on Windows.
@compnerd compnerd force-pushed the library-prefix-suffix branch from cf07dac to 8968fca Compare December 12, 2018 16:38
@compnerd
Copy link
Member Author

@jrose-apple - so, I ran into the same problem as last time, the substitution within the capture doesn't work right and I can't seem to identify how to get that to work (even with a braced version, it doesn't seem to do the substitution correctly). However, wherever possible, I am now using the %target-library-name substitution with a capture instead of spelling it out.

@compnerd
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - cf07dacb3a14153203350c51bf5aff205c617703

@jrose-apple
Copy link
Contributor

lit substitutions are ordered, so just to check: did you try putting your new substitution either before or after the existing substitution, whichever one you hadn't done yet?

@compnerd
Copy link
Member Author

That does the trick! Thanks!

Thanks to @jrose for the hint about the substitution ordering, the new
substitution now works even inside the capture group.  Replace the
remaining uses to the new macro.
@compnerd
Copy link
Member Author

@swift-ci please test and merge

@swift-ci swift-ci merged commit f453092 into swiftlang:master Dec 12, 2018
@compnerd compnerd deleted the library-prefix-suffix branch December 12, 2018 21:38
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.

3 participants