-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtasks.py
38 lines (31 loc) · 965 Bytes
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import time
from invoke import Context, Collection, task
from telnetlib import Telnet
from datetime import datetime, timedelta
@task()
def renode(ctx):
"""Spawn Renode and attach to its monitor"""
ctx.run("./start-headless.sh", asynchronous=True)
print("Letting Renode boot...")
time.sleep(3)
retry_until = datetime.now() + timedelta(seconds=3)
while datetime.now() < retry_until:
try:
ctx.run('telnet 127.0.0.1 33334', pty=True)
except Exception as e:
time.sleep(0.5)
@task()
def console(ctx):
"""Connect to Renode's UART"""
ctx.run('telnet 127.0.0.1 33335', pty=True)
@task()
def gdb(ctx):
"""Connect to Renode's GDB connection"""
ctx.run("arm-none-eabi-gdb-py "
"--eval-command=\"target remote :3333\" "
"--se build/renode-example.elf",
pty=True)
@task()
def test(ctx):
"""Run tests locally"""
ctx.run("./run_tests.sh", pty=True)