aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Michael Lumish <mlumish@google.com>2016-01-07 08:39:00 -0800
committerGravatar Michael Lumish <mlumish@google.com>2016-01-07 08:39:00 -0800
commitbbaad2a7e4d15977b86d5c8a0ca477ab3658f38c (patch)
tree8ae9090c0c8ea5198fa774c55fa3d6617aa06db8 /tools
parent848ee629dd663c03ce9667ead0a8f63e71605a95 (diff)
parent9577b310955b688c0e4104487402c15da86bee8d (diff)
Merge pull request #4606 from ctiller/clangfmt
Actually making the clang format test properly fail sanity.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/distrib/clang_format_code.sh4
-rwxr-xr-xtools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh14
-rwxr-xr-xtools/jenkins/build_docker_and_run_tests.sh3
3 files changed, 16 insertions, 5 deletions
diff --git a/tools/distrib/clang_format_code.sh b/tools/distrib/clang_format_code.sh
index bc913cb6c1..612074acdf 100755
--- a/tools/distrib/clang_format_code.sh
+++ b/tools/distrib/clang_format_code.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -37,5 +37,5 @@ cd $(dirname $0)/../..
docker build -t grpc_clang_format tools/dockerfile/grpc_clang_format
# run clang-format against the checked out codebase
-docker run -e TEST=$TEST --rm=true -v `pwd`:/local-code -t grpc_clang_format /clang_format_all_the_things.sh
+docker run -e TEST=$TEST --rm=true -v ${HOST_GIT_ROOT:-`pwd`}:/local-code -t grpc_clang_format /clang_format_all_the_things.sh
diff --git a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
index 60fd30cd6f..ededc6e809 100755
--- a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
+++ b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+set -e
+
# directories to run against
DIRS="src/core src/cpp test/core test/cpp include"
@@ -50,9 +52,17 @@ if [ "x$TEST" = "x" ]
then
echo $files | xargs $CLANG_FORMAT -i
else
+ ok=yes
for file in $files
do
- $CLANG_FORMAT $file | diff $file -
+ tmp=`mktemp`
+ $CLANG_FORMAT $file > $tmp
+ diff -u $file $tmp || ok=no
+ rm $tmp
done
+ if [ $ok == no ]
+ then
+ false
+ fi
fi
diff --git a/tools/jenkins/build_docker_and_run_tests.sh b/tools/jenkins/build_docker_and_run_tests.sh
index 4ab9909f9f..b911317558 100755
--- a/tools/jenkins/build_docker_and_run_tests.sh
+++ b/tools/jenkins/build_docker_and_run_tests.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -64,6 +64,7 @@ docker run \
-e CCACHE_DIR=/tmp/ccache \
-e XDG_CACHE_HOME=/tmp/xdg-cache-home \
-e THIS_IS_REALLY_NEEDED='see https://github.com/docker/docker/issues/14203 for why docker is awful' \
+ -e HOST_GIT_ROOT=$git_root \
-i $TTY_FLAG \
-v "$git_root:/var/local/jenkins/grpc" \
-v /tmp/ccache:/tmp/ccache \