ci: add amd64-clang-fuzz daily ci check #33
					 2 changed files with 72 additions and 0 deletions
				
			
		
							
								
								
									
										15
									
								
								.drone.yml
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								.drone.yml
									
										
									
									
									
								
							| 
						 | 
					@ -1,3 +1,18 @@
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					kind: pipeline
 | 
				
			||||||
 | 
					type: docker
 | 
				
			||||||
 | 
					name: daily — amd64 — clang
 | 
				
			||||||
 | 
					trigger:
 | 
				
			||||||
 | 
					  branch:
 | 
				
			||||||
 | 
					  - main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					- name: fuzz
 | 
				
			||||||
 | 
					  image: amd64_clang_fuzz:latest
 | 
				
			||||||
 | 
					  pull: if-not-exists
 | 
				
			||||||
 | 
					  commands:
 | 
				
			||||||
 | 
					    - ./tools/ci/amd64/clang/fuzz.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
kind: pipeline
 | 
					kind: pipeline
 | 
				
			||||||
type: exec
 | 
					type: exec
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										57
									
								
								tools/ci/amd64/clang/fuzz.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										57
									
								
								tools/ci/amd64/clang/fuzz.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,57 @@
 | 
				
			||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -e
 | 
				
			||||||
 | 
					cd $(git rev-parse --show-toplevel)/
 | 
				
			||||||
 | 
					# rm -rf ./build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export CC=$(which afl-clang-lto)
 | 
				
			||||||
 | 
					export CXX=$(which afl-clang-lto++)
 | 
				
			||||||
 | 
					export AR=$(which llvm-ar)
 | 
				
			||||||
 | 
					export RANLIB=$(which llvm-ranlib)
 | 
				
			||||||
 | 
					export AS=$(which llvm-as)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					conan build . \
 | 
				
			||||||
 | 
					    -c tools.system.package_manager:mode=install \
 | 
				
			||||||
 | 
					    -c tools.cmake.cmaketoolchain:generator=Ninja \
 | 
				
			||||||
 | 
					    -c tools.build:compiler_executables='{"c": "afl-clang-lto", "cpp": "afl-clang-lto++"}' \
 | 
				
			||||||
 | 
					    -s build_type=Release \
 | 
				
			||||||
 | 
					    -s compiler=clang \
 | 
				
			||||||
 | 
					    -s compiler.version=20 \
 | 
				
			||||||
 | 
					    -s compiler.libcxx=libc++ \
 | 
				
			||||||
 | 
					    -o use_mold=True \
 | 
				
			||||||
 | 
					    --build=missing \
 | 
				
			||||||
 | 
					    --build=missing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fuzz_test_count=$(find ./build -type f -name '*_fuzz' -executable | wc -l)
 | 
				
			||||||
 | 
					total_fuzz_time=60 # in seconds
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					time_per_fuzz=$((total_fuzz_time / fuzz_test_count))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Fuzz test count: ${fuzz_test_count}"
 | 
				
			||||||
 | 
					echo "Total fuzz time: ${total_fuzz_time}"
 | 
				
			||||||
 | 
					echo "Time per fuzz: ${time_per_fuzz}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export AFL_SKIP_CPUFREQ=1
 | 
				
			||||||
 | 
					export AFL_NO_UI=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for fuzz_name in $(find ./build -type f -name '*_fuzz' -executable); do
 | 
				
			||||||
 | 
					    base_name=$(basename $fuzz_name)
 | 
				
			||||||
 | 
					    out_path="/fuzz/${base_name}_out"
 | 
				
			||||||
 | 
					    in_path="/fuzz/${base_name}_in"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    echo "Running ${fuzz_name} for ${time_per_fuzz} seconds..."
 | 
				
			||||||
 | 
					    echo "base_name: ${base_name}"
 | 
				
			||||||
 | 
					    echo "out_path: ${out_path}"
 | 
				
			||||||
 | 
					    echo "in_path: ${in_path}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ ! -e $dir ]]; then
 | 
				
			||||||
 | 
					        echo "No directories detected for ${base_name}"
 | 
				
			||||||
 | 
					        echo "Creating dummy files..."
 | 
				
			||||||
 | 
					        mkdir -p ${in_path}
 | 
				
			||||||
 | 
					        mkdir -p ${out_path}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        echo "0" > ${in_path}/a
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    afl-fuzz -V $time_per_fuzz -i $in_path -o $out_path -- $fuzz_name
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue