Skip to content

Conversation

@vanti
Copy link
Contributor

@vanti vanti commented Jul 5, 2019

When new test images are added to the directory, jobs are automatically
submitted to LAVA using the template corresponding to the device type.
The templates are stored under 'job-templates/lava_<device-type>.job.

Usage:
./monitor-images.sh <your LAVA identity>

The script is automatically run when running 'make all'.

Signed-off-by: Vincent Wan [email protected]

galak and others added 30 commits May 9, 2019 19:10
libudev which is utilized by pyudev expects /run/udev/control to
exist for udev class events to be available.

Signed-off-by: Kumar Gala <[email protected]>
This script is meant to be called via udev to passthrough the usb
devices to a container that needs to use them.  The script will update
the cgroup file for the container to give (or remove) permissions to the
device, create device nodes in the container, and udev symlinks in the
container.  The udev rule is expected to key off a USB serial number for
the device in question.

An example udev rule to utilize this script would look like:

ACTION=="add", ENV{ID_SERIAL_SHORT}=="E00A1029", RUN+="/usr/local/bin/usb-passthrough -a -d %E{ID_SERIAL_SHORT} -i lava-dispatcher"

Where "E00A1029" is the serial number of the device in question, and
"lava-dispatcher" is the container that any associated device nodes will
get setup in.

This script is based on:

https://git.linaro.org/lava/lava-lab.git/tree/shared/lab-scripts/docker/passthrough

The major additions are:
* Handle device removal
* Dynamically create/remove device nodes in container
* Create symlinks in container for udev friend names

The removal logic creates on the fly udev rules to handle the removal
since we can't key off of the serial number.

Signed-off-by: Kumar Gala <[email protected]>
Add a LITE specific dispatcher with pyOCD installed in it.

Signed-off-by: Kumar Gala <[email protected]>
We aren't using QEMU right now so comment out /dev/kvm

Signed-off-by: Kumar Gala <[email protected]>
Update version to get fixes so udev bind/unbind events are seen
correctly.

Signed-off-by: Kumar Gala <[email protected]>
https://github.com/eiz/udevfw

Note: we workaround error on older linux kernels

Kernel version 4.15 on Ubuntu shows a behavior of reporting ECONNREFUSED
from the send.  The data is still sent, so we workaround this by
ignoring the ConnectionRefusedError exception we get in python.

Signed-off-by: Kumar Gala <[email protected]>
Add example of how you can setup the docker-compose.yaml to point to
a local git checkout of lava for development purposes.

Signed-off-by: Kumar Gala <[email protected]>
The commit changes the boot action method to print out the version of the
pyocd-flashtool utility used by the method. It is non-Debian so it was
previously failing with the previous methodology of querying the version
number.

The changed file is provided as a lava-dispatcher overlay.

Signed-off-by: Vincent Wan <[email protected]>
As a convenience for the developer

Signed-off-by: Vincent Wan <[email protected]>
Move the init of the pyudev.MonitorObserver up before handling
of packet thread

Signed-off-by: Kumar Gala <[email protected]>
Move to using a queue so it handles the syncronization, etc for us.
Also make a subtle change to build the packet in the udev thread so if
we support multicasting we only build the packet once and have multiple
send threads for each container we would send to.

Signed-off-by: Kumar Gala <[email protected]>
This change supports dealing with the lifecycle of the container and
know how to setup the sendMsgThread for this lifecycle.  We handle
three cases:
1. Container is up already
2. Container comes up after we are running
3. Container goes down after we are running

For case 2/3 we loop so we can handle multiple up/downs with having to
restart the script.

Signed-off-by: Kumar Gala <[email protected]>
Just handle all the open/close for the netfs in the thread.

Signed-off-by: Kumar Gala <[email protected]>
Make changes to support multiplexing data to multiple containers.
We either pass some per thread information as args to the thread
(netns_file) or we make the thread and workqueue tracked on a per
container basis (introduction of containerClass and containers dict)

you can now pass multiple -i options for the set of containers you
want events sent to.

Signed-off-by: Kumar Gala <[email protected]>
Found a pure python implementation of murmur2 hash that we can use to
replace the need to pull in pyhash.  pyhash is always an option if the
performance of the python implementation is an issue, but seems unlikely
as what we hash are pretty small strings.

Grabbed the python implementation from here:

https://github.com/Orochimarufan/cdev/blob/master/cdev/murmurhash2.py

Signed-off-by: Kumar Gala <[email protected]>
We forgot to import get_errno from ctypes so we get a NameError if this
code path gets executed.

Signed-off-by: Kumar Gala <[email protected]>
Add fetching a version of segger jlink into the dispatcher.

Signed-off-by: Kumar Gala <[email protected]>
Pull in the host-tools from Zephyr SDK.  This also gets us QEMU for ARM
as well (plus some other tools from Zephyr that might be useful in the
future).

For now we symlink openocd into /usr/local/bin to expose it.

Signed-off-by: Kumar Gala <[email protected]>
galak and others added 20 commits June 24, 2019 12:17
Until we have a new release of pyOCD, use git head to get support for
LPC55S69 board.

Signed-off-by: Kumar Gala <[email protected]>
This commit adds the OpenOCD boot action method as an overlay temporarily
til the change is merged into upstream LAVA.

Signed-off-by: Vincent Wan <[email protected]>
The config matches exactly qemu-01 config from https://lite.validation.linaro.org/
(as of now).
Now that there's a need to stop udev-forward in addition to docker-compose.
Add a few additional overlay sample lines to overlay a source tree into
the running image.  This is the easiest way to do development on the
lava source itself.

Signed-off-by: David Brown <[email protected]>
All DAPLink firmwares starting from ~2015 have auto-reset off by default.
We agreed that we should default to support contemporary firmwares.
This commit adds support for the musca_a1 platform using pyocd.

Signed-off-by: Kevin Townsend <[email protected]>
Update versions in .env to 2019.05post1 release.

Signed-off-by: Kumar Gala <[email protected]>
Remove changes that are now in 2019.06 release:
* OpenOCD support
* pyocd print out version of binary used
* frdm-k64 device type support for resets_after_flash

Signed-off-by: Kumar Gala <[email protected]>
Based on board serials, stored in devices/<devname>.serial, create any
needed board configs, using board-setup-helper.py. The boards should be
connected to USB while running this.
When new test images are added to the directory, jobs are automatically
submitted to LAVA using the template corresponding to the device type.
The templates are stored under 'job-templates/lava_<device-type>.job.

Usage:
    ./monitor-images.sh <your LAVA identity>

The script is automatically run when running 'make all'.

Signed-off-by: Vincent Wan <[email protected]>
@vanti vanti force-pushed the monitor_images branch from bdef4dd to 33d159a Compare July 5, 2019 21:03
@vanti
Copy link
Contributor Author

vanti commented Jul 5, 2019

Updated to ignore files which device type does not have a corresponding job template defined.

@pfalcon pfalcon requested review from galak and microbuilder July 12, 2019 09:39
@pfalcon
Copy link
Collaborator

pfalcon commented Jul 12, 2019

I would need to look into more details of this, but some high-level comments based on just the description:

First of all, as a generic comment, I'm a big fan of automation, practice it for a bunch of time in different contexts, and then ... I know limits of it. In some cases, some things are better be done manually instead of fragile/inflexible automation.

When new test images are added to the directory, jobs are automatically
submitted

Sounds cool, but you need to run a command to add a new test image to the directory, right? Then, instead of running cp zephyr.bin ... and having job submitted automatically after that, you could as well run something like submit-to-lava.sh zephyr.bin, which will both copy binary where needed and post a job. And most importantly, it can easily accept additional params.

using the template corresponding to the device type.

I'm afraid, that's too inflexible. LAVA job description depends not just of device type, but more on the actual binary to be tested. Standard Zephyr test vs MicroPython binary vs Zephyr.js binary vs networking test vs GoogleIoT test all could/would run in different ways. That's why submit-to-lava.sh -t job_template_name zephyr.bin would be superior solution.

./monitor-images.sh

We have a default identity being set up, so can as well use that by default (while allow to override).

The script is automatically run when running 'make all'.

Based on all the above, I probably would prefer a different solution to submit jobs, so if we go forward with this "automatic monitoring daemon" way, I'd suggest to make it a separate target, so people who won't use it didn't have to run it (because it may lead to additional confusion and/or errors).

@pfalcon
Copy link
Collaborator

pfalcon commented Jul 12, 2019

submit-to-lava.sh -t job_template_name zephyr.bin

This is btw very similar to how we deal with this matter in our Jenkins jobs (indeed, I'm probably biased towards that solution based on my knowledge and familiarity with it).

(I actually wanted to sit with Vincent at the sprint and show this Jenkins-based LAVA setup to make sure he's aware of it, but well, we had pretty packed schedule there, so I forgot about it later.)

@vanti
Copy link
Contributor Author

vanti commented Jul 12, 2019

Thanks @pfalcon for the comments. To put this in some context, I asked @galak what would be missing in order for automated testing to happen for Zephyr besides what we have been working on (ie. adding boot methods, device types), and he said we need a way to automatically submit jobs once an executable is placed into test-images folder. So I took a first stab at putting something together that works for what I have today for TI CC32xx and OpenOCD to help get the ball rolling. It would likely take several iterations for us to converge to something that works for the wide variety of tests we have got.

Sounds cool, but you need to run a command to add a new test image to the directory, right? Then, instead of running cp zephyr.bin ... and having job submitted automatically after that, you could as well run something like submit-to-lava.sh zephyr.bin, which will both copy binary where needed and post a job. And most importantly, it can easily accept additional params.

If something similar to "submit-to-lava.sh" already exists, I am all for reusing its functionality or combining what I have got in there. Maybe you can submit a PR?

I'm afraid, that's too inflexible. LAVA job description depends not just of device type, but more on the actual binary to be tested. Standard Zephyr test vs MicroPython binary vs Zephyr.js binary vs networking test vs GoogleIoT test all could/would run in different ways. That's why submit-to-lava.sh -t job_template_name zephyr.bin would be superior solution.

I wanted to see if we could keep it simple by having one template per device-type. If as you said we expect the job definition to significant vary between binaries, then we won't have a choice but to write a job definition for each test, which is extra work on the test writer, especially in cases where 99% of the tests could have shared the same job definition. It is also unclear to me who would be responsible for writing these job definitions. Would everyone who contribute tests to Zephyr learn LAVA and provide their own LAVA job definition? What would you think of an approach where we make the '-t' flag optional, and use a default template when it is not specified?

Based on all the above, I probably would prefer a different solution to submit jobs, so if we go forward with this "automatic monitoring daemon" way, I'd suggest to make it a separate target, so people who won't use it didn't have to run it (because it may lead to additional confusion and/or errors).

Currently, if there is no template added to the job-templates directory for a given device type, no job would be auto-submitted and everything works as before. The way I see it we should agree on a mechanism that everyone would use and incrementally improve on. Adding build targets that only some of us use is actually more confusing imho.

@galak galak requested a review from pfalcon September 23, 2019 18:28
Copy link
Collaborator

@pfalcon pfalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we discussed this PR at the Connect SAN19 with Vincent, and Kumar, and looked also at how LAVA submissions are processed currently in Jenkins CI builds. We kinda agreed that we need a solution which would encompass both automated "unattended" usage like in Jenkins, and manual or semi-automated local usage, with the idea that any automation features could be added as a separate layers (e.g., separate scripts).

I offered Vincent to give +1 for this form my side, but he didn't insist, given that this more like an initial probing prototype, and we'd need to rework it going further, based on the ideas above. So, leaving it as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants