This is an archive of the discontinued LLVM Phabricator instance.

Fixed tests where grep was not matching the linefeed
ClosedPublic

Authored by aganea on May 3 2019, 5:50 AM.

Diff Detail

Repository
rC Clang

Event Timeline

aganea created this revision.May 3 2019, 5:50 AM
aganea edited the summary of this revision. (Show Details)May 3 2019, 5:51 AM
lebedev.ri requested changes to this revision.May 3 2019, 6:04 AM
lebedev.ri added a subscriber: lebedev.ri.

The tests should be fixed to use FileCheck.

This revision now requires changes to proceed.May 3 2019, 6:04 AM

Checked-in files should not have CRLF endings, in general (there are a very few exceptions, and these aren't among them).
If the checked-in files have LF endings but your tool checks them out with CRLF then that is a problem with your config, or with the tool.
Adding dos2unix to the RUN lines is the wrong fix, either way.

aganea updated this revision to Diff 197990.May 3 2019, 6:34 AM

Changed to use FileCheck instead of grep

aganea added a comment.May 3 2019, 6:34 AM

Checked-in files should not have CRLF endings, in general (there are a very few exceptions, and these aren't among them).
If the checked-in files have LF endings but your tool checks them out with CRLF then that is a problem with your config, or with the tool.
Adding dos2unix to the RUN lines is the wrong fix, either way.

Yeah I've realized that :) This is caused by svn on Windows which sets svn:eol-style=native by default, which causes local files to be saved in the "native" format, which is CRLF on Windows (even though in upstream they are LF) When files are commited, normally svn should convert them back to LF (or at least that's the contract for svn:eol-style=native).

native
This causes the file to contain the EOL markers that are native to the operating system on which Subversion was run. In other words, if a user on a Windows machine checks out a working copy that contains a file with an svn:eol-style property set to native, that file will contain CRLF EOL markers. A Unix user checking out a working copy that contains the same file will see LF EOL markers in his copy of the file.

Note that Subversion will actually store the file in the repository using normalized LF EOL markers regardless of the operating system. This is basically transparent to the user, though.

I'm using the MINGW32 bash to run the tests/check-all because it comes with all the Unix tools (grep, sed, ...) that Windows doesn't have.
The bug here is that the GNU grep only matches LF, not CRLF.

lebedev.ri accepted this revision.May 3 2019, 1:42 PM

Sure, this looks better.

clang/trunk/test/Preprocessor/indent_macro.c
1–2 ↗(On Diff #197990)

Separate with newline

clang/trunk/test/Preprocessor/macro_fn_varargs_named.c
1–6 ↗(On Diff #197990)
// RUN: %clang_cc1 -E %s | FileCheck %s --match-full-lines --strict-whitespace --check-prefix CHECK-1
// RUN: %clang_cc1 -E %s | FileCheck %s --match-full-lines --strict-whitespace --check-prefix CHECK-2
// RUN: %clang_cc1 -E %s | FileCheck %s --match-full-lines --strict-whitespace --check-prefix CHECK-3

// CHECK-1:a: x
// CHECK-2:b: x y, z,h
// CHECK-3:c: foo(x)
This revision is now accepted and ready to land.May 3 2019, 1:42 PM
aganea marked an inline comment as done.May 6 2019, 6:47 AM
aganea added inline comments.
clang/trunk/test/Preprocessor/indent_macro.c
1–2 ↗(On Diff #197990)

What do you mean? Between RUN and CHECK? There's already a newline a L3.

This revision was automatically updated to reflect the committed changes.