Steps for Automated Testing on QEMU

Steps for Automated Testing on QEMU
In general, the steps are very similar to those for generic images for BSP. The main difference, however, is that two poky repositories are needed, one for running QEMU with the downloaded image, and another for executing testimage. This is required as only one bitbake instance is allowed to be running per repository at a time.
Also, additional bitbake commands are required to construct the QEMU native image and its helper binaries.
Using qemux86 as an example, the steps are:
Setup the repository for executing QEMU
1. Download the core-image-sato-sdk-qemux86 image from autobuilder (link available in the point release mail).
2. Clone a clean version of poky and make checkout on the poky commit from the mail (in command line):
a) Clone a copy of a clean version of poky designing it for running QEMU ('poky-run' in this example, but naming is optional):
$ git clone git://git.yoctoproject.org/poky poky-run
b) In the poky directory, checkout the desired commit:
$ cd ~/poky-run
$ git checkout <commit-id>
3. Source the environment, from poky directory:
$ source oe-init-build-env
4. Edit local.conf. PATH: ~/poky-run/build/conf, at the end of the file adding: 
Add the required machine, for example MACHINE ?= "qemux86"
5. In ~/poky-run/build directory, in command line, type the following commands:
$ bitbake qemu-native
$ bitbake qemu-helper-native
NOTE: After finishing the tasks, copy the image bin, ext4 and qemuboot.conf files from autobuilder at the following path:
"~/poky-run/build/tmp/deploy/images/qemux86/" (if "tmp/deploy/images/qemux86" does not exist, create new directories with this path)
6. In ~/poky-run/build directory start the QEMU emulator:
runqemu qemux86
7. Obtain the virtual machine IP Address by opening a terminal inside it and executing ifconfig.
Setup the repository for executing testimage
1. Download the core-image-sato-sdk-qemux86 image from autobuilder, if required (this is the same step than for setting up the repository for executing QEMU).
2. Clone a clean version of poky and make checkout on the poky commit from the mail (in command line):
a) Clone a copy of a clean version of poky designing it for executing testimage ('poky-test' in this example, but naming is optional):
$ git clone git://git.yoctoproject.org/poky poky-test
b) In the poky directory, checkout the desired commit:
$ cd ~/poky-test
$ git checkout <commit-id>
3. Source the environment, from poky directory:
$ source oe-init-build-env
4. Edit local.conf. PATH: ~/poky-test/build/conf, at the end of the file adding: 
INHERIT += "testimage"
TEST_TARGET = "simpleremote"
TEST_SERVER_IP = "HOST ip" --> IP of the machine being used to launch tests
TEST_TARGET_IP = "DUT ip" --> IP of the device under test
For releases before 2.3 also add 
TEST_SUITES = " auto" 
Remember to add the required machine, for example MACHINE ?= "qemux86"
5. In ~/poky-test/build directory, in command line, type the following commands:
$ bitbake rpm psplash
$ bitbake package-index
NOTE: After finishing the tasks, copy the image manifest (core-image-sato-sdk-qemux86.manifest) from autobuilder at the following path:
"~/poky-test/build/tmp/deploy/images/qemux86/" (if "tmp/deploy/images/qemux86" does not exist, create new directories with this path).
6. In ~/poky-test/build directory, start the testimage execution by typing the following command:
$ bitbake core-image-sato-sdk -c testimage
If you face issues with the keys from your host, use this command: $ ssh-keygen -f /home/user/.ssh/known_hosts -R targetip
Then add the key to the host again ssh , SSH TARGETNAME@IPTARGET
After a while the testing will be finished.