From a4b9f94aba1fd2c2bbee19ee39d099efe9e3af8d Mon Sep 17 00:00:00 2001 From: garrytan Date: Wed, 4 Nov 2026 16:38:53 +0000 Subject: [PATCH] test: move the /bin/bash parse case out of the windows-smoke probe test (#3601) Main's windows-smoke runs test/gstack-launch-probe.test.ts, and a hardcoded /bin/bash path takes a file out of the Windows-safe set, so the merged tree failed windows-native-workflows. The case now lives in test/bash32-case-in-substitution.test.ts with the Linux scan. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/bash32-case-in-substitution.test.ts | 15 +++++++++++++-- test/gstack-launch-probe.test.ts | 10 ---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/test/bash32-case-in-substitution.test.ts b/test/bash32-case-in-substitution.test.ts index daefa4f7e..f7f155bae 100644 --- a/test/bash32-case-in-substitution.test.ts +++ b/test/bash32-case-in-substitution.test.ts @@ -2,8 +2,10 @@ * #3601: macOS /bin/bash 3.2 cannot parse a case pattern without its leading * ( inside $( ), and Linux CI's bash 5 can, so bin/gstack-launch-probe.sh * shipped a parse error that made gstack-doctor call the probe "missing". - * The repo-wide case is the guard Linux CI can run; test/gstack-launch-probe - * .test.ts parses the probe with /bin/bash, which is bash 3.2 on macOS. + * The repo-wide case is the guard Linux CI can run; the last case parses the + * probe with /bin/bash, which is bash 3.2 on macOS. It lives here, not in + * test/gstack-launch-probe.test.ts, because that file runs in windows-smoke and + * a hardcoded /bin/bash path takes a file out of the Windows-safe set. */ import { describe, expect, test } from 'bun:test'; import { spawnSync } from 'child_process'; @@ -12,6 +14,7 @@ import * as path from 'path'; import { scanBash32CaseInSubstitution } from './helpers/bash32-case-scan'; const ROOT = path.resolve(import.meta.dir, '..'); +const PROBE = path.join(ROOT, 'bin/gstack-launch-probe.sh'); function trackedShellScripts(): string[] { const files = spawnSync('git', ['ls-files', '-z'], { cwd: ROOT, encoding: 'utf8', timeout: 30_000 }).stdout.split('\0').filter(Boolean); @@ -48,4 +51,12 @@ describe('bash 3.2: case patterns inside a substitution (#3601)', () => { expect(hits).toEqual([]); }); + // Value: protects=the probe parses under macOS /bin/bash 3.2, so gstack-doctor can source it (#3601); + // fails_when=a case pattern inside $( ) loses its leading (, on a macOS runner only: Linux /bin/bash is 5.x, which parsed the old line, + // so the scan above is the Linux CI guard; why_new=test/gstack-launch-probe.test.ts runs PATH bash; seam=none + test.skipIf(!fs.existsSync('/bin/bash'))('bin/gstack-launch-probe.sh parses under /bin/bash (catches #3601 only where /bin/bash is 3.2, i.e. macOS)', () => { + const r = spawnSync('/bin/bash', ['-n', PROBE], { encoding: 'utf8', timeout: 30_000 }); + expect(r.stderr).toBe(''); + expect(r.status).toBe(0); + }); }); diff --git a/test/gstack-launch-probe.test.ts b/test/gstack-launch-probe.test.ts index 2c5359a89..5acc2c580 100644 --- a/test/gstack-launch-probe.test.ts +++ b/test/gstack-launch-probe.test.ts @@ -1,5 +1,4 @@ import { afterEach, describe, expect, test } from 'bun:test'; -import { spawnSync } from 'node:child_process'; import * as fs from 'node:fs'; import * as os from 'node:os'; import * as path from 'node:path'; @@ -81,13 +80,4 @@ describe.skipIf(process.platform === 'win32')('gstack-launch-probe.sh classifica expect(r.stdout).toContain('missing=[bin/gstack-global-discover]'); expect(r.stdout).not.toContain('design/dist/design'); }); - - // Value: protects=the probe parses under macOS /bin/bash 3.2, so gstack-doctor can source it (#3601); - // fails_when=a case pattern inside $( ) loses its leading (, on a macOS runner only: Linux /bin/bash is 5.x, which parsed the old line, - // so test/bash32-case-in-substitution.test.ts is the Linux CI guard; why_new=the cases above run PATH bash; seam=none - test.skipIf(!fs.existsSync('/bin/bash'))('parses under /bin/bash (catches #3601 only where /bin/bash is 3.2, i.e. macOS)', () => { - const r = spawnSync('/bin/bash', ['-n', PROBE], { encoding: 'utf8', timeout: 30_000 }); - expect(r.stderr).toBe(''); - expect(r.status).toBe(0); - }); });