From f395dedb4fef34c21a991b58eae5e5e465e5a469 Mon Sep 17 00:00:00 2001 From: lars Date: Tue, 6 Sep 2005 23:47:29 +0000 Subject: [PATCH] substitute constants in predicted validation result files --- tools/validate.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/validate.sh b/tools/validate.sh index f6b32d1..67d292c 100755 --- a/tools/validate.sh +++ b/tools/validate.sh @@ -51,13 +51,13 @@ function do_single() { local TESTNAME=$(basename $1) # replace IPs and ports in the curl-file by local settings - sed "s/_HOST_IP_/$VALIDATE_HOST_IP/g; s/_HTTP_PORT_/$VALIDATE_HTTP_PORT/g; s/_HTTPS_PORT_/$VALIDATE_HTTPS_PORT/g" "$1/input.curl" | curl --insecure --silent --output "${2}/${TESTNAME}.html" --config - + cat "$1/input.curl" | substitute_constants | curl --insecure --silent --output "${2}/${TESTNAME}.html" --config - # there is no status in certain cases - e.g. for error 404 if [ -e "${2}/${TESTNAME}.html" ] then sed "1,/CBOX-STATUS-begin/d; /CBOX-STATUS-end/,\$d" "${2}/${TESTNAME}.html" >"${2}/${TESTNAME}.status" # the diff option "-B" is required, because the status output of # the cryptobox.pl script contains some blank lines - diff -NB "${2}/${TESTNAME}.status" "$1/output" >"${2}/${TESTNAME}.diff" || true + cat "$1/output" | substitute_constants | diff -NB "${2}/${TESTNAME}.status" - >"${2}/${TESTNAME}.diff" || true rm "${2}/${TESTNAME}.status" fi cp "$1/description" "${2}/${TESTNAME}.desc" @@ -78,7 +78,7 @@ function do_series() } -create_summary() +function create_summary() # parameter: directory of results { cat "$VALIDATE_SUMMARY_TEMPLATE_DIR/header" @@ -103,7 +103,7 @@ create_summary() } -import_style() +function import_style() # get the stylesheet file and images # change the stylesheet link { @@ -123,6 +123,13 @@ import_style() } +function substitute_constants() +{ + sed "s/_HOST_IP_/$VALIDATE_HOST_IP/g; s/_HTTP_PORT_/$VALIDATE_HTTP_PORT/g; s/_HTTPS_PORT_/$VALIDATE_HTTPS_PORT/g" +} + +##################### main ########################### + ACTION="--help" [ $# -gt 0 ] && ACTION=$1