• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3#  Copyright (c) 2021, The OpenThread Authors.
4#  All rights reserved.
5#
6#  Redistribution and use in source and binary forms, with or without
7#  modification, are permitted provided that the following conditions are met:
8#  1. Redistributions of source code must retain the above copyright
9#     notice, this list of conditions and the following disclaimer.
10#  2. Redistributions in binary form must reproduce the above copyright
11#     notice, this list of conditions and the following disclaimer in the
12#     documentation and/or other materials provided with the distribution.
13#  3. Neither the name of the copyright holder nor the
14#     names of its contributors may be used to endorse or promote products
15#     derived from this software without specific prior written permission.
16#
17#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27#  POSSIBILITY OF SUCH DAMAGE.
28#
29
30(
31    mkdir build
32    cd build || exit
33
34    cmake -GNinja \
35        -DCMAKE_C_FLAGS="${CFLAGS}" \
36        -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
37        -DOT_BUILD_EXECUTABLES=OFF \
38        -DOT_FUZZ_TARGETS=ON \
39        -DOT_MTD=OFF \
40        -DOT_PLATFORM=external \
41        -DOT_RCP=OFF \
42        -DOT_BORDER_AGENT=ON \
43        -DOT_BORDER_ROUTER=ON \
44        -DOT_CHANNEL_MANAGER=ON \
45        -DOT_CHANNEL_MONITOR=ON \
46        -DOT_CHILD_SUPERVISION=ON \
47        -DOT_COAP=ON \
48        -DOT_COAPS=ON \
49        -DOT_COAP_BLOCK=ON \
50        -DOT_COAP_OBSERVE=ON \
51        -DOT_COMMISSIONER=ON \
52        -DOT_DATASET_UPDATER=ON \
53        -DOT_DHCP6_CLIENT=ON \
54        -DOT_DHCP6_SERVER=ON \
55        -DOT_DNS_CLIENT=ON \
56        -DOT_ECDSA=ON \
57        -DOT_HISTORY_TRACKER=ON \
58        -DOT_IP6_FRAGM=ON \
59        -DOT_JAM_DETECTION=ON \
60        -DOT_JOINER=ON \
61        -DOT_LINK_RAW=ON \
62        -DOT_LOG_OUTPUT=APP \
63        -DOT_MAC_FILTER=ON \
64        -DOT_MTD_NETDIAG=ON \
65        -DOT_NETDATA_PUBLISHER=ON \
66        -DOT_PING_SENDER=ON \
67        -DOT_SERVICE=ON \
68        -DOT_SLAAC=ON \
69        -DOT_SNTP_CLIENT=ON \
70        -DOT_SRP_CLIENT=ON \
71        -DOT_SRP_SERVER=ON \
72        -DOT_THREAD_VERSION=1.2 \
73        -DOT_UPTIME=ON \
74        ..
75    ninja
76)
77
78find . -name '*-fuzzer' -exec cp -v '{}' "$OUT" ';'
79find . -name '*-fuzzer.dict' -exec cp -v '{}' "$OUT" ';'
80find . -name '*-fuzzer.options' -exec cp -v '{}' "$OUT" ';'
81
82fuzzers=$(find build/tests/fuzz -name "*-fuzzer")
83for f in $fuzzers; do
84    fuzzer=$(basename "$f" -fuzzer)
85
86    if [ -d "tests/fuzz/corpora/${fuzzer}" ]; then
87        zip -j "$OUT/$(basename "$f")"_seed_corpus.zip tests/fuzz/corpora/"${fuzzer}"/*
88    fi
89done
90