Browse Source

autotest: util.py: create fake object for MakeOSX SITL object

autotest keeps self.sitl around as a handle on the running SITL binary instance.  MacOSX was returning None for this object, making method calls on it unhelpful.

This fake object will just ignore calls on it.
master
Peter Barker 2 years ago committed by Peter Barker
parent
commit
9d385c815e
  1. 22
      Tools/autotest/pysim/util.py

22
Tools/autotest/pysim/util.py

@ -367,6 +367,26 @@ def kill_mac_terminal():
os.system(cmd) os.system(cmd)
class FakeMacOSXSpawn(object):
'''something that looks like a pspawn child so we can ignore attempts
to pause (and otherwise kill(1) SITL. MacOSX using osascript to
start/stop sitl
'''
def __init__(self):
pass
def progress(self, message):
print(message)
def kill(self, sig):
# self.progress("FakeMacOSXSpawn: ignoring kill(%s)" % str(sig))
pass
def isalive(self):
self.progress("FakeMacOSXSpawn: assuming process is alive")
return True
def start_SITL(binary, def start_SITL(binary,
valgrind=False, valgrind=False,
callgrind=False, callgrind=False,
@ -496,7 +516,6 @@ def start_SITL(binary,
autotest_dir = os.path.realpath(os.path.join(mydir, '..')) autotest_dir = os.path.realpath(os.path.join(mydir, '..'))
runme = [os.path.join(autotest_dir, "run_in_terminal_window.sh"), 'mactest'] runme = [os.path.join(autotest_dir, "run_in_terminal_window.sh"), 'mactest']
runme.extend(cmd) runme.extend(cmd)
print(runme)
print(cmd) print(cmd)
out = subprocess.Popen(runme, stdout=subprocess.PIPE).communicate()[0] out = subprocess.Popen(runme, stdout=subprocess.PIPE).communicate()[0]
out = out.decode('utf-8') out = out.decode('utf-8')
@ -516,6 +535,7 @@ def start_SITL(binary,
windowID.append(tabs[0]) windowID.append(tabs[0])
else: else:
print("Cannot find %s process terminal" % binary) print("Cannot find %s process terminal" % binary)
child = FakeMacOSXSpawn()
elif gdb and not os.getenv('DISPLAY'): elif gdb and not os.getenv('DISPLAY'):
subprocess.Popen(cmd) subprocess.Popen(cmd)
atexit.register(kill_screen_gdb) atexit.register(kill_screen_gdb)

Loading…
Cancel
Save