diff options
| author | hathach <[email protected]> | 2026-08-24 14:30:03 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2026-08-24 14:30:03 +0700 |
| commit | b7c2f8060497384df0af4f756c5b66f7d9e83f7b (patch) | |
| tree | 0d7c6f813be3257489083f1e9aed8527ab08ab99 | |
| parent | 3c54f06542127c59f2794c2bd72b2243a28534b5 (diff) | |
test: quote the probe script's shell assignmentsclaude/ci-empty-families
The extras-block probe wrote BUILD_SELECT_FILE and MATRIX_JSON by raw string
concatenation, so a TMPDIR containing a space split the assignment and failed the
test for a reason with nothing to do with the block under test. Reproduced with
TMPDIR="/tmp/has space": test_a_real_family_list_stays_scoped fails before the fix
and passes after, and the whole suite is green under both.
Found by Copilot on #3845.
| -rw-r--r-- | test/hil/test/test_ci_metrics.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/hil/test/test_ci_metrics.py b/test/hil/test/test_ci_metrics.py index fb1019b56..7f715e48e 100644 --- a/test/hil/test/test_ci_metrics.py +++ b/test/hil/test/test_ci_metrics.py @@ -450,7 +450,7 @@ class TestWorkflowSelectionHandOff(unittest.TestCase): def _run_extras_block(self, sel): """Extract the build-extras shell block from build.yml and run it for real. Nothing else exercises it, which is why the empty/rejected conflation shipped.""" - import re as _re, subprocess, tempfile, json as _json + import re as _re, shlex, subprocess, tempfile, json as _json repo = os.path.dirname(CIRCLECI) i = self.build.index("EXAMPLE_MAP='{}'\n BUILD_FILTERED='false'") i = self.build.rindex('\n', 0, i) + 1 @@ -466,8 +466,10 @@ class TestWorkflowSelectionHandOff(unittest.TestCase): self.assertTrue(matrix, 'ci_set_matrix produced nothing') sh = os.path.join(d, 'probe.sh') with open(sh, 'w') as fh: - fh.write('BUILD_SELECT_FILE=' + selp + '\n') - fh.write("MATRIX_JSON='" + matrix + "'\n") + # shlex.quote, not hand-rolled quoting: a TMPDIR with a space in it + # made this fail for a reason that had nothing to do with the block + fh.write('BUILD_SELECT_FILE=' + shlex.quote(selp) + '\n') + fh.write('MATRIX_JSON=' + shlex.quote(matrix) + '\n') fh.write(block) # sentinel + newline separated: the block itself writes ::warning:: to # stdout, and '|' would collide with the regex's own separator |
