diff options
author | Ross Burton <ross.burton@intel.com> | 2015-07-23 22:59:48 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-24 23:29:40 +0100 |
commit | 4d777ce9736e91bb560558b691b8025acf784046 (patch) | |
tree | 283c663ce4fe336996a9ef550c5f9d3def08198f /meta | |
parent | 312417c182267584141d4ba62458bdd1d9d9ccb9 (diff) | |
download | openembedded-core-4d777ce9736e91bb560558b691b8025acf784046.tar.gz openembedded-core-4d777ce9736e91bb560558b691b8025acf784046.tar.bz2 openembedded-core-4d777ce9736e91bb560558b691b8025acf784046.zip |
oeqa/selftest/imagefeatures: handle killpg victim not existing
If Pexpect throws an exception it may be because the child has already died, in
which case killpg will fail. Catch the latter exception silently, and output
the exception from Pexpect.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/selftest/imagefeatures.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/meta/lib/oeqa/selftest/imagefeatures.py b/meta/lib/oeqa/selftest/imagefeatures.py index 70ebbe4321..82ea164de1 100644 --- a/meta/lib/oeqa/selftest/imagefeatures.py +++ b/meta/lib/oeqa/selftest/imagefeatures.py @@ -43,9 +43,12 @@ class ImageFeatures(oeSelfTest): proc_qemu.expect(self.get_ip_patt, timeout=100) qemu_ip = proc_qemu.match.group('qemu_ip') proc_qemu.expect('qemux86 login:', timeout=100) - except: - killpg(proc_qemu.pid, signal.SIGTERM) - self.fail('Failed to start qemu.') + except Exception as e: + try: + killpg(proc_qemu.pid, signal.SIGTERM) + except: + pass + self.fail('Failed to start qemu: %s' % e) # Attempt to ssh with each user into qemu with empty password for user in [self.root_user, self.test_user]: @@ -93,9 +96,12 @@ class ImageFeatures(oeSelfTest): proc_qemu.expect(self.get_ip_patt, timeout=100) qemu_ip = proc_qemu.match.group('qemu_ip') proc_qemu.expect('qemux86 login:', timeout=100) - except: - killpg(proc_qemu.pid, signal.SIGTERM) - self.fail('Failed to start qemu.') + except Exception as e: + try: + killpg(proc_qemu.pid, signal.SIGTERM) + except: + pass + self.fail('Failed to start qemu: %s' % e) # Attempt to ssh with each user into qemu with empty password for user in [self.root_user, self.test_user]: @@ -147,9 +153,12 @@ class ImageFeatures(oeSelfTest): proc_qemu.expect(self.prompt) proc_qemu.sendline('rpm --version') proc_qemu.expect(self.prompt) - except: - killpg(proc_qemu.pid, signal.SIGTERM) - self.fail('Failed to boot qemu.') + except Exception as e: + try: + killpg(proc_qemu.pid, signal.SIGTERM) + except: + pass + self.fail('Failed to start qemu: %s' % e) found_rpm_version = proc_qemu.before |