Skip to content

check_format fails on master on MacOS #1764

@rosenhouse

Description

@rosenhouse

setup:

  • a clean checkout of the master branch
  • clang-format --version showing
    clang-format version 5.0.0 (tags/google/stable/2017-06-22)
    
  • clang --version showing
    Apple LLVM version 8.1.0 (clang-802.0.42)
    Target: x86_64-apple-darwin16.7.0
    Thread model: posix
    InstalledDir:    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    

when I run

BUILDIFIER=`which buildifier` CLANG_FORMAT=clang-format ./tools/check_format.py check

then I see

ERROR: clang-format check failed for file: ./test/common/grpc/async_client_impl_test.cc
ERROR: clang-format check failed for file: ./test/common/http/http1/codec_impl_test.cc
ERROR: clang-format check failed for file: ./test/common/upstream/outlier_detection_impl_test.cc
ERROR: clang-format check failed for file: ./test/integration/cors_filter_integration_test.cc
ERROR: check format failed. run 'tools/check_format.py fix'

and then with fix I get this diff against master:

diff --git a/test/common/grpc/async_client_impl_test.cc b/test/common/grpc/async_client_impl_test.cc
index 363cb6dba..68497e23c 100644
--- a/test/common/grpc/async_client_impl_test.cc
+++ b/test/common/grpc/async_client_impl_test.cc
@@ -477,8 +477,7 @@ TEST_F(GrpcAsyncClientImplTest, ReplyNoTrailers) {
 // Validate that send client initial metadata works.
 TEST_F(GrpcAsyncClientImplTest, StreamClientInitialMetadata) {
   TestMetadata initial_metadata = {
-      {Http::LowerCaseString("foo"), "bar"},
-      {Http::LowerCaseString("baz"), "blah"},
+      {Http::LowerCaseString("foo"), "bar"}, {Http::LowerCaseString("baz"), "blah"},
   };
   auto stream = createStream(initial_metadata);
   expectResetOn(stream.get());
@@ -487,8 +486,7 @@ TEST_F(GrpcAsyncClientImplTest, StreamClientInitialMetadata) {
 // Validate that send client initial metadata works.
 TEST_F(GrpcAsyncClientImplTest, RequestClientInitialMetadata) {
   TestMetadata initial_metadata = {
-      {Http::LowerCaseString("foo"), "bar"},
-      {Http::LowerCaseString("baz"), "blah"},
+      {Http::LowerCaseString("foo"), "bar"}, {Http::LowerCaseString("baz"), "blah"},
   };
   auto request = createRequest(initial_metadata);
   dangling_streams_.push_back(request->http_stream_);
@@ -500,8 +498,7 @@ TEST_F(GrpcAsyncClientImplTest, ServerInitialMetadata) {
   auto stream = createStream(empty_metadata);
   stream->sendRequest();
   TestMetadata initial_metadata = {
-      {Http::LowerCaseString("foo"), "bar"},
-      {Http::LowerCaseString("baz"), "blah"},
+      {Http::LowerCaseString("foo"), "bar"}, {Http::LowerCaseString("baz"), "blah"},
   };
   stream->sendServerInitialMetadata(initial_metadata);
   expectResetOn(stream.get());
@@ -515,8 +512,7 @@ TEST_F(GrpcAsyncClientImplTest, ServerTrailingMetadata) {
   stream->sendServerInitialMetadata(empty_metadata);
   stream->sendReply();
   TestMetadata trailing_metadata = {
-      {Http::LowerCaseString("foo"), "bar"},
-      {Http::LowerCaseString("baz"), "blah"},
+      {Http::LowerCaseString("foo"), "bar"}, {Http::LowerCaseString("baz"), "blah"},
   };
   stream->sendServerTrailers(Status::GrpcStatus::Ok, "", trailing_metadata);
   expectResetOn(stream.get());
diff --git a/test/common/http/http1/codec_impl_test.cc b/test/common/http/http1/codec_impl_test.cc
index 767248489..7cad4a201 100644
--- a/test/common/http/http1/codec_impl_test.cc
+++ b/test/common/http/http1/codec_impl_test.cc
@@ -92,10 +92,7 @@ TEST_F(Http1ServerConnectionImplTest, EmptyHeader) {
   EXPECT_CALL(callbacks_, newStream(_)).WillOnce(ReturnRef(decoder));
 
   TestHeaderMapImpl expected_headers{
-      {"Test", ""},
-      {"Hello", "World"},
-      {":path", "/"},
-      {":method", "GET"},
+      {"Test", ""}, {"Hello", "World"}, {":path", "/"}, {":method", "GET"},
   };
   EXPECT_CALL(decoder, decodeHeaders_(HeaderMapEqual(&expected_headers), true)).Times(1);
 
diff --git a/test/common/upstream/outlier_detection_impl_test.cc b/test/common/upstream/outlier_detection_impl_test.cc
index 06f3c81ad..b82e1884b 100644
--- a/test/common/upstream/outlier_detection_impl_test.cc
+++ b/test/common/upstream/outlier_detection_impl_test.cc
@@ -236,10 +236,7 @@ TEST_F(OutlierDetectorImplTest, BasicFlow5xx) {
 TEST_F(OutlierDetectorImplTest, BasicFlowSuccessRate) {
   EXPECT_CALL(cluster_, addMemberUpdateCb(_));
   addHosts({
-      "tcp://127.0.0.1:80",
-      "tcp://127.0.0.1:81",
-      "tcp://127.0.0.1:82",
-      "tcp://127.0.0.1:83",
+      "tcp://127.0.0.1:80", "tcp://127.0.0.1:81", "tcp://127.0.0.1:82", "tcp://127.0.0.1:83",
       "tcp://127.0.0.1:84",
   });
 
diff --git a/test/integration/cors_filter_integration_test.cc b/test/integration/cors_filter_integration_test.cc
index 8662c39d1..67f34758b 100644
--- a/test/integration/cors_filter_integration_test.cc
+++ b/test/integration/cors_filter_integration_test.cc
@@ -102,9 +102,7 @@ TEST_P(CorsFilterIntegrationTest, TestRouteConfigBadOrigin) {
           {"origin", "test-origin"},
       },
       Http::TestHeaderMapImpl{
-          {"server", "envoy"},
-          {"content-length", "0"},
-          {":status", "200"},
+          {"server", "envoy"}, {"content-length", "0"}, {":status", "200"},
       });
 }
 
@@ -119,9 +117,7 @@ TEST_P(CorsFilterIntegrationTest, TestCorsDisabled) {
           {"origin", "test-origin"},
       },
       Http::TestHeaderMapImpl{
-          {"server", "envoy"},
-          {"content-length", "0"},
-          {":status", "200"},
+          {"server", "envoy"}, {"content-length", "0"}, {":status", "200"},
       });
 }

If I instead run

ENVOY_DOCKER_BUILD_DIR=$HOME/tmp ./ci/run_envoy_docker.sh './ci/do_ci.sh check_format'

on a clean checkout of master, then check_format succeeds. But if I run it against what the Mac version fixed (i.e. the diff above), then the Linux version complains about those same files.

So it's something about MacOS or my tool versions?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions