squad: abort job submission while the job definition is not correct

SQUAD will send 400, curl error code 22, on bad job definition. [1]

[1]: https://linaro.atlassian.net/browse/TFC-317?focusedCommentId=142006

Signed-off-by: Arthur She <arthur.she@linaro.org>
Change-Id: I568709663c9bc096970cfccbd61df6a588a259d7
diff --git a/tf-a-builder/squad.sh b/tf-a-builder/squad.sh
index 2cd18ca..5abfb9a 100755
--- a/tf-a-builder/squad.sh
+++ b/tf-a-builder/squad.sh
@@ -67,6 +67,12 @@
         --form definition=@artefacts/debug/job.yaml \
         ${QA_SERVER}/api/submitjob/${QA_SERVER_TEAM}/${QA_SERVER_PROJECT}/${QA_SERVER_VERSION}/${DEVICE_TYPE})
 
+    # SQUAD will send 400, curl error code 22, on bad test definition
+    if [ "$?" = "22" ]; then
+        echo "Bad test definition!!"
+        exit 1
+    fi
+
     if [ -n "${TESTJOB_ID}" ]; then
         echo "TEST JOB URL: ${QA_SERVER}/testjob/${TESTJOB_ID} TEST JOB ID: ${TESTJOB_ID}"