qemuimage-testlib-pythonhelper: Fix process mixups

runqemu-internal runs "ldd qemu-system xxx" and the detection code was returning this
as the PID of qemu. This patch improves the detection code to avoid this problem,
fixing certain race type failures on the autobuilder.

(From OE-Core rev: 0c97fedc42fd9b53dc1dd40fe01f4ac142201269)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2013-04-05 10:00:25 +00:00
parent a5cf163969
commit bd8e22ad58

View File

@ -3,6 +3,7 @@
import optparse import optparse
import subprocess import subprocess
import sys import sys
import os
parser = optparse.OptionParser( parser = optparse.OptionParser(
usage = """ usage = """
@ -52,7 +53,10 @@ if options.findqemu:
newparents = next newparents = next
#print "Children matching %s:" % str(parents) #print "Children matching %s:" % str(parents)
for p in parents: for p in parents:
if "qemu-system" in commands[p]: # Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx"
basecmd = commands[p].split()[0]
basecmd = os.path.basename(basecmd)
if "qemu-system" in basecmd:
print p print p
sys.exit(0) sys.exit(0)
sys.exit(1) sys.exit(1)