Skip to content

chroot substitution is inconsistent with experimental_test_shell_command #22014

Open
@jcrobak

Description

@jcrobak

Describe the bug
chroot substitution is inconsistent with experimental_test_shell_command (and others?).

Specifically, I noticed that saying echo "{chroot}" works as expected by echo "{chroot}/foo" does not.

Pants version
2.24.1

OS
MacOS

Additional info

Here's a self-contained script to repro the problem:

#!/bin/bash

# Create the pants.toml file
cat << 'EOF' > pants.toml
[GLOBAL]
pants_version = "2.24.1"

backend_packages = [
      "pants.backend.shell",
]
EOF

# Create the BUILD file
cat << 'EOF' > BUILD
experimental_test_shell_command(
    name="test",
    command="""
        echo "starting test..."
        echo "{chroot}"
        echo "{chroot}/foo"
        echo "...test complete"
        exit 1
    """,
    log_output=True,
)
EOF

pants test ::

Example output:

09:39:35.57 [INFO] Initializing scheduler...
09:39:35.59 [INFO] Initializing Nailgun pool for 28 processes...
09:39:35.68 [INFO] Scheduler initialized.
09:39:35.87 [INFO] Completed: Running the `experimental_test_shell_command` at `//:test`
09:39:35.88 [ERROR] Completed: Test with shell command - //:test - failed (exit code 1).
starting test...
/private/var/folders/mm/n9m9_2sd77b4gqm1938rhx_m0000gn/T/pants-sandbox-6hlDar
foo
...test complete

The expected output should look like:

starting test...
/private/var/folders/mm/n9m9_2sd77b4gqm1938rhx_m0000gn/T/pants-sandbox-6hlDar
/private/var/folders/mm/n9m9_2sd77b4gqm1938rhx_m0000gn/T/pants-sandbox-6hlDar/foo
...test complete

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions