Skip to content

Commit

Permalink
waf: help diagnose dronecangen errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Feb 11, 2024
1 parent 38b5d94 commit eaf40fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test_sitl_periph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions Tools/ardupilotwaf/dronecangen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit eaf40fb

Please sign in to comment.