Skip to content

Commit

Permalink
Implement the test_require_gpu across ci jobs
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Luis Rivero <[email protected]>
  • Loading branch information
j-rivero committed Jul 2, 2024
1 parent 585cdc9 commit 4e0466e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/configuration_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ The following options are valid in version ``1`` (beside the generic options):
By default, the resulting archives are only available to other jobs within
Jenkins.

* ``tests_require_gpu``: a boolean flag to indicate if software tests needs gpu
support to run correctly.
The following options are valid as keys in the ``_config`` dict under
``targets``:

Expand Down
2 changes: 2 additions & 0 deletions ros_buildfarm/ci_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ def _get_ci_job_config(
'ros_version': ros_version,
'build_environment_variables': build_environment_variables,

'require_gpu_support': build_file.tests_require_gpu_default,

'timeout_minutes': build_file.jenkins_job_timeout,

'repos_file_urls': repos_files,
Expand Down
5 changes: 5 additions & 0 deletions ros_buildfarm/config/ci_build_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ def __init__(self, name, data): # noqa: D107
self.show_plots[plot_group].append(
PlotConfig(name, plot_config_data))

self.tests_require_gpu_default = False
if 'tests_require_gpu' in data:
self.tests_require_gpu_default = bool(
data['tests_require_gpu'])

self.benchmark_patterns = []
if 'benchmark_patterns' in data:
self.benchmark_patterns = data['benchmark_patterns']
Expand Down
2 changes: 0 additions & 2 deletions ros_buildfarm/scripts/devel/build_and_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from ros_buildfarm.argument import add_argument_build_tool
from ros_buildfarm.argument import add_argument_build_tool_args
from ros_buildfarm.argument import add_argument_build_tool_test_args
from ros_buildfarm.argument import add_argument_require_gpu_support
from ros_buildfarm.argument import add_argument_ros_version
from ros_buildfarm.argument import extract_multiple_remainders
from ros_buildfarm.common import Scope
Expand Down Expand Up @@ -58,7 +57,6 @@ def main(argv=sys.argv[1:]):
action='store_true',
help='The flag if the workspace should be cleaned after the '
'invocation')
add_argument_require_gpu_support(parser)

remainder_args = extract_multiple_remainders(argv, (a1, a2))
args = parser.parse_args(argv)
Expand Down
2 changes: 2 additions & 0 deletions ros_buildfarm/templates/ci/ci_job.xml.em
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,13 @@ parameters = [
'export UNDERLAY%d_JOB_SPACE=$WORKSPACE/underlay%d/ros%d-linux' % (i + 1, i + 1, local_ros_version)
for i, local_ros_version in zip(range(len(underlay_source_jobs)), [ros_version] * len(underlay_source_jobs))
] + [
('if [ ! -c /dev/nvidia[0-9] ]; then echo "--require-gpu-support is enabled but can not detect nvidia support installed" && exit 1; fi' if require_gpu_support else ''),
'rm -fr $WORKSPACE/ws/test_results',
'mkdir -p $WORKSPACE/ws/test_results',
'# If using Podman, change the user namespace to preserve UID. No effect if using Docker.',
'export PODMAN_USERNS=keep-id',
'docker run' +
(' --env=DISPLAY=:0.0 --env=QT_X11_NO_MITSHM=1 --volume=/tmp/.X11-unix:/tmp/.X11-unix:rw --gpus all' if require_gpu_support else '') +
' --rm ' +
' --cidfile=$WORKSPACE/docker_build_and_test/docker.cid' +
((' -e CCACHE_DIR=/home/buildfarm/.ccache' +
Expand Down

0 comments on commit 4e0466e

Please sign in to comment.