blob: 4cb6b62bb86def1a9249338a19920733c5b13c3c [file]
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -eu
cd "$SRC/datafusion-sqlparser-rs"
# the base image's RUSTUP_TOOLCHAIN (nightly) overrides the rust-toolchain pin, so we name none
# CXXFLAGS in the image carries -stdlib=libc++ while the cc crate defaults to stdc++, so override.
export CXXSTDLIB=c++
cargo fuzz build -O --all-features --fuzz-dir fuzz
targets=$(cargo fuzz list --fuzz-dir fuzz)
if [ -z "$targets" ]; then
echo "cargo fuzz list named no target" >&2
exit 1
fi
target_dir=fuzz/target/x86_64-unknown-linux-gnu/release
for name in $targets; do
cp "$target_dir/$name" "$OUT/"
# the runner unpacks <target>_seed_corpus.zip as the starting corpus
(cd fuzz/fuzz_seeds && zip -qr "$OUT/${name}_seed_corpus.zip" *)
done