diff options
author | Conrad Poelman <poelmanc@reviews.llvm.org> | 2022-02-12 01:19:01 +0300 |
---|---|---|
committer | Richard <legalize@xmission.com> | 2022-02-12 01:23:51 +0300 |
commit | fc5bf040d810fbad424e609cda1ad56fc15cc403 (patch) | |
tree | d1c6e33d2d69a1b2d94905eeb8d9ad6704c8eec0 /test | |
parent | 43a1756a5d533bbf29bc39f49f04fc76f5c30ce9 (diff) |
fix check-clang-tools tests that fail due to Windows CRLF line endings
Running check-clang-tools on Windows produces 5 test failures:
Failed Tests (5):
Clang Tools :: clang-apply-replacements/ClangRenameClassReplacements.cpp
Clang Tools :: clang-apply-replacements/basic.cpp
Clang Tools :: clang-apply-replacements/format.cpp
Clang Tools :: clang-move/move-used-helper-decls.cpp
Clang Tools :: clang-tidy/infrastructure/export-diagnostics.cpp
Four of these failures are simply due to fixed character position
offsets differing on Windows versus Linux, since Windows line endings
take up two characters instead of one:
clang-apply-replacements/ClangRenameClassReplacements.cpp runs clang-rename -offset=254
clang-apply-replacements/Inputs/basic/file[12].yaml specify e.g. FileOffset: 148 and Offset: 298
clang-apply-replacements/Inputs/format/{no,yes}.yaml specify e.g. FileOffset: 94 and Offset: 94
clang-tidy/infrastructure/export-diagnostics.cpp specifies e.g. CHECK-YAML-NEXT: FileOffset: 30
(The move-used-helper-decls.cpp failure seems more complex; clang-move
adds a blank line after void HelperFun1() {} when
clang-move/Inputs/helper_decls_test.cpp has LF line endings, but does
not add a blank line when the input files has CRLF line endings. That
difference in behavior seems like it may be an actual bug, but I have
yet to track it down.)
Differential Revision: https://reviews.llvm.org/D97625
Diffstat (limited to 'test')
-rw-r--r-- | test/.gitattributes | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/.gitattributes b/test/.gitattributes new file mode 100644 index 000000000000..9d17a32c7b26 --- /dev/null +++ b/test/.gitattributes @@ -0,0 +1,19 @@ +# CRLF (Windows) line endings take two bytes instead of one, so any tests that +# rely on or check fixed character -offset, Offset: or FileOffset: locations +# will fail when run on input files checked out with different line endings. + +# Most test input files should use native line endings, to ensure that we run +# tests against both line ending types. +* text=auto + +# These test input files rely on one-byte Unix (LF) line-endings, as they use +# fixed -offset, FileOffset:, or Offset: numbers in their tests. +clang-apply-replacements/ClangRenameClassReplacements.cpp text eol=lf +clang-apply-replacements/Inputs/basic/basic.h text eol=lf +clang-apply-replacements/Inputs/format/no.cpp text eol=lf +clang-apply-replacements/Inputs/format/yes.cpp text eol=lf +clang-tidy/infrastructure/export-diagnostics.cpp text eol=lf + +# These test input files rely on two-byte Windows (CRLF) line endings. +clang-apply-replacements/Inputs/crlf/crlf.cpp text eol=crlf +clang-apply-replacements/Inputs/crlf/crlf.cpp.expected text eol=crlf |