view fetch.sh @ 26:c87782d4bd46

Make robust for latest.zip being missing Handle newly added targets
author Matt Johnston <matt@ucc.asn.au>
date Sat, 14 Dec 2024 20:27:39 +0800
parents 4032153b8b7a
children
line wrap: on
line source

#!/bin/sh

# Fetch new corpus from oss-fuzz and update the repository. Make sure you commit first!

# Before running you need to set up gcloud auth

set -x
set -e

FUZZERS=$(make list-fuzz-targets)

rm -rf dl
mkdir dl
for F in $FUZZERS; do
    gsutil cp gs://dropbear-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/dropbear_$F/latest.zip dl/$F.zip \
        || gsutil cp gs://dropbear-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/dropbear_$F/public.zip dl/$F.zip
done

# need to use "xargs -n 200" to avoid "argument list too long"
for F in $FUZZERS; do
	# 40 characters is a hash - those filenames came from a previous corpus
	# we want to keep manually named files which are handcrafted seeds
    (echo $F/???????????????????????????????????????? | xargs -n 200 rm) || true
	# unzip overwrite, quiet
    mkdir -p $F
    (cd $F; unzip -o -q ../dl/$F.zip)
done

hg addremove $FUZZERS