mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Added fuzzing to travis
This commit is contained in:
		| @@ -114,6 +114,12 @@ matrix: | |||||||
|     - env: SCRIPT=arduino VERSION=1.8.2 BOARD=arduino:avr:uno |     - env: SCRIPT=arduino VERSION=1.8.2 BOARD=arduino:avr:uno | ||||||
|     - env: SCRIPT=platformio BOARD=uno |     - env: SCRIPT=platformio BOARD=uno | ||||||
|     - env: SCRIPT=platformio BOARD=esp01 |     - 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: | cache: | ||||||
|   directories: |   directories: | ||||||
|     - "~/.platformio" |     - "~/.platformio" | ||||||
|   | |||||||
| @@ -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
									
								
								scripts/travis/fuzz.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								scripts/travis/fuzz.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -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 | ||||||
		Reference in New Issue
	
	Block a user