From 54aeccf74ea1ca45fd0a3022ac2f286c8c2b09b3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 11 Feb 2024 11:11:40 +1100 Subject: [PATCH] waf: help diagnose dronecangen errors --- .github/workflows/test_sitl_periph.yml | 1 + Tools/ardupilotwaf/dronecangen.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_sitl_periph.yml b/.github/workflows/test_sitl_periph.yml index e538b7aa58700..06580252dd802 100644 --- a/.github/workflows/test_sitl_periph.yml +++ b/.github/workflows/test_sitl_periph.yml @@ -185,6 +185,7 @@ jobs: - name: run dronecan dsdlc generator test run: | PATH="/github/home/.local/bin:$PATH" + python -m pip install --upgrade dronecan python modules/DroneCAN/dronecan_dsdlc/dronecan_dsdlc.py -O dsdlc_generated modules/DroneCAN/DSDL/uavcan modules/DroneCAN/DSDL/dronecan modules/DroneCAN/DSDL/com --run-test - name: build sitl_periph_universal diff --git a/Tools/ardupilotwaf/dronecangen.py b/Tools/ardupilotwaf/dronecangen.py index f6e067da3ea23..1ba2a10941e54 100644 --- a/Tools/ardupilotwaf/dronecangen.py +++ b/Tools/ardupilotwaf/dronecangen.py @@ -9,6 +9,7 @@ import os import os.path from xml.etree import ElementTree as et +import subprocess class dronecangen(Task.Task): """generate uavcan header files""" @@ -21,9 +22,10 @@ def run(self): src = self.env.get_flat('SRC') dsdlc = self.env.get_flat("DC_DSDL_COMPILER") - ret = self.exec_command(['{}'.format(python), - '{}'.format(dsdlc), - '-O{}'.format(out)] + [x.abspath() for x in self.inputs]) + cmd = ['{}'.format(python), + '{}'.format(dsdlc), + '-O{}'.format(out)] + [x.abspath() for x in self.inputs] + ret = self.exec_command(cmd) if ret != 0: # ignore if there was a signal to the interpreter rather # than a real error in the script. Some environments use a @@ -32,6 +34,9 @@ def run(self): Logs.warn('dronecangen crashed with code: {}'.format(ret)) ret = 0 else: + Logs.warn('dronecangen: cmd=%s ' % str(cmd)) + # re-run command with stdout visible to see errors + subprocess.call(cmd) Logs.error('dronecangen returned {} error code'.format(ret)) return ret