Skip to content

Commit 415aae0

Browse files
authored
Merge pull request #40 from A2R-Lab/codex/docker-output-directory
Fix Docker header output directory
2 parents 089e2a2 + 5d3c508 commit 415aae0

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎install/docker/Dockerfile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ RUN pip install torch --index-url "${TORCH_INDEX_URL}" \
5151
# The sample robot and its generated header. The wheel ships no URDF; this one
5252
# comes from the build context (grid_assets/robots/iiwa14.urdf).
5353
COPY grid_assets/robots/iiwa14.urdf /opt/grid/robots/iiwa14.urdf
54-
RUN grid-generate /opt/grid/robots/iiwa14.urdf -o /opt/grid/iiwa14/grid.cuh \
54+
RUN mkdir -p /opt/grid/iiwa14 \
55+
&& grid-generate /opt/grid/robots/iiwa14.urdf -o /opt/grid/iiwa14/grid.cuh \
5556
&& python -c "import grid_rbd, grid_codegen, jax, torch; print(grid_rbd.__version__, jax.__version__, torch.__version__)"
5657

5758
# Precompile iiwa14 into the image's cache store as a fat binary (no GPU at

‎test/test_publish_workflow.py‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""CPU-only guards for receipt ancestry and publication boundaries."""
22
from pathlib import Path
3+
import os
4+
import subprocess
5+
import sys
36

47
import yaml
58

@@ -35,3 +38,28 @@ def test_testpypi_requires_successful_build_without_inheriting_receipt_skip():
3538
# An explicit status function avoids GitHub's implicit success() across the
3639
# dependency chain, where the tag-only receipt job is skipped on dispatch.
3740
assert job['if'] == "${{ !cancelled() && needs.build.result == 'success' }}"
41+
42+
43+
def test_docker_header_generation_creates_output_directory(tmp_path):
44+
"""Run the recipe's shell prelude with a writer that requires its parent."""
45+
dockerfile = (ROOT / 'install/docker/Dockerfile').read_text().replace('\\\n', '')
46+
run = next(line.removeprefix('RUN ') for line in dockerfile.splitlines()
47+
if line.startswith('RUN ') and 'grid-generate ' in line)
48+
# The following Python import/version print is independent of directory setup.
49+
command = run.split('&& python -c', 1)[0]
50+
command = command.replace('/opt/grid', str(tmp_path / 'grid'))
51+
executable = tmp_path / 'grid-generate'
52+
executable.write_text(
53+
f'#!{sys.executable}\n'
54+
'import pathlib, sys\n'
55+
'pathlib.Path(sys.argv[sys.argv.index("-o") + 1]).write_text("header\\n")\n'
56+
)
57+
executable.chmod(0o755)
58+
env = dict(os.environ, PATH=str(tmp_path) + os.pathsep + os.environ['PATH'])
59+
# The original recipe omitted mkdir; the same writer must fail in that case.
60+
old_command = command[command.index('grid-generate '):]
61+
result = subprocess.run(['sh', '-ec', old_command], env=env, capture_output=True,
62+
text=True)
63+
assert result.returncode != 0 and 'FileNotFoundError' in result.stderr
64+
subprocess.run(['sh', '-ec', command], env=env, check=True, capture_output=True)
65+
assert (tmp_path / 'grid/iiwa14/grid.cuh').read_text() == 'header\n'

0 commit comments

Comments
 (0)