From Yocto Project
Jump to: navigation, search


How to test Toaster with Containers, Two Ways

It had been awhile since I ran the Selenium browser tests on one of my build systems and, once again, I found that something (?) I had upgraded was interfering with the tests. So, this page documents how to use the existing containers to run the tests .

Running the toaster built-in Selenium tests

Note: Currently this only supports the firefox selenium container.


  • Run the Selenium container:
    • docker run -it --rm=true -p 5900:5900 -p 4444:4444 --name=selenium selenium/standalone-firefox-debug:2.53.0
      • 5900 is the default vnc port. If you are runing a vnc server on your machine map a different port e.g. -p 6900:5900 . This first number is the port mapping for your host and can be anything you want that isn't in use. The second 5900 is the vnc server port inside the container and cannot be changed.
      • 4444 is the default selenium sever port. This provides a port for the Django tests to connect to on the host.
    • This container can be left running for multiple runs of the Django tests. Once you Ctrl-C out of it, it will be removed.
  • Run the tests
    • TOASTER_TESTS_BROWSER=remote TOASTER_REMOTE_HUB= ./bitbake/lib/toaster/ test --liveserver= tests.browser
      • TOASTER_TESTS_BROWSER - remote is now an option , like firefox or chrome
      • TOASTER_REMOTE_HUB - This provides the host side address for the Django tests to connect to. If you needed to change the first 4444 in the container step. Make sure you match it here. do not forget the wd/hub or you will get a 403 forbidden error.
      • --liveserver=xxx tells Django to run the test server on a particular interface and port. The default is to run it on localhost:8081 which is not reachable by the container so we need to specify an address that is reachable by both the host and the container. For more information on liveserver see
        • The magic is the default docker0 bridge on linux. Find it with
 ip -4 addr show dev docker0
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
  inet scope global docker0
  valid_lft forever preferred_lft forever

  • if you would like to see the tests run, you can connect to the vnc server as so:
    • xtightvncviewer
    • you need to wait for the test container to come up before this can connect.
    • if you changed the host side vnc port make sure you sue the same number here.
    • The password is "secret". Chosen by the selenium folks...

Running the CROPS toaster container tests

The Toaster container located at has a smoke test it runs as part of building a new container. This smoketest is run on travis and new docker images get pushed to Dockerhub iff the test passes. This test is slightly different from the above Django test framework tests in that

  • creates a bitbake environment
  • starts up toaster in that environment
  • pulls in information from the layer index
  • creates a new project
  • builds quilt-native

It is a more limited test but it is end to end, so to speak. You get access to the test by cloning the toaster container repo.

git clone

Here's how you would run it

IMAGE=crops/toaster-master POKYDIR=/big/src/intel/myBugs/poky POKYBRANCH=COW VNCPORT=5900 ./tests/

The variables:

  • IMAGE=crops/toaster-master - This is the toaster container to use to run the toaster instance being tested. Use one that matches the poky you are testing e.g. toaster-master for master, toaster-krogoth for krogoth, etc.
  • POKYDIR=/home/me/poky - This is where the checkout of poky that you want to test lives on your host system. It will be bind mounted into the container.
  • POKYBRANCH=local - The type of project that gets created to test. on master, it would be a one of master,morty, or local
  • VNCPORT=5900 - If you specify this, you can watch the test run by connecting to the host on port 5900 with a vnc viewer. e.g. xtightvncviewer
    • VNCPORT=5900 - This binds the vnc server to and it can be accessed from any machine on the network.
    • VNCPORT= - This binds it to localhost and it can be accessed from the machine running the tests only.
    • The password is "secret". Chosen by the selenium folks...
  • - the script that handles the containers and runs the Located in the toaster container repo.

A successful test looks like:

Running tests...
smoketests PASSED!
checkartifacts PASSED!

An unsuccessful test looks like

Running tests...
Traceback (most recent call last):
 File "/big/src/intel/myBugs/toaster-container/tests/", line 76, in <module>
   raise Exception(msg)
Exception: Error: Branch COW not in options: "local yocto project", "yocto project 2.2 "morty""
Attempting to save screenshot to /big/src/intel/myBugs/toaster-container/screenshot.png
FAILURE: See logs in /tmp/tmp.QzRu10hIfutoastertest

and logs can be found in the referenced /tmp directory.

Using the CROPS toaster container test to do a git bisect

  • Pending Review.
Personal tools