Skip to content

Commit 7db4b3d

Browse files
committed
fix(test): prepare macos runner tmpdir
1 parent c14c043 commit 7db4b3d

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

scripts/crabbox-wrapper.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,9 @@ function remoteAwsMacosJsBootstrap() {
11061106
`node_version=${shellQuote(nodeVersion)};`,
11071107
'arch="$(uname -m)";',
11081108
'case "$arch" in arm64) node_arch=arm64 ;; x86_64) node_arch=x64 ;; *) echo "unsupported macOS arch: $arch" >&2; return 2 ;; esac;',
1109+
'if [ -z "${TMPDIR:-}" ]; then export TMPDIR="/tmp"; fi;',
1110+
'if [ ! -d "$TMPDIR" ]; then mkdir -p "$TMPDIR" 2>/dev/null || export TMPDIR="/tmp"; fi;',
1111+
'if [ ! -d "$TMPDIR" ]; then echo "usable TMPDIR not found: $TMPDIR" >&2; return 1; fi;',
11091112
'node_dir="$tool_root/node-v${node_version}-darwin-${node_arch}";',
11101113
'export PATH="$node_dir/bin:$pnpm_home:$PATH";',
11111114
'if [ ! -x "$node_dir/bin/node" ]; then',

test/scripts/crabbox-wrapper.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ describe("scripts/crabbox-wrapper", () => {
274274
expect(remoteCommand).toContain("shasum -a 256 -c -");
275275
expect(remoteCommand).not.toContain("set -euo pipefail");
276276
expect(remoteCommand).toContain('return "$status"');
277+
expect(remoteCommand).toContain('if [ -z "${TMPDIR:-}" ]; then export TMPDIR="/tmp"; fi;');
278+
expect(remoteCommand).toContain('mkdir -p "$TMPDIR"');
279+
expect(remoteCommand).toContain('usable TMPDIR not found: $TMPDIR');
277280
expect(remoteCommand).toContain("node --version >&2");
278281
expect(remoteCommand).toContain("pnpm --version >&2");
279282
expectGroupedShellCommand(remoteCommand, "pnpm --version");
@@ -328,6 +331,7 @@ describe("scripts/crabbox-wrapper", () => {
328331
"bootstrapping a pinned user-local Node toolchain before the command",
329332
);
330333
expect(output.scriptContent).toContain("openclaw_crabbox_bootstrap_macos_js");
334+
expect(output.scriptContent).toContain('if [ ! -d "$TMPDIR" ]; then mkdir -p "$TMPDIR"');
331335
expect(output.scriptContent).toContain("openclaw_crabbox_bootstrap_macos_js || exit $?");
332336
expect(output.scriptContent).toContain(`\n${script}`);
333337
});

0 commit comments

Comments
 (0)