Merge pull request 'Measure download time too' (#13) from time-log into main

Reviewed-on: https://git.ts.mattnite.net/mattnite/cairn/pulls/13
This commit is contained in:
Matthew Knight 2026-03-06 10:49:38 +00:00
commit b16d352643
1 changed files with 7 additions and 2 deletions

View File

@ -130,11 +130,14 @@ runs:
rm -rf "${SEEDS}" rm -rf "${SEEDS}"
mkdir -p "${SEEDS}" mkdir -p "${SEEDS}"
echo "Downloading existing corpus..." DL_START=$(date +%s)
cairn corpus download \ cairn corpus download \
-server "${CAIRN_SERVER}" \ -server "${CAIRN_SERVER}" \
-target-id "${CAIRN_TARGET_ID}" \ -target-id "${CAIRN_TARGET_ID}" \
-dir "${SEEDS}" || true -dir "${SEEDS}" || true
DL_ELAPSED=$(( $(date +%s) - DL_START ))
DL_COUNT=$(find "${SEEDS}" -maxdepth 1 -type f | wc -l)
echo "Downloaded ${DL_COUNT} corpus entries (${DL_ELAPSED}s)"
if [ "$(find "${SEEDS}" -maxdepth 1 -type f | wc -l)" -eq 0 ]; then if [ "$(find "${SEEDS}" -maxdepth 1 -type f | wc -l)" -eq 0 ]; then
printf 'A' > "${SEEDS}/seed-0" printf 'A' > "${SEEDS}/seed-0"
@ -170,12 +173,14 @@ runs:
SEED_COUNT=$(find "${SEEDS}" -maxdepth 1 -type f | wc -l) SEED_COUNT=$(find "${SEEDS}" -maxdepth 1 -type f | wc -l)
if [ "${SEED_COUNT}" -gt 1 ]; then if [ "${SEED_COUNT}" -gt 1 ]; then
echo "Minimizing corpus (${SEED_COUNT} inputs)..." echo "Minimizing corpus (${SEED_COUNT} inputs)..."
CMIN_START=$(date +%s)
MINIMIZED="afl-cmin-${TARGET_NUM}" MINIMIZED="afl-cmin-${TARGET_NUM}"
rm -rf "${MINIMIZED}" rm -rf "${MINIMIZED}"
mkdir -p "${MINIMIZED}" mkdir -p "${MINIMIZED}"
if afl-cmin -i "${SEEDS}" -o "${MINIMIZED}" -- "${FUZZ_BIN}" >/dev/null 2>&1; then if afl-cmin -i "${SEEDS}" -o "${MINIMIZED}" -- "${FUZZ_BIN}" >/dev/null 2>&1; then
CMIN_ELAPSED=$(( $(date +%s) - CMIN_START ))
MINIMIZED_COUNT=$(find "${MINIMIZED}" -maxdepth 1 -type f | wc -l) MINIMIZED_COUNT=$(find "${MINIMIZED}" -maxdepth 1 -type f | wc -l)
echo "Corpus minimized: ${SEED_COUNT} -> ${MINIMIZED_COUNT} inputs" echo "Corpus minimized: ${SEED_COUNT} -> ${MINIMIZED_COUNT} inputs (${CMIN_ELAPSED}s)"
rm -rf "${SEEDS}" rm -rf "${SEEDS}"
mv "${MINIMIZED}" "${SEEDS}" mv "${MINIMIZED}" "${SEEDS}"
else else