aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2020-07-22 14:01:10 +0200
committerCorentin LABBE <clabbe@baylibre.com>2020-07-22 14:03:27 +0200
commit78b2b53df5488b1f1f1b318b34aa6ab721fdeda5 (patch)
tree61e032ff617178d174897b4dca5ad6b35a051a19 /test
parent5cbbce37ba330f9617d27b561cb260a104d3dcb1 (diff)
When working on SPEC-3414, I did some test tool for releng-scripts. This patchs adds them. - test.sh scan artefacts and try to generated jobs with them - checkjobs.py check all ran jobs and try to detect if there was apps jobs and if they has errors. Change-Id: Iab21573741ab4fa3cdfc29fd0d7aab33c904d838 Bug-AGL: SPEC-3414 Signed-off-by: Corentin LABBE <clabbe@baylibre.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/checkjobs.py27
-rwxr-xr-xtest/test.sh88
2 files changed, 115 insertions, 0 deletions
diff --git a/test/checkjobs.py b/test/checkjobs.py
new file mode 100755
index 0000000..529d2fb
--- /dev/null
+++ b/test/checkjobs.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python3
+
+import re
+import yaml
+import os
+import xmlrpc.client
+
+lserver = xmlrpc.client.ServerProxy(os.getenv("LAVAURI"), allow_none=True)
+
+offset = 0
+while offset < 100:
+ jlist = lserver.scheduler.jobs.list('FINISHED', None, offset, 100, None, False)
+ for job in jlist:
+ if job["submitter"] == 'lava-health':
+ continue
+ jobid = job["id"]
+ print(jobid)
+ job_out_raw = lserver.scheduler.job_output(jobid)
+ job_out = yaml.safe_load(job_out_raw.data)
+ for job_out_line in job_out:
+ if job_out_line["lvl"] == 'debug' and isinstance(job_out_line["msg"], str) and re.search('APPURL=', job_out_line["msg"]):
+ print(job_out_line)
+ if job_out_line["lvl"] == 'target' and re.search('WGTNAME=', job_out_line["msg"]):
+ print(job_out_line)
+ if job_out_line["lvl"] == 'target' and re.search('ERROR', job_out_line["msg"]):
+ print(job_out_line)
+ offset += 100
diff --git a/test/test.sh b/test/test.sh
new file mode 100755
index 0000000..22bf9b5
--- /dev/null
+++ b/test/test.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+# scan remaining artifacts for generating jobs
+# if LAVA_URL is set in testenv, all generated jobs are sent to LAVA
+
+mkdir output
+
+# hardcoded test
+
+echo "TEST 1"
+./utils/create-jobs.py --machine qemux86-64 --branch guppy --version latest --build-type ci \
+ --changeid 1234 \
+ --patchset 5678 \
+ --applications-url https://download.automotivelinux.org/AGL/upload/ci/20581/1/guppy/x86-64/ > output/test
+echo "TEST 2"
+./utils/create-jobs.py --machine raspberrypi4 --branch guppy \
+ --version latest \
+ --build-type ci \
+ --changeid 1234 \
+ --patchset 5678 \
+ --applications-url https://download.automotivelinux.org/AGL/upload/ci/20581/1/guppy/x86-64/ > output/test
+
+
+CI=http://download.automotivelinux.org/AGL/upload/ci/
+
+if [ -e testenv ];then
+ #. $(pwd)/testenv
+ echo "using env"
+fi
+
+wget -q $CI -O cilist || exit $?
+
+grep -o "[0-9][0-9][0-9][0-9][0-9]*/" cilist | sort | uniq | sed 's,/$,,' |
+while read CIID
+do
+ echo "$CIID"
+ wget -q $CI/$CIID/ -O revid
+ grep -o "[0-9][0-9]*/" revid | sort | uniq | sed 's,/$,,' |
+ while read REVID
+ do
+ wget -q $CI/$CIID/$REVID -O machines
+ grep -o '"[a-z0-9-][a-z0-9-]*/"' machines | cut -d'"' -f2 | sed 's,/$,,' |
+ while read MACHINE
+ do
+ RMACHINE=$MACHINE
+ case $MACHINE in
+ h3ulcb-nogfx)
+ RMACHINE=h3ulcb-kf
+ ;;
+ master)
+ # HACK: we are in a app
+ continue
+ ;;
+ esac
+ echo "TEST: $CIID $REVID $MACHINE $RMACHINE"
+ ./utils/job-prereq.py --machine $RMACHINE --build-type ci $CIID $REVID --kernel || exit $?
+ ./utils/job-prereq.py --machine $RMACHINE --build-type ci $CIID $REVID --dtb || exit $?
+ ./utils/job-prereq.py --machine $RMACHINE --build-type ci $CIID $REVID --initrd || exit $?
+ ./utils/job-prereq.py --machine $RMACHINE --build-type ci $CIID $REVID --nbdroot || exit $?
+ if [ -z "$LAVA_URL" ];then
+ EXTRA_OPTS=""
+ else
+ EXTRA_OPTS="--callback-from lab-agl-core --callback-to Baylibre"
+ fi
+ ./utils/create-jobs.py --machine $RMACHINE --build-type ci \
+ --changeid $CIID --patchset $REVID $EXTRA_OPTS > output/job-$MACHINE
+ if [ -z "$LAVA_URL" ];then
+ continue
+ fi
+ if [ $MACHINE = 'qemuarm' -o $MACHINE = 'qemuarm64' -o $MACHINE = 'qemux86-64' ];then
+ sed -i "s,job_name:.*,job_name: releng-test for $MACHINE ($CIID $REVID)," output/job-$MACHINE
+ echo "SEND"
+ lavacli --uri $LAVA_URL jobs submit output/job-$MACHINE > jobid
+ if [ $? -eq 0 ];then
+ lavacli --uri $LAVA_URL jobs wait $(cut -d' ' -f1 jobid)
+ lavacli --uri $LAVA_URL jobs show $(cut -d' ' -f1 jobid)
+ fi
+ rm jobid
+ fi
+ done
+ rm machines
+ done
+ rm revid
+done
+
+rm cilist
+
+exit 0