Skip to content

[Stats] Add a test for long input-path bug (0e5b982d) #12279

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
Oct 5, 2017

Conversation

graydon
Copy link
Contributor

@graydon graydon commented Oct 4, 2017

Add a testcase for the bug in 0e5b982 where we were forming over-long stats-dir output filenames.

@graydon graydon requested a review from jrose-apple October 4, 2017 21:02
// RUN: mkdir -p %t/very-long-directory-name-that-contains-over-128-characters-which-is-not-enough-to-be-illegal-on-its-own-but-presents
// RUN: cp %s %t/very-long-directory-name-that-contains-over-128-characters-which-is-not-enough-to-be-illegal-on-its-own-but-presents/a-problem-when-combined-with-other-long-path-elements-and-filenames-to-exceed-256-characters-combined-because-yay-arbitrary-limits-amirite.swift
// RUN: touch %t/main.swift
// RUN: %target-swiftc_driver -o %t/main -module-name main -stats-output-dir %t %t/main.swift %t/very-long-directory-name-that-contains-over-128-characters-which-is-not-enough-to-be-illegal-on-its-own-but-presents/a-problem-when-combined-with-other-long-path-elements-and-filenames-to-exceed-256-characters-combined-because-yay-arbitrary-limits-amirite.swift
Copy link
Contributor

Choose a reason for hiding this comment

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

Why %target-swiftc_driver rather than %target-build-swift?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not clear on the difference! Does it matter here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it probably doesn't. %target-build-swift includes things like "pass -O when testing optimized", and that's not so relevant for this test. I mostly asked because I just default to %target-build-swift and wondered why you didn't.

@@ -0,0 +1,16 @@
// REQUIRES: OS=macosx
// RUN: rm -rf %t && mkdir -p %t
// RUN: mkdir -p %t/very-long-directory-name-that-contains-over-128-characters-which-is-not-enough-to-be-illegal-on-its-own-but-presents
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 it doesn't matter that the total path at this point may or may not be over 256?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope. we're just trying to force it to be >256 when combined with the file and mangled into a string that has no path separators, so we need at least two big segments in the combined path. Extra big segments in %t will just make it fail more-thoroughly.

// RUN: rm -rf %t && mkdir -p %t
// RUN: mkdir -p %t/very-long-directory-name-that-contains-over-128-characters-which-is-not-enough-to-be-illegal-on-its-own-but-presents
// RUN: cp %s %t/very-long-directory-name-that-contains-over-128-characters-which-is-not-enough-to-be-illegal-on-its-own-but-presents/a-problem-when-combined-with-other-long-path-elements-and-filenames-to-exceed-256-characters-combined-because-yay-arbitrary-limits-amirite.swift
// RUN: touch %t/main.swift
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have a main file at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to get the frontend invoked with a designated primary-file (not just 'all'), and this is the nearest to how it happens in the field: a multi-file compilation.

@graydon
Copy link
Contributor Author

graydon commented Oct 4, 2017

@swift-ci please smoke test and merge

@graydon
Copy link
Contributor Author

graydon commented Oct 4, 2017

@swift-ci please smoke test Linux platform

@graydon
Copy link
Contributor Author

graydon commented Oct 4, 2017

@swift-ci please clean smoke test Linux platform

@graydon graydon merged commit aeebd88 into swiftlang:master Oct 5, 2017
@graydon graydon deleted the stats-output-dir-filename-issues branch November 17, 2017 18:29
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