X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Fdo_curl_function.sh;h=1cff7a1ffb69b84166f3539e52a327116dc256c4;hb=a0e0e5c38053553393b341ccdd22e794babfafeb;hp=c4365d8b85466182f809c1b0210876fb7b0af16a;hpb=c488e37b5803ca41d7b8feb4434cb570aae2cd43;p=nonrtric.git diff --git a/test/common/do_curl_function.sh b/test/common/do_curl_function.sh index c4365d8b..1cff7a1f 100755 --- a/test/common/do_curl_function.sh +++ b/test/common/do_curl_function.sh @@ -33,6 +33,7 @@ # Env BODY contains the response body after the call # Any error will stop script execution # How to use in a test script: source this file into your bash test script to the make the function available. +# The function may create a dir 'tmp' for temporary files. do_curl() { echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD @@ -88,8 +89,9 @@ do_curl() { count=${RESULT:16:${#RESULT}} #Find dir of the common dir DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - echo $body > .tmp.json - res=$(python ${DIR}/count_json_elements.py .tmp.json) + mkdir -p tmp + echo $body > ./tmp/.tmp.json + res=$(python ${DIR}/count_json_elements.py ./tmp/.tmp.json) if [ $res -eq $count ]; then echo " Body (array size) as expected" else