From: Matthijs Mekking Date: Fri, 15 May 2020 08:27:27 +0000 (+0200) Subject: Replace date -d with python script X-Git-Tag: v9.17.2~39^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5b3decaf4864149f1269157d62d12724399bf591;p=thirdparty%2Fbind9.git Replace date -d with python script The usage of 'date -d' in the kasp system test is not portable, replace with a python script. Also remove some leftover "set_keytime 'yes'" calls. --- diff --git a/bin/tests/system/kasp/clean.sh b/bin/tests/system/kasp/clean.sh index 95c5781535c..a315ce9d1f1 100644 --- a/bin/tests/system/kasp/clean.sh +++ b/bin/tests/system/kasp/clean.sh @@ -24,3 +24,4 @@ rm -f ns*/managed-keys.bind rm -f ns*/*.mkeys rm -f ns*/zones* ns*/*.db.infile rm -f *.created published.test* retired.test* +rm -f python.out.* diff --git a/bin/tests/system/kasp/tests.sh b/bin/tests/system/kasp/tests.sh index da6e5cffffb..b0f2d727e23 100644 --- a/bin/tests/system/kasp/tests.sh +++ b/bin/tests/system/kasp/tests.sh @@ -230,22 +230,22 @@ set_keytime() { # $3: Value # $4: Additional time. set_addkeytime() { - # Convert "%Y%m%d%H%M%S" format to epoch seconds. - _date=$(echo "$3" | awk ' - {print substr($1,1,8)}') - _time=$(echo "$3" | awk ' - BEGIN {OFS=":"} - {print substr($1,9,2), substr($1,11,2), substr($1,13,2)}') - - # Add additional time. - _plus=$4 - echo_i "addkey_time: $1 $2 $3 $4: $_date $_time $_plus" - - - _epoch=$(date -u -d "$_date $_time" +"%s") - _epoch=$((_epoch+_plus)) - - key_set "$1" "$2" $(date -u -d @$_epoch +%Y%m%d%H%M%S) + if [ -x "$PYTHON" ]; then + # Convert "%Y%m%d%H%M%S" format to epoch seconds. + # Then, add the additional time (can be negative). + _value=$3 + _plus=$4 + $PYTHON > python.out.$ZONE.$1.$2 <