Skip to content

Commit 38cf4d8

Browse files
committed
Att github tests
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
1 parent 8139f51 commit 38cf4d8

3 files changed

Lines changed: 119 additions & 0 deletions

File tree

.github/workflows/lavacli.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
3+
. output/.env
4+
5+
# verify all devices and jobs are ok
6+
if [ "$1" = "health" ];then
7+
FTMP='/tmp/jobs'
8+
lavacli --uri http://$USER:$TOKEN@127.0.0.1:$WEBIF_PORT/RPC2 jobs show $2 > $FTMP
9+
cat $FTMP
10+
lavacli --uri http://$USER:$TOKEN@127.0.0.1:$WEBIF_PORT/RPC2 jobs logs $2
11+
grep 'state.*Finished' $FTMP || exit 1
12+
grep 'Health.*Complete' $FTMP || exit 1
13+
lavacli --uri http://$USER:$TOKEN@127.0.0.1:$WEBIF_PORT/RPC2 devices show qemu-01 > $FTMP
14+
cat $FTMP
15+
grep 'health.*Good' $FTMP || exit 1
16+
exit 0
17+
fi
18+
19+
lavacli --uri http://$USER:$TOKEN@127.0.0.1:$WEBIF_PORT/RPC2 $*
20+
exit $?

.github/workflows/tests.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
# yamllint disable rule:line-length
3+
name: Test healthcheck repo
4+
5+
on: # yamllint disable-line rule:truthy
6+
push:
7+
pull_request:
8+
9+
jobs:
10+
simpletest:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Verify healthcheck docker build and up
15+
run: |
16+
sudo apt-get -y install git
17+
git clone https://github.com/Baylibre/lava-docker
18+
cd lava-docker && ./lavalab-gen.py boards-ci-hc.yaml
19+
cd output/local && docker compose build
20+
- name: Launch lava-docker
21+
run: cd output/local && docker compose up -d
22+
- name: Wait for LAVA to be started
23+
run: sh .github/workflows/wait-for-docker.sh
24+
- name: Wait for first job to be completed
25+
# yamllint disable-line rule:line-length
26+
run: sh .github/workflows/lavacli.sh jobs wait 1
27+
- name: Check if all is okay
28+
# yamllint disable-line rule:line-length
29+
run: sh .github/workflows/lavacli.sh health 1
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/sh
2+
3+
DOCKERNAME=master
4+
if [ ! -z "$1" ];then
5+
DOCKERNAME=$1
6+
echo "DEBUG: master name is $DOCKERNAME"
7+
fi
8+
9+
if [ -e output/.env ]; then
10+
. output/.env
11+
fi
12+
13+
cd output/local
14+
15+
TIMEOUT=0
16+
17+
need_wait() {
18+
echo "========================================================"
19+
lavacli --uri http://admin:tokenforci@127.0.0.1:$WEBIF_PORT/RPC2 devices list > devices.list
20+
if [ $? -ne 0 ];then
21+
echo "DEBUG: lavacli devices list not0"
22+
return 1
23+
fi
24+
grep -q qemu devices.list
25+
if [ $? -ne 0 ];then
26+
echo "DEBUG: no qemu yet"
27+
cat devices.list
28+
return 1
29+
fi
30+
grep -i unknow devices.list
31+
if [ $? -eq 0 ];then
32+
echo "DEBUG: there is still devices without passed HC"
33+
return 1
34+
fi
35+
# now wait for a job
36+
lavacli --uri http://admin:tokenforci@127.0.0.1:$WEBIF_PORT/RPC2 jobs list > joblist
37+
cat joblist
38+
grep -q Running joblist
39+
if [ $? -ne 0 ];then
40+
return 0
41+
lavacli --uri http://admin:tokenforci@127.0.0.1:$WEBIF_PORT/RPC2 jobs logs --no-follow 1
42+
fi
43+
echo "DEBUG: Still running jobs"
44+
return 1
45+
}
46+
47+
while [ $TIMEOUT -le 1200 ]
48+
do
49+
need_wait
50+
RET=$?
51+
docker compose logs --tail=60
52+
docker ps > /tmp/alldocker
53+
grep -q $DOCKERNAME /tmp/alldocker
54+
if [ $? -ne 0 ];then
55+
echo "=========================================="
56+
echo "=========================================="
57+
echo "=========================================="
58+
echo "ERROR: master $DOCKERNAME died"
59+
docker ps
60+
docker compose logs
61+
exit 1
62+
fi
63+
if [ $RET -eq 0 ];then
64+
exit 0
65+
fi
66+
sleep 10
67+
TIMEOUT=$((TIMEOUT+10))
68+
echo "WAIT FOR DOCKER TIMEOUT=$TIMEOUT"
69+
done
70+
exit 1

0 commit comments

Comments
 (0)