From eaf40fbfb33da95b5d407606b51207f50644b834 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 e538b7aa58..06580252dd 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 f6e067da3e..1ba2a10941 100644 --- a/Tools/ardupilotwaf/dronecangen.py +++ b/Tools/ardupilotwaf/dronecangen.py @@ -9,6 +9,7 @@ from waflib.TaskGen import feature, before_method, extension 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 @@ class dronecangen(Task.Task): 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 @@ class dronecangen(Task.Task): 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