summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Faulet <cfaulet@haproxy.com>2018-12-19 10:18:40 +0100
committerChristopher Faulet <cfaulet@haproxy.com>2018-12-20 10:33:18 +0100
commit8d0fdf5ef2caeb88f410f0eec32503ab8365cfba (patch)
treecdc1a8a941ae62d46cbe007338a46cba3164e9ad /scripts
parent1ecf0ea70ab721991a0da48efaa752bc4fe0deb0 (diff)
downloadhaproxy-8d0fdf5ef2caeb88f410f0eec32503ab8365cfba.tar.gz
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.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/run-regtests.sh39
1 files changed, 37 insertions, 2 deletions
diff --git a/scripts/run-regtests.sh b/scripts/run-regtests.sh
index be53e97cf..43ba095bd 100755
--- a/scripts/run-regtests.sh
+++ b/scripts/run-regtests.sh
@@ -22,6 +22,9 @@ _help()
--varnishtestparams <ARGS>, passes custom ARGS to varnishtest
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
related to haproxy's target and compilation options
# Below targets are not capable of completing this test succesfully
@@ -206,6 +209,34 @@ _findtests() {
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() {
while [ ${#} -gt 0 ]; do
if _startswith "$1" "-"; then
@@ -225,6 +256,10 @@ _process() {
LEVEL="$2"
shift
;;
+ --clean)
+ _cleanup
+ exit 0
+ ;;
--help)
_help
;;
@@ -247,6 +282,7 @@ _version() {
HAPROXY_PROGRAM="${HAPROXY_PROGRAM:-${PWD}/haproxy}"
VARNISHTEST_PROGRAM="${VARNISHTEST_PROGRAM:-varnishtest}"
+TESTDIR="${TMPDIR:-/tmp}"
REGTESTS=""
jobcount=""
@@ -280,9 +316,8 @@ echo "Testing with haproxy version: $HAPROXY_VERSION"
TESTRUNDATETIME="$(date '+%Y-%m-%d_%H-%M-%S')"
-TESTDIR="${TMPDIR:-/tmp}"
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 HAPROXY_PROGRAM="$HAPROXY_PROGRAM"