ソースを参照

Merge branch 'master' into 6.x

Benoit Blanchon 7 年 前
コミット
4ff6809bc5
3 ファイル変更50 行追加9 行削除
  1. 30 0
      .travis.yml
  2. 0 9
      fuzzing/fuzz.sh
  3. 20 0
      scripts/travis/fuzz.sh

+ 30 - 0
.travis.yml

@@ -70,6 +70,30 @@ matrix:
           sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.8']
           packages: ['clang-3.8']
       env: SCRIPT=cmake CLANG=3.8 SANITIZE=undefined
+    - compiler: clang
+      addons:
+        apt:
+          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-3.9']
+          packages: ['clang-3.9']
+      env: SCRIPT=cmake CLANG=3.9
+    - compiler: clang
+      addons:
+        apt:
+          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-4.0']
+          packages: ['clang-4.0']
+      env: SCRIPT=cmake CLANG=4.0
+    - compiler: clang
+      addons:
+        apt:
+          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-5.0']
+          packages: ['clang-5.0']
+      env: SCRIPT=cmake CLANG=5.0
+    - compiler: clang
+      addons:
+        apt:
+          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-6.0']
+          packages: ['clang-6.0']
+      env: SCRIPT=cmake CLANG=6.0
     - compiler: gcc
       env: SCRIPT=coverage
     - os: osx
@@ -84,6 +108,12 @@ matrix:
     - env: SCRIPT=arduino VERSION=1.8.2 BOARD=arduino:avr:uno
     - env: SCRIPT=platformio BOARD=uno
     - env: SCRIPT=platformio BOARD=esp01
+    - compiler: clang
+      addons:
+        apt:
+          sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-6.0']
+          packages: ['clang-6.0','llvm-6.0']
+      env: SCRIPT=fuzz CLANG=6.0
 cache:
   directories:
     - "~/.platformio"

+ 0 - 9
fuzzing/fuzz.sh

@@ -1,9 +0,0 @@
-#!/bin/bash
-# This script mimics an invocation from https://github.com/google/oss-fuzz
-
-cd $(dirname $0)
-export CXX='clang++'
-export CXXFLAGS='-fsanitize-coverage=trace-pc-guard -fsanitize=address'
-export LIB_FUZZING_ENGINE=-lFuzzer
-make OUT=.
-./json_fuzzer my_corpus seed_corpus -max_len=1024 -timeout=10

+ 20 - 0
scripts/travis/fuzz.sh

@@ -0,0 +1,20 @@
+#!/bin/bash -eux
+
+ROOT_DIR=$(dirname $0)/../../
+INCLUDE_DIR=$ROOT_DIR/src/
+FUZZING_DIR=$ROOT_DIR/fuzzing/
+JSON_CORPUS_DIR=$FUZZING_DIR/my_corpus
+JSON_SEED_CORPUS_DIR=$FUZZING_DIR/seed_corpus
+
+CXX="clang++-$CLANG"
+CXXFLAGS="-g -fprofile-instr-generate -fcoverage-mapping -fsanitize=address,fuzzer"
+
+$CXX $CXXFLAGS -o json_fuzzer -I$INCLUDE_DIR $FUZZING_DIR/fuzzer.cpp
+
+export ASAN_OPTIONS="detect_leaks=0"
+export LLVM_PROFILE_FILE="json_fuzzer.profraw"
+./json_fuzzer "$JSON_CORPUS_DIR" "$JSON_SEED_CORPUS_DIR" -max_total_time=60
+
+llvm-profdata-$CLANG merge -sparse json_fuzzer.profraw -o json_fuzzer.profdata
+
+llvm-cov-$CLANG report ./json_fuzzer -instr-profile=json_fuzzer.profdata