• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eu
2# Copyright 2016 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
18# Build the project.
19./buildconf
20./configure --enable-debug
21make clean
22make -j$(nproc) V=1 all
23
24# Build the fuzzers.
25$CC $CFLAGS -Iinclude -Isrc/lib -c $SRC/c-ares/test/ares-test-fuzz.c -o $WORK/ares-test-fuzz.o
26$CXX $CXXFLAGS -std=c++11 $WORK/ares-test-fuzz.o \
27    -o $OUT/ares_parse_reply_fuzzer \
28    $LIB_FUZZING_ENGINE $SRC/c-ares/src/lib/.libs/libcares.a
29
30$CC $CFLAGS -Iinclude -Isrc/lib -c $SRC/c-ares/test/ares-test-fuzz-name.c \
31    -o $WORK/ares-test-fuzz-name.o
32$CXX $CXXFLAGS -std=c++11 $WORK/ares-test-fuzz-name.o \
33    -o $OUT/ares_create_query_fuzzer \
34    $LIB_FUZZING_ENGINE $SRC/c-ares/src/lib/.libs/libcares.a
35
36# Archive and copy to $OUT seed corpus if the build succeeded.
37zip -j $OUT/ares_parse_reply_fuzzer_seed_corpus.zip $SRC/c-ares/test/fuzzinput/*
38zip -j $OUT/ares_create_query_fuzzer_seed_corpus.zip \
39    $SRC/c-ares/test/fuzznames/*
40