[OE-core] [PATCH v2 2/2] runqemu: Add a background command option

Alistair Francis alistair.francis at xilinx.com
Mon Apr 3 17:47:18 UTC 2017


On Sat, Apr 1, 2017 at 12:19 AM, Richard Purdie
<richard.purdie at linuxfoundation.org> wrote:
> On Fri, 2017-03-24 at 13:38 -0700, Alistair Francis wrote:
>> This allows callers to specify commands that should be run in the
>> background
>> while running QEMU. This can be specified by assigning the commands
>> to the
>> 'QB_BACKGROUND_COMMAND' varialbe in the machine conf.
>>
>> This is useful for starting automated debugging instances, automated
>> testing instances (using QMP) or other servers/clients that QEMU can
>> connect to.
>>
>> Signed-off-by: Alistair Francis <alistair.francis at xilinx.com>
>> ---
>>  scripts/runqemu | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/scripts/runqemu b/scripts/runqemu
>> index f76d976..b5cc56a 100755
>> --- a/scripts/runqemu
>> +++ b/scripts/runqemu
>> @@ -1118,6 +1118,13 @@ class BaseConfig(object):
>>                  kernel_opts += " -dtb %s" % self.dtb
>>          else:
>>              kernel_opts = ""
>> +        background_cmd = self.get('QB_BACKGROUND_COMMAND')
>> +
>> +        if background_cmd:
>> +            logger.info('Running in the background %s' %
>> background_cmd)
>> +            if subprocess.call(background_cmd + ' &', shell=True) !=
>> 0:
>> +                raise Exception('Failed to run %s' % cmd)
>> +
>
> I have to admit I'm rather unsure about this. What cleans up this
> process when runqemu finishes?

True, there is nothing cleaning up after the process. The assumption
is that whatever is being run is tied to QEMU somehow and exits when
QEMU exits.

>
> We tend to run into a lot of issues around cleanup and a subprocess
> using "&" doesn't sound too attractive given the general issues we run
> into.

Do you have another option that you would prefer? I'm happy to change
it to something else.

Would it be better if we kept track of the PID and killed the process
before exit?

Thanks,

Alistair

>
> Cheers,
>
> Richard
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core



More information about the Openembedded-core mailing list