REGTEST: script: Add the option --clean to remove previous log direcotries
Running regtests several times leaves many direcotries. It is painful to remove them by hand. This command do it for you. It ask a confirmation to proceed to be sure. The template used to create log direcotries has been changed. The prefix 'haregtests-' has been added to help the cleanup function to find existing log direcotries.
This commit is contained in:
parent
1ecf0ea70a
commit
8d0fdf5ef2
@ -22,6 +22,9 @@ _help()
|
|||||||
--varnishtestparams <ARGS>, passes custom ARGS to varnishtest
|
--varnishtestparams <ARGS>, passes custom ARGS to varnishtest
|
||||||
run-regtests.sh --varnishtestparams "-n 10"
|
run-regtests.sh --varnishtestparams "-n 10"
|
||||||
|
|
||||||
|
--clean to cleanup previous reg-tests log directories and exit
|
||||||
|
run-regtests.sh --clean
|
||||||
|
|
||||||
Including text below into a .vtc file will check for its requirements
|
Including text below into a .vtc file will check for its requirements
|
||||||
related to haproxy's target and compilation options
|
related to haproxy's target and compilation options
|
||||||
# Below targets are not capable of completing this test succesfully
|
# Below targets are not capable of completing this test succesfully
|
||||||
@ -206,6 +209,34 @@ _findtests() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_cleanup()
|
||||||
|
{
|
||||||
|
DIRS=$(find "${TESTDIR}" -maxdepth 1 -type d -name "haregtests-*" -exec basename {} \; 2>/dev/null)
|
||||||
|
if [ -z "${DIRS}" ]; then
|
||||||
|
echo "No reg-tests log directory found"
|
||||||
|
else
|
||||||
|
echo "Cleanup following reg-tests log directories:"
|
||||||
|
for d in ${DIRS}; do
|
||||||
|
echo " o ${TESTDIR}/$d"
|
||||||
|
done
|
||||||
|
read -p "Continue (y/n)?" reply
|
||||||
|
case "$reply" in
|
||||||
|
y|Y)
|
||||||
|
for d in ${DIRS}; do
|
||||||
|
rm -r "${TESTDIR}/$d"
|
||||||
|
done
|
||||||
|
echo "done"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "aborted"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_process() {
|
_process() {
|
||||||
while [ ${#} -gt 0 ]; do
|
while [ ${#} -gt 0 ]; do
|
||||||
if _startswith "$1" "-"; then
|
if _startswith "$1" "-"; then
|
||||||
@ -225,6 +256,10 @@ _process() {
|
|||||||
LEVEL="$2"
|
LEVEL="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--clean)
|
||||||
|
_cleanup
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
--help)
|
--help)
|
||||||
_help
|
_help
|
||||||
;;
|
;;
|
||||||
@ -247,6 +282,7 @@ _version() {
|
|||||||
|
|
||||||
HAPROXY_PROGRAM="${HAPROXY_PROGRAM:-${PWD}/haproxy}"
|
HAPROXY_PROGRAM="${HAPROXY_PROGRAM:-${PWD}/haproxy}"
|
||||||
VARNISHTEST_PROGRAM="${VARNISHTEST_PROGRAM:-varnishtest}"
|
VARNISHTEST_PROGRAM="${VARNISHTEST_PROGRAM:-varnishtest}"
|
||||||
|
TESTDIR="${TMPDIR:-/tmp}"
|
||||||
REGTESTS=""
|
REGTESTS=""
|
||||||
|
|
||||||
jobcount=""
|
jobcount=""
|
||||||
@ -280,9 +316,8 @@ echo "Testing with haproxy version: $HAPROXY_VERSION"
|
|||||||
|
|
||||||
TESTRUNDATETIME="$(date '+%Y-%m-%d_%H-%M-%S')"
|
TESTRUNDATETIME="$(date '+%Y-%m-%d_%H-%M-%S')"
|
||||||
|
|
||||||
TESTDIR="${TMPDIR:-/tmp}"
|
|
||||||
mkdir -p "$TESTDIR" || exit 1
|
mkdir -p "$TESTDIR" || exit 1
|
||||||
TESTDIR=$(mktemp -d "$TESTDIR/$TESTRUNDATETIME.XXXXXX") || exit 1
|
TESTDIR=$(mktemp -d "$TESTDIR/haregtests-$TESTRUNDATETIME.XXXXXX") || exit 1
|
||||||
|
|
||||||
export TMPDIR="$TESTDIR"
|
export TMPDIR="$TESTDIR"
|
||||||
export HAPROXY_PROGRAM="$HAPROXY_PROGRAM"
|
export HAPROXY_PROGRAM="$HAPROXY_PROGRAM"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user