From 9d385c815e26343b5303b0370d82c4efe0d54066 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 22 Aug 2022 18:37:48 +1000 Subject: [PATCH] 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. --- Tools/autotest/pysim/util.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Tools/autotest/pysim/util.py b/Tools/autotest/pysim/util.py index 07fe600a9b..56f523340a 100644 --- a/Tools/autotest/pysim/util.py +++ b/Tools/autotest/pysim/util.py @@ -367,6 +367,26 @@ def kill_mac_terminal(): 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, valgrind=False, callgrind=False, @@ -496,7 +516,6 @@ def start_SITL(binary, autotest_dir = os.path.realpath(os.path.join(mydir, '..')) runme = [os.path.join(autotest_dir, "run_in_terminal_window.sh"), 'mactest'] runme.extend(cmd) - print(runme) print(cmd) out = subprocess.Popen(runme, stdout=subprocess.PIPE).communicate()[0] out = out.decode('utf-8') @@ -516,6 +535,7 @@ def start_SITL(binary, windowID.append(tabs[0]) else: print("Cannot find %s process terminal" % binary) + child = FakeMacOSXSpawn() elif gdb and not os.getenv('DISPLAY'): subprocess.Popen(cmd) atexit.register(kill_screen_gdb)