Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ jobs:
run: sh .github/docker-resolv.sh
- name: Build lava-docker
run: cd output/local && docker compose build
lava-docker-tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: run custom mini tests framwork
run: ./tests.py
check-formats:
runs-on: ubuntu-22.04
steps:
Expand Down
63 changes: 63 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env python3

import yaml
import os
import subprocess
import shutil
import sys

with open("tests/tests.yaml", "r") as f:
tests = yaml.safe_load(f)

print(tests)

for testname in tests["tests"]:
ltest = tests["tests"][testname]
print(ltest)
directory = ltest["directory"]
tpath = f"tests/{directory}"
output = f"{tpath}/output"
if os.path.exists(output):
print("Need clean")
shutil.rmtree(output)
boardyaml = ltest["boardyaml"]
cmd = ["./lavalab-gen.py", "-o", output, f"{tpath}/{boardyaml}"]
# TODO verify warnings
print(cmd)
ret = subprocess.run(cmd)
print(ret)
if ret.returncode != 0:
print("ERROR")
sys.exit(1)
# now test
if "tests" not in ltest:
ltest["tests"] = []
if ltest["tests"] is None:
ltest["tests"] = []
for itest in ltest["tests"]:
print(itest)
if "filecompare" in itest:
fpath = os.path.join(output, itest["filecompare"])
print(f"DEBUG: tpath={tpath}")
fbase = os.path.join(tpath, itest["base"])
print(f"DEBUG compare {fpath} and {fbase}")
cmd = ["diff", '-u', fbase, fpath]
ret = subprocess.run(cmd)
if ret.returncode != 0:
print("ERROR")
sys.exit(1)
if "directory" in itest:
fpath = os.path.join(output, itest["directory"])
exists = itest["exists"]
if exists:
if os.path.exists(fpath):
print(f"DIR {fpath} OK")
else:
print(f"DIR {fpath} KO")
if "buildit" in ltest:
dockcomp = os.path.join(output, ltest["buildit"])
cmd = ["docker", "compose", '-f', dockcomp, "build"]
ret = subprocess.run(cmd)
if ret.returncode != 0:
print("ERROR")
sys.exit(1)
28 changes: 28 additions & 0 deletions tests/extra_hosts/boards-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
masters:
- name: masterci1
host: local
write_dot_env: True
users:
- name: admin
token: tokenforci
password: passwordforci
superuser: true
staff: true
tokens:
- username: admin
token: dfjdfkfkdjfkdsjfslforci
description: no description
slaves:
- name: lab-ci-0
host: local
remote_master: masterci1
remote_user: admin
use_overlay_server: false
use_tftp: false
extra_hosts:
- "toto: 127.0.0.1"

boards:
- name: qemu-01
type: qemu
23 changes: 23 additions & 0 deletions tests/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
tests:
worker:
comment: verify support of external worker
directory: worker
boardyaml: boards-worker.yml
buildit: local/docker-compose.yml
tests:
- directory: local
exists: True
- directory: local/worker-ser2net
exists: True
- directory: local/worker-ser2net/udev
exists: True
- directory: local/lab-ci-0/udev
exists: True
- filecompare: local/worker-ser2net/udev/99-lavaworker-udev.rules
base: worker/99-lavaworker-udev.rules
extra_hosts:
comment: verify extra_hosts
directory: extra_hosts
boardyaml: boards-ci.yaml
buildit: local/docker-compose.yml
tests:
46 changes: 46 additions & 0 deletions tests/worker/boards-worker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
masters:
- name: master
host: local
users:
- name: admin
token: tokenforci
password: passwordforci
superuser: true
staff: true
tokens:
- username: admin
token: dfjdfkfkdjfkdsjfslforci
description: no description

slaves:
- name: lab-ci-0
host: local
remote_master: master
remote_user: admin

boards:
- name: qemu-03
type: qemu
- name: minnowboard-turbot-E3826-01
type: minnowboard-turbot-E3826
pdu_generic:
hard_reset_command: power-sispmctl.sh reset 2 01:01:4f:ee:ae
power_off_command: power-sispmctl.sh off 2 01:01:4f:ee:ae
power_on_command: power-sispmctl.sh on 2 01:01:4f:ee:ae
uart:
idvendor: 0x0403
idproduct: 0x6001
serial: "AL00CN4X"
worker: worker-ser2net
custom_option:
- "set grub_autoboot_prompt = 'Press enter to boot the selected OS'"
- name: sun7i-a20-olinuxino-micro-01
type: sun7i-a20-olinuxino-micro
pdu_generic:
hard_reset_command: /usr/local/bin/tinyci.sh tinyci5-jack1 reset 2
power_off_command: /usr/local/bin/tinyci.sh tinyci5-jack1 off 2
power_on_command: /usr/local/bin/tinyci.sh tinyci5-jack1 on 2
uart:
idvendor: 0x0403
idproduct: 0x6010
serial: "D30HFJPD"
1 change: 1 addition & 0 deletions tests/worker/worker/99-lavaworker-udev.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001",ATTRS{serial}=="AL00CN4X", MODE="0664", OWNER="uucp", SYMLINK+="minnowboard-turbot-E3826-01"
Loading