X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=common%2Fscripts%2Fartiproxy-upload.sh;h=2d4302b7524eb885bb66e9e266b92adcbd8ed59e;hb=611748f8a416db6a79550286d1b7f5093f9a3273;hp=c4b7dbec0865b2f3448d261322e0dd2af6d693ab;hpb=23bb2b54f6bdcd159a7d08ce3ac83836d568af04;p=src%2Fqa-testdefinitions.git diff --git a/common/scripts/artiproxy-upload.sh b/common/scripts/artiproxy-upload.sh index c4b7dbe..2d4302b 100755 --- a/common/scripts/artiproxy-upload.sh +++ b/common/scripts/artiproxy-upload.sh @@ -1,11 +1,21 @@ #!/bin/sh if [ -z "$PYARTIPROXY_IP" ];then - #echo "ERROR: cannot upload, no PYARTIPROXY_IP" - #exit 1 - # TODO: lab-baylibre-agl does not get env as it should be. I will debug this later. - echo "DEBUG: No PYARTIPROXY_IP variable, fallback to baylibre one" - PYARTIPROXY_IP=10.1.1.47 + + echo "DEBUG: No PYARTIPROXY_IP variable, using fallbacks" + BAYLIBRE_IP=10.1.1.47 + AGLCORELAB_IP=192.168.111.1 + + if ping -q -W 2 -4 -c 1 $BAYLIBRE_IP ; then + PYARTIPROXY_IP=$BAYLIBRE_IP + fi + if ping -q -W 2 -4 -c 1 $AGLCORELAB_IP ; then + PYARTIPROXY_IP=$AGLCORELAB_IP + fi + if [ -z $PYARTIPROXY_IP ] ; then + echo "ERROR: no PYARTIPROXY_IP" + exit 1 + fi fi if [ -z "$1" ];then @@ -18,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"