summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranziskus Kiefer <franziskuskiefer@gmail.com>2016-05-02 10:12:29 +0200
committerFranziskus Kiefer <franziskuskiefer@gmail.com>2016-05-02 10:12:29 +0200
commitb88292088a2de40bd88b6460fda22d7edcb03293 (patch)
tree70b3abb3a76e13b2aa36753700270a7f75702b89
parent0d4e57ec246e2654088ee1d4fc79f2bdb6f18497 (diff)
downloadnss-hg-b88292088a2de40bd88b6460fda22d7edcb03293.tar.gz
Bug 1204998 - travis.yml with clang-format 3.8, mac and asan builds, r=mt,ekr
-rw-r--r--.clang-format2
-rw-r--r--.travis.yml65
-rwxr-xr-xautomation/travis/validate-formatting.sh18
3 files changed, 84 insertions, 1 deletions
diff --git a/.clang-format b/.clang-format
index 67e8bc309..b90d52f42 100644
--- a/.clang-format
+++ b/.clang-format
@@ -15,7 +15,7 @@ AllowShortFunctionsOnASingleLine: All
AlwaysBreakAfterDefinitionReturnType: true
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
-BreakBeforeBinaryOperators: None
+BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..d52ee7102
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,65 @@
+sudo: required
+dist: trusty
+
+addons:
+ apt:
+ sources:
+ # add PPAs with more up-to-date toolchains
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.8
+ packages:
+ # install toolchains
+ - gcc-5
+ - g++-5
+ - clang-3.8
+ # install additional tools
+ - clang-format-3.8
+
+matrix:
+ include:
+ - os: osx
+ compiler: clang-3.8
+ env:
+ - CC=clang-3.8
+ - CCC=clang++-3.8
+ - os: osx
+ compiler: clang-3.8
+ env:
+ - CC=clang-3.8
+ - CCC=clang++-3.8
+ - BUILD_OPT=1
+ - os: linux
+ compiler: gcc
+ env:
+ - CC=gcc-5
+ - CCC=g++-5
+ - os: linux
+ compiler: gcc
+ env:
+ - CC=gcc-5
+ - CCC=g++-5
+ - BUILD_OPT=1
+ - os: linux
+ compiler: gcc
+ env:
+ - CC=gcc-5
+ - CCC=g++-5
+ - USE_ASAN=1
+ - os: linux
+ env: CLANG_FORMAT=1
+ allow_failures:
+ - env: CLANG_FORMAT=1
+
+env:
+ global:
+ - USE_64=1
+ - NSS_ENABLE_TLS_1_3=1
+
+install:
+ - hg clone https://hg.mozilla.org/projects/nspr ../nspr
+ - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install llvm38; fi
+
+script:
+ - if [ -n "$CLANG_FORMAT" ]; then automation/travis/validate-formatting.sh lib/ssl; exit $?; fi
+ - make nss_build_all
+ - cd tests; NSS_TESTS="ssl_gtests pk11_gtests der_gtests util_gtests" NSS_CYCLES=standard ./all.sh
diff --git a/automation/travis/validate-formatting.sh b/automation/travis/validate-formatting.sh
new file mode 100755
index 000000000..246270f88
--- /dev/null
+++ b/automation/travis/validate-formatting.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Apply clang-format 3.8 on the provided folder and verify that this doesn't change any file.
+# If any file differs after formatting, the script eventually exits with 1.
+# Any differences between formatted and unformatted files is printed to stdout to give a hint what's wrong.
+
+STATUS=0
+for i in $(find $1 -type f -name '*.[ch]' -print); do
+ if ! clang-format-3.8 $i | diff $i -; then
+ echo "Sorry, $i is not formatted properly. Please use clang-format 3.8 on your patch before landing."
+ STATUS=1
+ fi
+done
+exit $STATUS