2018-12-11 21:24:46 +01:00
|
|
|
#!/usr/bin/env bash
|
2020-04-16 10:50:39 +02:00
|
|
|
# Copyright (C) 2017-2020 The Project X-Ray Authors.
|
|
|
|
|
#
|
|
|
|
|
# Use of this source code is governed by a ISC-style
|
|
|
|
|
# license that can be found in the LICENSE file or at
|
|
|
|
|
# https://opensource.org/licenses/ISC
|
|
|
|
|
#
|
|
|
|
|
# SPDX-License-Identifier: ISC
|
2018-12-11 23:44:01 +01:00
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
|
echo "Run makefile until termination condition"
|
|
|
|
|
echo "usage: int_loop.sh [args]"
|
|
|
|
|
echo "--check-args <args> int_loop_check.py args"
|
2018-12-12 01:17:37 +01:00
|
|
|
# intpips ingests all segbits files at once and does a push at the end
|
|
|
|
|
# other loopers do a push every pass
|
2018-12-12 01:46:05 +01:00
|
|
|
echo "--iter-pushdb make pushdb after successful make database as opposed to end"
|
2018-12-11 23:44:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_args=
|
2018-12-12 01:46:05 +01:00
|
|
|
end_pushdb=true
|
2018-12-11 23:44:01 +01:00
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
|
case "$1" in
|
|
|
|
|
--check-args)
|
|
|
|
|
check_args=$2
|
|
|
|
|
shift
|
|
|
|
|
shift
|
|
|
|
|
;;
|
|
|
|
|
-h|--help)
|
|
|
|
|
usage
|
|
|
|
|
exit 0
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo "Unrecognized argument"
|
|
|
|
|
usage
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
2018-12-12 04:22:16 +01:00
|
|
|
# Quick solves are sloppy
|
|
|
|
|
# Never push them in as they may be under solved
|
|
|
|
|
if [ "$QUICK" = "Y" ] ; then
|
|
|
|
|
end_pushdb=false
|
|
|
|
|
fi
|
|
|
|
|
|
2018-12-11 21:24:46 +01:00
|
|
|
set -ex
|
|
|
|
|
MAKE=${MAKE:-make}
|
|
|
|
|
echo $MAKE
|
2018-12-12 03:30:19 +01:00
|
|
|
i=1
|
2021-01-28 16:08:55 +01:00
|
|
|
BUILD_DIR=${BUILD_DIR:-build}
|
2018-12-11 23:11:55 +01:00
|
|
|
while true; do
|
2018-12-24 18:35:14 +01:00
|
|
|
${MAKE} ITER=$i cleaniter
|
2021-01-28 16:08:55 +01:00
|
|
|
${MAKE} ITER=$i $BUILD_DIR/todo.txt
|
|
|
|
|
if [ ! -s $BUILD_DIR/todo.txt -a $i -eq 1 ]; then
|
2019-03-04 15:33:58 +01:00
|
|
|
echo "Empty TODO file, assuming all the ints were already solved!"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
2018-12-11 23:44:01 +01:00
|
|
|
if python3 ${XRAY_DIR}/fuzzers/int_loop_check.py $check_args ; then
|
2018-12-11 23:11:55 +01:00
|
|
|
break
|
|
|
|
|
fi
|
2021-01-28 16:08:55 +01:00
|
|
|
if [ -f $BUILD_DIR/todo/timeout ] ; then
|
2018-12-12 00:12:21 +01:00
|
|
|
echo "ERROR: timeout"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2018-12-11 23:11:55 +01:00
|
|
|
|
2019-01-09 09:52:44 +01:00
|
|
|
${MAKE} ITER=$i database
|
2018-12-11 21:24:46 +01:00
|
|
|
if [ "$QUICK" = "Y" ] ; then
|
|
|
|
|
break;
|
|
|
|
|
fi
|
2018-12-12 03:30:19 +01:00
|
|
|
|
|
|
|
|
i=$((i+1));
|
2018-12-11 21:24:46 +01:00
|
|
|
done;
|
2018-12-12 01:46:05 +01:00
|
|
|
if $end_pushdb ; then
|
2018-12-12 06:36:42 +01:00
|
|
|
${MAKE} pushdb
|
2018-12-12 01:46:05 +01:00
|
|
|
fi
|
2018-12-11 21:24:46 +01:00
|
|
|
exit 0
|
|
|
|
|
|