• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eux
2# Copyright 2017 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5#
6# Copyright 2018 Google Inc.
7#
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12#      http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19#
20################################################################################
21# Builds fuzzers from within a container into /out/ directory.
22# Expects /src/cras to contain a cras checkout.
23
24cd ${SRC}/adhd/cras
25./git_prepare.sh
26./configure
27make -j$(nproc)
28cp ${SRC}/adhd/cras/src/server/rust/target/release/libcras_rust.a /usr/local/lib
29
30CRAS_FUZZERS="rclient_message cras_hfp_slc"
31
32for fuzzer in ${CRAS_FUZZERS};
33do
34$CXX $CXXFLAGS $FUZZER_LDFLAGS \
35  ${SRC}/adhd/cras/src/fuzz/${fuzzer}.cc -o ${OUT}/${fuzzer} \
36  -I ${SRC}/adhd/cras/src/server \
37  -I ${SRC}/adhd/cras/src/common \
38  $(pkg-config --cflags dbus-1) \
39  ${SRC}/adhd/cras/src/.libs/libcrasserver.a \
40  -lcras_rust -lpthread -lrt -ludev -ldl -lm -lsystemd \
41  $LIB_FUZZING_ENGINE \
42  -Wl,-Bstatic -liniparser -lasound -lspeexdsp -ldbus-1 -lsbc -Wl,-Bdynamic
43done
44
45zip -j ${OUT}/rclient_message_corpus.zip ${SRC}/adhd/cras/src/fuzz/corpus/*
46cp "${SRC}/adhd/cras/src/fuzz/cras_hfp_slc.dict" "${OUT}/cras_hfp_slc.dict"
47