aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-01-09 16:55:00 +0100
committerCorentin LABBE <clabbe@baylibre.com>2018-02-02 14:24:19 +0100
commitf2e611a9528ec772a075e8f7fea5d70ca0465937 (patch)
treec949f82ed812431e5b30b04e2df0824ca7ca718f
parentfa7d0cd24893694ff529a16386cfc7a27f833d59 (diff)
Handle boards without uart
Some boards could not have uart like qemu. This patch made having an uart optionnal.
-rwxr-xr-xlavalab-gen.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 6baa825..6a5ea43 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -14,7 +14,7 @@ boards_yaml = "boards.yaml"
tokens_yaml = "tokens.yaml"
baud_default = 115200
-template = string.Template("""#
+template_conmux = string.Template("""#
# auto-generated by lavalab-gen.py for ${board}
#
listener ${board}
@@ -27,7 +27,12 @@ command 'on' 'Power on ${board}' 'pduclient --daemon ${daemon} --host ${host} --
#no comment it is volontary
template_device = string.Template("""{% extends '${devicetype}.jinja2' %}
+""")
+
+template_device_conmux = string.Template("""
{% set connection_command = 'conmux-console ${board}' %}
+""")
+template_device_pdu = string.Template("""
{% set hard_reset_command = 'pduclient --daemon localhost --hostname acme-0 --port ${port} --command=reboot' %}
{% set power_off_command = 'pduclient --daemon localhost --hostname acme-0 --port ${port} --command=off' %}
{% set power_on_command = 'pduclient --daemon localhost --hostname acme-0 --port ${port} --command=on' %}
@@ -67,22 +72,24 @@ def main(args):
if b.get("disabled", None):
continue
- if not b.has_key("uart"):
- print("WARNING: %s missing uart property" % board_name)
- continue
-
- baud = b["uart"].get("baud", baud_default)
if b.has_key("pdu"):
daemon = b["pdu"]["daemon"]
host = b["pdu"]["host"]
port = b["pdu"]["port"]
devicetype = b["type"]
delay_opt = ""
- line = template.substitute(board=board_name, baud=baud, daemon=daemon, host=host, port=port, delay=delay_opt)
device_line = template_device.substitute(board=board_name, port=port, devicetype=devicetype)
+ device_line += template_device_pdu.substitute(port=port)
+ if b.has_key("uart"):
+ baud = b["uart"].get("baud", baud_default)
+ line = template_conmux.substitute(board=board_name, baud=baud, daemon=daemon, host=host, port=port, delay=delay_opt)
serial = b["uart"]["serial"]
udev_line += template_udev.substitute(board=board_name, serial=serial)
dc_devices.append("/dev/%s:/dev/%s" % (board_name, board_name))
+ fp = open("lava-slave/conmux/%s.cf" % board_name, "w")
+ fp.write(line)
+ fp.close()
+ device_line += template_device_conmux.substitute(board=board_name)
if b.has_key("fastboot_serial_number"):
fserial = b["fastboot_serial_number"]
device_line += "{%% set fastboot_serial_number = '%s' %%}" % fserial
@@ -95,9 +102,6 @@ def main(args):
device_path = "lava-master/devices/%s" % lab_name
if not os.path.isdir(device_path):
os.mkdir(device_path)
- fp = open("lava-slave/conmux/%s.cf" % board_name, "w")
- fp.write(line)
- fp.close()
board_device_file = "%s/%s.jinja2" % (device_path, board_name)
fp = open(board_device_file, "w")
fp.write(device_line)