Skip to content

Commit

Permalink
Bug 1204998 - travis.yml with clang-format 3.8, mac and asan builds, …
Browse files Browse the repository at this point in the history
…r=mt,ekr
  • Loading branch information
franziskuskiefer committed May 2, 2016
1 parent f82e47d commit 5494d4b
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .clang-format
Expand Up @@ -15,7 +15,7 @@ AllowShortFunctionsOnASingleLine: All
AlwaysBreakAfterDefinitionReturnType: true
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: None
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
Expand Down
65 changes: 65 additions & 0 deletions .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
18 changes: 18 additions & 0 deletions 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

0 comments on commit 5494d4b

Please sign in to comment.