]> git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/cpp/build-support/fuzzing/generate_corpuses.sh
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / cpp / build-support / fuzzing / generate_corpuses.sh
1 #!/usr/bin/env bash
2 #
3 # Licensed to the Apache Software Foundation (ASF) under one
4 # or more contributor license agreements. See the NOTICE file
5 # distributed with this work for additional information
6 # regarding copyright ownership. The ASF licenses this file
7 # to you under the Apache License, Version 2.0 (the
8 # "License"); you may not use this file except in compliance
9 # with the License. You may obtain a copy of the License at
10 #
11 # http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing,
14 # software distributed under the License is distributed on an
15 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 # KIND, either express or implied. See the License for the
17 # specific language governing permissions and limitations
18 # under the License.
19
20 # Generate and pack seed corpus files, for OSS-Fuzz
21
22 if [ $# -ne 1 ]; then
23 echo "Usage: $0 <build output dir>"
24 exit 1
25 fi
26
27 set -ex
28
29 CORPUS_DIR=/tmp/corpus
30 ARROW_ROOT=$(cd $(dirname $BASH_SOURCE)/../../..; pwd)
31 ARROW_CPP=$ARROW_ROOT/cpp
32 OUT=$1
33
34 # NOTE: name of seed corpus output file should be "<FUZZ TARGET>-seed_corpus.zip"
35 # where "<FUZZ TARGET>" is the exact name of the fuzz target executable the
36 # seed corpus is generated for.
37
38 IPC_INTEGRATION_FILES=$(find ${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration -name "*.stream")
39
40 rm -rf ${CORPUS_DIR}
41 ${OUT}/arrow-ipc-generate-fuzz-corpus -stream ${CORPUS_DIR}
42 # Several IPC integration files can have the same name, make sure
43 # they all appear in the corpus by numbering the duplicates.
44 cp --backup=numbered ${IPC_INTEGRATION_FILES} ${CORPUS_DIR}
45 ${ARROW_CPP}/build-support/fuzzing/pack_corpus.py ${CORPUS_DIR} ${OUT}/arrow-ipc-stream-fuzz_seed_corpus.zip
46
47 rm -rf ${CORPUS_DIR}
48 ${OUT}/arrow-ipc-generate-fuzz-corpus -file ${CORPUS_DIR}
49 ${ARROW_CPP}/build-support/fuzzing/pack_corpus.py ${CORPUS_DIR} ${OUT}/arrow-ipc-file-fuzz_seed_corpus.zip
50
51 rm -rf ${CORPUS_DIR}
52 ${OUT}/arrow-ipc-generate-tensor-fuzz-corpus -stream ${CORPUS_DIR}
53 ${ARROW_CPP}/build-support/fuzzing/pack_corpus.py ${CORPUS_DIR} ${OUT}/arrow-ipc-tensor-stream-fuzz_seed_corpus.zip
54
55 rm -rf ${CORPUS_DIR}
56 ${OUT}/parquet-arrow-generate-fuzz-corpus ${CORPUS_DIR}
57 # Add Parquet testing examples
58 cp ${ARROW_CPP}/submodules/parquet-testing/data/*.parquet ${CORPUS_DIR}
59 ${ARROW_CPP}/build-support/fuzzing/pack_corpus.py ${CORPUS_DIR} ${OUT}/parquet-arrow-fuzz_seed_corpus.zip