惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
G
Google Developers Blog
Engineering at Meta
Engineering at Meta
月光博客
月光博客
腾讯CDC
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
The GitHub Blog
The GitHub Blog
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
aimingoo的专栏
aimingoo的专栏
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Martin Fowler
Martin Fowler
A
About on SuperTechFans
博客园 - 叶小钗

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: launch configured ios bundle · openclaw/openclaw@ec2...
joshavant · 2026-06-16 · via Recent Commits to openclaw:main
1+

// iOS run tests cover simulator launch orchestration without touching Xcode.

2+

import { execFileSync } from "node:child_process";

3+

import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";

4+

import os from "node:os";

5+

import path from "node:path";

6+

import { afterEach, describe, expect, it } from "vitest";

7+8+

const SCRIPT = path.join(process.cwd(), "scripts", "ios-run.sh");

9+

const BASH_BIN = process.platform === "win32" ? "bash" : "/bin/bash";

10+11+

const tempDirs: string[] = [];

12+13+

function bashArgs(scriptPath: string): string[] {

14+

return process.platform === "win32" ? [scriptPath] : ["--noprofile", "--norc", scriptPath];

15+

}

16+17+

function writeExecutable(filePath: string, body: string): void {

18+

writeFileSync(filePath, body, "utf8");

19+

chmodSync(filePath, 0o755);

20+

}

21+22+

function makeFixture(bundleId: string): { root: string; script: string; logFile: string } {

23+

const root = mkdtempSync(path.join(os.tmpdir(), "openclaw-ios-run-"));

24+

tempDirs.push(root);

25+26+

const scriptsDir = path.join(root, "scripts");

27+

const iosDir = path.join(root, "apps", "ios");

28+

const binDir = path.join(root, "bin");

29+

const logFile = path.join(root, "commands.log");

30+

mkdirSync(scriptsDir, { recursive: true });

31+

mkdirSync(iosDir, { recursive: true });

32+

mkdirSync(binDir, { recursive: true });

33+34+

const script = path.join(scriptsDir, "ios-run.sh");

35+

writeFileSync(script, readFileSync(SCRIPT, "utf8"), "utf8");

36+

chmodSync(script, 0o755);

37+38+

writeExecutable(

39+

path.join(scriptsDir, "ios-configure-signing.sh"),

40+

`#!/usr/bin/env bash

41+

set -euo pipefail

42+

`,

43+

);

44+

writeExecutable(

45+

path.join(scriptsDir, "ios-write-version-xcconfig.sh"),

46+

`#!/usr/bin/env bash

47+

set -euo pipefail

48+

`,

49+

);

50+

writeExecutable(

51+

path.join(binDir, "xcodegen"),

52+

`#!/usr/bin/env bash

53+

set -euo pipefail

54+

printf 'xcodegen %s\\n' "$*" >>"${logFile}"

55+

`,

56+

);

57+

writeExecutable(

58+

path.join(binDir, "xcodebuild"),

59+

`#!/usr/bin/env bash

60+

set -euo pipefail

61+

printf 'xcodebuild %s\\n' "$*" >>"${logFile}"

62+

derived=""

63+

configuration="Debug"

64+

while [[ $# -gt 0 ]]; do

65+

case "$1" in

66+

-derivedDataPath)

67+

derived="$2"

68+

shift 2

69+

;;

70+

-configuration)

71+

configuration="$2"

72+

shift 2

73+

;;

74+

*)

75+

shift

76+

;;

77+

esac

78+

done

79+

app_dir="$derived/Build/Products/$configuration-iphonesimulator/OpenClaw.app"

80+

mkdir -p "$app_dir"

81+

cat >"$app_dir/Info.plist" <<'PLIST'

82+

<?xml version="1.0" encoding="UTF-8"?>

83+

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

84+

<plist version="1.0"><dict><key>CFBundleIdentifier</key><string>${bundleId}</string></dict></plist>

85+

PLIST

86+

`,

87+

);

88+

writeExecutable(

89+

path.join(binDir, "simctl"),

90+

`#!/usr/bin/env bash

91+

set -euo pipefail

92+

printf 'simctl %s\\n' "$*" >>"${logFile}"

93+

if [[ "$1" == "boot" ]]; then

94+

if [[ "\${SIMCTL_BOOT_MODE:-}" == "booted" ]]; then

95+

echo "Unable to boot device in current state: Booted" >&2

96+

exit 1

97+

fi

98+

if [[ "\${SIMCTL_BOOT_MODE:-}" == "fail" ]]; then

99+

echo "Unable to boot device in current state: Shutdown" >&2

100+

exit 1

101+

fi

102+

fi

103+

`,

104+

);

105+

writeExecutable(

106+

path.join(binDir, "plistbuddy"),

107+

`#!/usr/bin/env bash

108+

set -euo pipefail

109+

sed -n 's:.*<key>CFBundleIdentifier</key><string>\\([^<]*\\)</string>.*:\\1:p' "$3"

110+

`,

111+

);

112+113+

return { root, script, logFile };

114+

}

115+116+

function runIosRun(fixture: { root: string; script: string }, extraEnv = {}): string {

117+

return execFileSync(BASH_BIN, bashArgs(fixture.script), {

118+

env: {

119+

...process.env,

120+

IOS_DERIVED_DATA_DIR: path.join(fixture.root, "DerivedData"),

121+

IOS_RUN_XCODEBUILD_BIN: path.join(fixture.root, "bin", "xcodebuild"),

122+

IOS_RUN_XCODEGEN_BIN: path.join(fixture.root, "bin", "xcodegen"),

123+

IOS_RUN_SIMCTL_BIN: path.join(fixture.root, "bin", "simctl"),

124+

IOS_RUN_PLIST_BUDDY_BIN: path.join(fixture.root, "bin", "plistbuddy"),

125+

...extraEnv,

126+

},

127+

encoding: "utf8",

128+

stdio: ["ignore", "pipe", "pipe"],

129+

});

130+

}

131+132+

describe("scripts/ios-run.sh", () => {

133+

afterEach(() => {

134+

for (const dir of tempDirs.splice(0)) {

135+

rmSync(dir, { recursive: true, force: true });

136+

}

137+

});

138+139+

it("installs and launches the configured app bundle identifier", () => {

140+

const fixture = makeFixture("ai.openclawfoundation.app");

141+142+

runIosRun(fixture, { SIMCTL_BOOT_MODE: "booted" });

143+144+

expect(readFileSync(fixture.logFile, "utf8")).toContain(

145+

"simctl launch iPhone 17 ai.openclawfoundation.app",

146+

);

147+

});

148+149+

it("does not ignore simulator boot failures other than already booted", () => {

150+

const fixture = makeFixture("ai.openclawfoundation.app");

151+152+

expect(() => runIosRun(fixture, { SIMCTL_BOOT_MODE: "fail" })).toThrow();

153+

expect(readFileSync(fixture.logFile, "utf8")).not.toContain("simctl launch");

154+

});

155+

});