xref: /aosp_15_r20/external/libultrahdr/fuzzer/ossfuzz.sh (revision 89a0ef05262152531a00a15832a2d3b1e3990773)
1#!/bin/bash -eu
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15################################################################################
16# Ensure SRC and WORK are set
17test "${SRC}" != "" || exit 1
18test "${WORK}" != "" || exit 1
19
20# Build libultrahdr
21build_dir=$WORK/build
22rm -rf ${build_dir}
23mkdir -p ${build_dir}
24pushd ${build_dir}
25
26cmake $SRC/libultrahdr -DUHDR_BUILD_FUZZERS=1 -DUHDR_MAX_DIMENSION=1280
27make -j$(nproc) ultrahdr_dec_fuzzer ultrahdr_enc_fuzzer ultrahdr_legacy_fuzzer
28cp ${build_dir}/ultrahdr_dec_fuzzer $OUT/
29cp ${build_dir}/ultrahdr_enc_fuzzer $OUT/
30cp ${build_dir}/ultrahdr_legacy_fuzzer $OUT/
31popd
32