Skip to content

[windows] Fix ParseableInterface tests. #25546

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

Conversation

drodriguez
Copy link
Contributor

@drodriguez drodriguez commented Jun 18, 2019

There were several Unix specific things in the ParseableInterface tests:
the Bash subcommand was used, a Python tool was invoked without an
explicit interpreter, and Unix path separators are used in CHECK lines.

The Bash subcommand is replaced by a Lit substitution. Both swiftmodule
and swiftdoc had substitutions, however swiftinterface uses the target CPU
instead.

The Python tool is invoked with an explicit interpreter.

The Unix paths, instead of adding the ugly {{\|/}} pattern everywhere
are fixed in the PathSanitizing tool instead, that gets a new capability
in Windows compatibility mode where all the Windows path found in the
input are transformed into Windows path with only forward slashes (Unix
slashes) in the output, which can be checked textually against the CHECK
lines.

@drodriguez
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

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

*sigh* Thanks, @drodriguez. Didn't mean to generate so much cleanup work. Would really like a Windows PR smoke test bot at some point!

# (?:[-a-zA-Z0-9_.]+)?\b -> Matches the last path component, which do
# not has a trailing slash, but it is
# optional.
stdin = re.sub(r'\b[a-zA-Z]:(?:\\\\|\\|\/)(?:[-a-zA-Z0-9_.]+(?:\\\\|\\|\/))*(?:[-a-zA-Z0-9_.]+)?\b', replace_slashes, stdin)
Copy link
Contributor

Choose a reason for hiding this comment

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

Yikes. @compnerd?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yikes indeed.

Saleem has already changed a lot of tests with those {{\\\\|/}}, but it makes reading the test files very complicated (IMO). This hopefully will avoid having to add any more of those, and people that work on Unixes will not have to care about Windows. I hope Saleem sees the benefits, but rest assure that I flagged myself after writing this.

Copy link
Member

Choose a reason for hiding this comment

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

I, I .... words... I. If it works? 🤷‍♂

Copy link
Contributor Author

@drodriguez drodriguez left a comment

Choose a reason for hiding this comment

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

sigh Thanks, @drodriguez. Didn't mean to generate so much cleanup work. Would really like a Windows PR smoke test bot at some point!

I'm working towards it, but things get in the way, and changes are slower than I hoped.

# (?:[-a-zA-Z0-9_.]+)?\b -> Matches the last path component, which do
# not has a trailing slash, but it is
# optional.
stdin = re.sub(r'\b[a-zA-Z]:(?:\\\\|\\|\/)(?:[-a-zA-Z0-9_.]+(?:\\\\|\\|\/))*(?:[-a-zA-Z0-9_.]+)?\b', replace_slashes, stdin)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yikes indeed.

Saleem has already changed a lot of tests with those {{\\\\|/}}, but it makes reading the test files very complicated (IMO). This hopefully will avoid having to add any more of those, and people that work on Unixes will not have to care about Windows. I hope Saleem sees the benefits, but rest assure that I flagged myself after writing this.

@compnerd
Copy link
Member

Going to wait until @jrose-apple's comments are addressed before giving this another look.

There were several Unix specific things in the ParseableInterface tests:
the Bash subcommand was used, a Python tool was invoked without an
explicit interpreter, and Unix path separators are used in CHECK lines.

The Bash subcommand is replaced by a Lit substitution. Both swiftmodule
and swiftdoc had substitutions, so swiftinterface gets one which should
about the subcommand.

The Python tool is invoked with an explicit interpreter.

The Unix paths, instead of adding the ugly {{\\|/}} pattern everywhere
are fixed in the PathSanitizing tool instead, that gets a new capability
in Windows compatibility mode where all the Windows path found in the
input are transformed into Windows path with only forward slashes (Unix
slashes) in the output, which can be checked textually against the CHECK
lines.
@drodriguez drodriguez force-pushed the windows-fix-parseable-interface-tests branch from e3a94aa to 80cd48d Compare June 18, 2019 19:43
@drodriguez
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

Ugh, I really don't like the regex subsitutions, but, I suppose it will help with the tests.

@drodriguez drodriguez merged commit 0f2b753 into swiftlang:master Jun 18, 2019
@drodriguez drodriguez deleted the windows-fix-parseable-interface-tests branch June 18, 2019 21:16
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