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