From 5fda300c5682a146c64589886b03638af3031e8c Mon Sep 17 00:00:00 2001 From: Christopher Wecht Date: Fri, 9 Sep 2022 14:30:05 +0200 Subject: [PATCH] ament_cmake_tests: add support for TEST_REFIX to run_test.py --- ament_cmake_test/ament_cmake_test/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ament_cmake_test/ament_cmake_test/__init__.py b/ament_cmake_test/ament_cmake_test/__init__.py index 2b6f90ae..9c3a0e56 100644 --- a/ament_cmake_test/ament_cmake_test/__init__.py +++ b/ament_cmake_test/ament_cmake_test/__init__.py @@ -21,6 +21,7 @@ import subprocess import sys import time +import shlex from xml.etree.ElementTree import ElementTree from xml.etree.ElementTree import ParseError from xml.sax.saxutils import quoteattr @@ -197,9 +198,14 @@ def log(msg, **kwargs): start_time = time.monotonic() + cmd = args.command + if 'TEST_PREFIX' in os.environ: + os_posix = os.name == "posix" + cmd = shlex.split(os.environ['TEST_PREFIX'], os_posix) + cmd + try: proc = subprocess.Popen( - args.command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env) while True: line = proc.stdout.readline()