1#!/bin/bash -eu 2# Copyright 2019 Google Inc. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16################################################################################ 17 18cd 'tests' 19 20export LDO=$CXX 21export LDFLAGS="$CXXFLAGS $LIB_FUZZING_ENGINE" 22export CFLAGS="$CFLAGS -MMD" 23 24# Specific to hostap's rules.include: set empty, as we directly set required 25# sanitizer flags in CFLAGS and LDFLAGS (above). 26export FUZZ_FLAGS= 27 28for target in fuzzing/*; do 29 [[ -d "$target" ]] || continue 30 ( 31 cd "$target" 32 make clean 33 34 if [[ "$target" == "fuzzing/tls-server" ]]; then 35 export CFLAGS="$CFLAGS -DCERTDIR='\"hwsim/auth_serv/\"'" 36 fi 37 38 make -j$(nproc) V=1 LIBFUZZER=y 39 mv -v "${target##*/}" "${OUT}/" 40 41 if [[ -d 'corpus' ]]; then 42 (cd 'corpus' && zip "${OUT}/${target##*/}_seed_corpus.zip" *) 43 fi 44 ) 45done 46 47# Copy required data. 48cp -a "hwsim" "${OUT}/" 49