Skip to content

Commit

Permalink
jobs: Fixing environment required to run catkin test targets on pre-i…
Browse files Browse the repository at this point in the history
…ndigo catkin
  • Loading branch information
jbohren committed Jan 6, 2016
1 parent d858cad commit 050de44
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions catkin_tools/jobs/catkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,25 @@
from .job import makedirs


CTR_NUKE_SH = """
#!/usr/bin/env sh
unset CATKIN_TEST_RESULTS_DIR
unset ROS_TEST_RESULTS_DIR
"""


def ctr_nuke(logger, event_queue, prefix):
ctr_nuke_path = os.path.join(prefix, 'etc', 'catkin', 'profile.d')
ctr_nuke_filename = os.path.join(ctr_nuke_path, '06-ctr-nuke.sh')
mkdir_p(ctr_nuke_path)
if not os.path.exists(ctr_nuke_filename):
with open(ctr_nuke_filename, 'w') as ctr_nuke_file:
ctr_nuke_file.write(CTR_NUKE_SH)
return 0

# job factories


def create_catkin_build_job(context, package, package_path, dependencies, force_cmake, pre_clean):
"""Job class for building catkin packages"""

Expand All @@ -61,9 +78,20 @@ def create_catkin_build_job(context, package, package_path, dependencies, force_
makedirs,
path=build_space))

# Define test results directory
catkin_test_results_dir = os.path.join(build_space, 'test_results')
ctr_env = {
'CATKIN_TEST_RESULTS_DIR': catkin_test_results_dir,
'ROS_TEST_RESULTS_DIR': catkin_test_results_dir
}

# Construct CMake command
makefile_path = os.path.join(build_space, 'Makefile')
if not os.path.isfile(makefile_path) or force_cmake:
stages.append(FunctionStage(
'ctr-nuke',
ctr_nuke,
prefix=(devel_space if not context.install else install_space)))
stages.append(CommandStage(
'cmake',
([CMAKE_EXEC,
Expand Down Expand Up @@ -102,6 +130,7 @@ def create_catkin_build_job(context, package, package_path, dependencies, force_
'make',
[MAKE_EXEC] + make_args,
cwd=build_space,
env=ctr_env if 'test' in make_args else {},
logger_factory=CMakeMakeIOBufferProtocol.factory
))

Expand Down

0 comments on commit 050de44

Please # to comment.