[PATCH] D28419: clang-tools-extra: add gitattributes to disable EOL conversions on checkout of test source files

2017-01-10 Thread Antonio Maiorano via Phabricator via cfe-commits
amaiorano added a comment.

Last night, I realized that this problem extends to the clang/tests as well, 
not just those in clang-tools-extra. Is there someone who knows Windows, Git, 
and the testing pipeline that can weigh in more on this topic?


https://reviews.llvm.org/D28419



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28419: clang-tools-extra: add gitattributes to disable EOL conversions on checkout of test source files

2017-01-09 Thread Antonio Maiorano via Phabricator via cfe-commits
amaiorano added a comment.

Hello, sorry for the lack of details here. I will re-run the tests later and 
report here the tests that are failing along with output.

The main issue is that when using Git on Windows, by default the installer will 
set core.autocrlf to true, which is a Git config variable that tells Git to 
automatically convert line endings to CRLF for text files on checkout, and back 
to LF on staging. Some of the tests expect LF line endings - for instance, when 
specifying absolute offsets for replacements, these offsets are incorrect when 
there are extra "CR" bytes in the file, which end up making the tests fail 
since the output doesn't match the expected output.

Note that on Linux, I believe core.autocrlf isn't usually set, so it defaults 
to false (could someone verify this for me?). Since files in Git are usually 
'LF', this works fine for Linux users. On Windows, you usually want the CRLF 
line endings on source files because not all Windows text editors are good at 
being consistent with line endings.

The solution I propose here is to add a single .gitattributes file that 
specifies that all .h and .cpp files under clang/tools/extra/test should be 
checked out with whatever line endings they were checked in with. In other 
words, don't convert line endings at all for these files. This means existing 
test source files that have LF will continue to have LF when checked out in 
Git, or if they have CRLF (which is the case for crlf.cpp), it will be checked 
out with CRLF line endings.

Another consequence of this change is that if a Windows developer decides to 
add a new test, they'd create a test source file with CRLF line endings, and 
this file would be committed with these CRLF line endings. This would work fine 
on Linux since the file would be checked out as-is as well (with CRLF line 
endings), and the test would run fine. However, without this change, the 
Windows developer would write a test that works fine on Windows, then when 
staging the file, the CRLF would be converted to LF and the test would fail on 
Linux.

Alternative solutions:

1. Instead of applying the no eol conversion to ALL .h/.cpp under test, we 
could add explicit entries to the .h/.cpp files that specifically require them 
for their tests (those that specify offsets for replacements, for e.g.)
2. Instead of a single .gitattributes file at the root of the extra/ directory, 
we can add one to each test directory that requires it, specifying the exact 
files in that test directory that needs to not apply eol conversions.

Again, I will post the specific failures as soon as I get the chance.


https://reviews.llvm.org/D28419



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28419: clang-tools-extra: add gitattributes to disable EOL conversions on checkout of test source files

2017-01-09 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons resigned from this revision.
malcolm.parsons removed a reviewer: malcolm.parsons.
malcolm.parsons added a comment.

Which tests?
How does this interact with svn's eol-style property?

Resigning as not something I know about.


https://reviews.llvm.org/D28419



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28419: clang-tools-extra: add gitattributes to disable EOL conversions on checkout of test source files

2017-01-09 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment.

I'm not entirely sure about this change... looping in Manuel.


https://reviews.llvm.org/D28419



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28419: clang-tools-extra: add gitattributes to disable EOL conversions on checkout of test source files

2017-01-06 Thread Antonio Maiorano via Phabricator via cfe-commits
amaiorano created this revision.
amaiorano added reviewers: malcolm.parsons, ioeric.
amaiorano added a subscriber: cfe-commits.

Certain tests expect their input files to have LF line endings, while others 
expect CRLF. On Windows, when using Git with core.autocrlf=true, these tests 
fail because all source files are checked out with CRLF line endings. This 
change makes sure that these files are not converted at all on checkout.


https://reviews.llvm.org/D28419

Files:
  .gitattributes


Index: .gitattributes
===
--- /dev/null
+++ .gitattributes
@@ -0,0 +1,5 @@
+text=auto
+
+# Disable eol conversions as certain tests rely on specific line endings
+test/**/*.h -text
+test/**/*.cpp -text


Index: .gitattributes
===
--- /dev/null
+++ .gitattributes
@@ -0,0 +1,5 @@
+text=auto
+
+# Disable eol conversions as certain tests rely on specific line endings
+test/**/*.h -text
+test/**/*.cpp -text
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits