[OE-core] [PATCH 1/2] oeqa/selftest/{context, case}: Add signal handlers SIG{INT, TERM}

Patrick Ohly patrick.ohly at intel.com
Tue Jun 27 06:53:45 UTC 2017


On Mon, 2017-06-26 at 15:42 -0500, Aníbal Limón wrote:
>      def run(self, logger, args):
>          self._process_args(logger, args)
> +
> +        signal.signal(signal.SIGTERM, self._signal_clean_handler)
> +        signal.signal(signal.SIGINT, self._signal_clean_handler)
> +
>          rc = None
>  
>          if args.machine:
> @@ -220,6 +264,8 @@ class
> OESelftestTestContextExecutor(OETestContextExecutor):
>              os.remove(output_link)
>          os.symlink(args.output_log, output_link)
>  
> +        self._signal_clean_handler(None, None)
> +

Can't you achieve the same thing with less code by using a
   try:
      ... modify configuration ...
      ... run tests ...
   finally:
      ... clean up ...
block in run()?

Then you are also guaranteed to clean up if an unexpected exception
triggers the aborting of run().

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.






More information about the Openembedded-core mailing list