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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/Misc/stats_dir_long_path_name.swift
Original file line number Diff line number Diff line change
@@ -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: 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.

// 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.

// RUN: %utils/process-stats-dir.py --set-csv-baseline %t/frontend.csv %t
// RUN: %FileCheck -input-file %t/frontend.csv %s

// CHECK: {{"AST.NumSourceLines" [1-9][0-9]*$}}
// CHECK: {{"IRModule.NumIRFunctions" [1-9][0-9]*$}}
// CHECK: {{"LLVM.NumLLVMBytesOutput" [1-9][0-9]*$}}

public func foo() {
print("hello")
}