From f2f38cb15c5aa9f2b2e6b8b1942aa42155e56d96 Mon Sep 17 00:00:00 2001 From: Chase Qi Date: Thu, 25 May 2017 22:24:52 +0800 Subject: automated: utils: use lava-test-case for result saving in LAVA In LAVA, use lava-test-case for result saving makes the upload helper script more reliable. For local run, saving file upload 'fail/skip' result to 'result.txt' isn't necessary as it is always skipped. And some test cases may don't use 'result.txt' at all, in these cases, we will need to handle file creating in the upload helper script which increases complicity. Change-Id: Ie9ed79b66bab6abc861c2a3da7a3c6fd21b19c88 Signed-off-by: Chase Qi --- automated/utils/upload-to-artifactorial.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/automated/utils/upload-to-artifactorial.sh b/automated/utils/upload-to-artifactorial.sh index 72e77bb..1cb7fcb 100755 --- a/automated/utils/upload-to-artifactorial.sh +++ b/automated/utils/upload-to-artifactorial.sh @@ -3,7 +3,6 @@ ATTACHMENT="" ARTIFACTORIAL_URL="" ARTIFACTORIAL_TOKEN="" -RESULT_FILE="$(pwd)/output/result.txt" usage() { echo "Usage: $0 [-a ] [-u ] [-t ]" 1>&2 @@ -20,7 +19,8 @@ while getopts ":a:u:t:" opt; do done if [ -z "${ARTIFACTORIAL_URL}" ]; then - echo "test-attachment skip" | tee -a "${RESULT_FILE}" + echo "test-attachment skip" + which lava-test-case && lava-test-case "test-attachment" --result "skip" exit 0 fi @@ -35,7 +35,8 @@ if which lava-test-reference; then if [ -z "${ARTIFACTORIAL_TOKEN}" ]; then echo "WARNING: ARTIFACTORIAL_TOKEN is empty! File uploading skipped." - echo "test-attachment skip" | tee -a "${RESULT_FILE}" + echo "test-attachment skip" + which lava-test-case && lava-test-case "test-attachment" --result "skip" exit 0 else return=$(curl -F "path=@${ATTACHMENT}" -F "token=${ARTIFACTORIAL_TOKEN}" "${ARTIFACTORIAL_URL}") @@ -44,8 +45,10 @@ if which lava-test-reference; then if echo "${return}" | grep "$(basename "${ATTACHMENT}")"; then lava-test-reference "test-attachment" --result "pass" --reference "https://archive.validation.linaro.org/artifacts/${return}" else - echo "test-attachment fail" | tee -a "${RESULT_FILE}" + echo "test-attachment fail" + which lava-test-case && lava-test-case "test-attachment" --result "fail" fi else - echo "test-attachment skip" | tee -a "${RESULT_FILE}" + echo "test-attachment skip" + which lava-test-case && lava-test-case "test-attachment" --result "skip" fi -- cgit v1.2.3