From ecc62413b8ee33ecf886b2f4161b486c47db38de Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 24 May 2023 14:35:21 +0000 Subject: [PATCH] SPEC-4816: Fix upload in agl-extend-test.sh agl-extend-test.sh fail to upload a zip file, since it give the directory instead of the file to upload. While fixing this, add some extra test and debug around upload of files. Bug-AGL: SPEC-4816 Fixes: 2e5067e302bc ("qa-testdefinitions: add yaml and script for agl extend test") Change-Id: Ieeefa239398a82b2156391dfe8f58f654a6a29b3 Signed-off-by: Corentin LABBE --- common/scripts/agl-extend-test.sh | 7 +++++-- common/scripts/agl-screenshot-test.sh | 1 + common/scripts/artiproxy-upload.sh | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/common/scripts/agl-extend-test.sh b/common/scripts/agl-extend-test.sh index fd3a4f8..51dfcb1 100755 --- a/common/scripts/agl-extend-test.sh +++ b/common/scripts/agl-extend-test.sh @@ -12,7 +12,7 @@ fi if [ -x ./artiproxy-upload.sh ] ; then - LOG_DIR=/var/run/agl-test/logs/log-to-report + LOG_DIR='/var/run/agl-test/logs/log-to-report' ZIP_FILE=`ls ${LOG_DIR} | grep agl-test-log*` if [ -z $ZIP_FILE ] ; then @@ -20,7 +20,10 @@ if [ -x ./artiproxy-upload.sh ] ; then exit 1 fi - ./artiproxy-upload.sh $LOG_DIR $ZIP_FILE + echo "DEBUG: upload LOG_DIR=${LOG_DIR}XXX" + echo "DEBUG: upload ZIP_FILE=${ZIP_FILE}XXX" + + ./artiproxy-upload.sh "$LOG_DIR/$ZIP_FILE" "$ZIP_FILE" if [ $? -eq 1 ] ; then echo "Upload of ${ZIP_FILE} failed" exit 1 diff --git a/common/scripts/agl-screenshot-test.sh b/common/scripts/agl-screenshot-test.sh index 2e603c1..9eb0085 100755 --- a/common/scripts/agl-screenshot-test.sh +++ b/common/scripts/agl-screenshot-test.sh @@ -125,6 +125,7 @@ set -x FINALRET=127 for i in /home/agl-driver/agl-screenshot-*.png ; do if [ -x ./artiproxy-upload.sh ];then + echo "DEBUG: upload screenshot $i" ./artiproxy-upload.sh $i $(basename $i) fi set +x diff --git a/common/scripts/artiproxy-upload.sh b/common/scripts/artiproxy-upload.sh index 0e841d8..2d4302b 100755 --- a/common/scripts/artiproxy-upload.sh +++ b/common/scripts/artiproxy-upload.sh @@ -28,6 +28,23 @@ if [ -z "$2" ];then exit 1 fi +if [ -d "$1" ];then + echo "ERROR: $1 is a directory" + exit 1 +fi + +echo "DEBUG: filename=$2 data=$1" +if [ -e "$1" ];then + ls -l "$1" + if [ -s "$1" ];then + echo "DEBUG: $1 exists and not empty" + else + echo "WARNING: $1 is empty" + fi +else + echo "ERROR: data does not exists" +fi + curl --silent --show-error -F "filename=$2" -F "data=@$1" http://$PYARTIPROXY_IP:9090/cgi-bin/pyartiproxy.py --output curl.out if [ $? -ne 0 ];then echo "ERROR: with curl" -- 2.16.6