Bug 7928

Summary: devtool selftest assumes 192.168.7.2
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Richard Purdie <richard.purdie>
Component: devtools / tool chainAssignee: Paul Eggleton <bluelightning>
Status: VERIFIED FIXED QA Contact: Daniel Istrate <daniel.alexandrux.istrate>
Severity: normal    
Priority: High CC: alexandru.c.georgescu, bluelightning, daniel.alexandrux.istrate, meta.mr.watcher, meta.watcher
Version: 1.8   
Target Milestone: 1.9 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on:    
Bug Blocks: 7994, 8176    

Description Richard Purdie 2015-06-27 22:01:23 UTC
devtool selftest assumes 192.168.7.2 which breaks on the autobuilders since this isn't a valid assumption. This address isn't used on fedora22 which results in:

https://autobuilder.yoctoproject.org/main/builders/nightly-oe-selftest/builds/42/steps/Running%20oe-selftest/logs/stdio
Comment 1 Richard Purdie 2015-06-28 08:50:47 UTC
Note we have now fixed networking on the autobuilders. This test should figure out which IP address qemu is using though, not hardcode it.
Comment 2 Markus Lehtonen 2015-07-09 09:48:14 UTC
How are the tap device(s) and routes setup in the autobuilder setup? Using the runqemu-* scripts or something else?

Do you think it would it be feasible to do something simple like
$ ip route | grep tap | awk '{print $1}'

to get the ip address?
Comment 3 Richard Purdie 2015-07-09 19:21:15 UTC
qemurunner.py is how we do this for the runtime tests. The autobuilder devices are setup by runqemu-gen-tapdevs.

Unfortunately other QA tests have now copied this code so we have the problem in multiple places. CC'ing Daniel who is also looking at this.
Comment 4 Paul Eggleton 2015-07-10 09:54:31 UTC
I have to take the blame for devtool's QA test, the 192.168.7.2 assumption was very naive; but I'm not sure that the image feature tests copied what was done there - the implementation there is separate. Whatever we come up with in terms of doing this properly they ought to be sharing code though, agreed.

However, the other concern here is if we have too many tests that run their own instances of qemu for each test, that's going to be quite a bit of overhead vs. the runtime tests which boot up an instance and then use it for multiple tests. We might be able to reduce that by using kvm instead of the default software emulation in qemu perhaps, but I can't help feeling that there ought to be some kind of bridge between the runtime tests and oe-selftest because the overlap is probably only going to get bigger as time goes on.
Comment 5 Daniel Istrate 2015-07-10 10:52:48 UTC
Hi,

If you need to determine the ip address of the qemu machine, you can take a look at it's start sequence and determine the ip address from there.
For instanse:
daniel@ubuntu-ws:~/poky-test/build$ runqemu qemux86

Continuing with the following parameters:
KERNEL: [/home/daniel/poky-test/build/tmp/deploy/images/qemux86/bzImage-qemux86.bin]
ROOTFS: [/home/daniel/poky-test/build/tmp/deploy/images/qemux86/core-image-minimal-qemux86-20150709115504.rootfs.ext4]
FSTYPE: [ext4]
Acquiring lockfile for tap2...
Acquiring lockfile for tap1...
Setting up tap interface under sudo
Acquiring lockfile for tap0...
Running qemu-system-i386...
/home/daniel/poky-test/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-i386 -kernel /home/daniel/poky-test/build/tmp/deploy/images/qemux86/bzImage-qemux86.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no -cpu qemu32 -drive file=/home/daniel/poky-test/build/tmp/deploy/images/qemux86/core-image-minimal-qemux86-20150709115504.rootfs.ext4,if=ide,format=raw -show-cursor -usb -usbdevice wacom-tablet -vga vmware -no-reboot -m 256 --append "vga=0 uvesafb.mode_option=640x480-32 root=/dev/hda rw mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 rootfstype=ext4 "

On the last line you can see the ip as being ip=192.168.7.2
Determining the tap interface would be to look for this pattern:
'Setting up tap interface under sudo
Acquiring lockfile for tap\d+...'

--Daniel
Comment 6 Markus Lehtonen 2015-07-13 07:51:28 UTC
What do you think about using QemuRunner for running qemu in the selftests, too? That way we could use all it's facilities directly, i.e. QemuRunner.ip et al.
Comment 7 Paul Eggleton 2015-07-13 09:26:11 UTC
(In reply to comment #6)
> What do you think about using QemuRunner for running qemu in the selftests,
> too?

I think that would be a good start, yes.
Comment 9 Daniel Istrate 2015-08-18 07:20:36 UTC
Fixed with edc7780ab749534176780a247ab36d4a1575bc30