functional: Check for processes only if there are any
In one of tests, pstree received SIGSEGV signal and was terminated. This means the output is empty and we check on empty string. This patch makes the test less prone to the errors coming from executed binaries. Change-Id: I22a7f2fea56c9d97a1d765f0f25e9f28c7942b55 Closes-bug: 1659965
This commit is contained in:
parent
cd37b97c29
commit
e5320e7646
|
@ -64,7 +64,8 @@ class TestGetRootHelperChildPid(functional_base.BaseSudoTestCase):
|
|||
['pstree', parent_pid], check_exit_code=False)
|
||||
processes = [command.strip() for command in proc_tree.split('---')
|
||||
if command]
|
||||
return 'sleep' == processes[-1]
|
||||
if processes:
|
||||
return 'sleep' == processes[-1]
|
||||
|
||||
cmd = ['bash', '-c', '(sleep 100)']
|
||||
proc = async_process.AsyncProcess(cmd, run_as_root=True)
|
||||
|
|
Loading…
Reference in New Issue