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

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
IT之家
IT之家
博客园 - 聂微东
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
Apple Machine Learning Research
Apple Machine Learning Research
WordPress大学
WordPress大学
小众软件
小众软件
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
博客园 - 三生石上(FineUI控件)
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
量子位
月光博客
月光博客
博客园 - 【当耐特】
博客园 - 叶小钗

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
test(scripts): route Parallels lib helpers · openclaw/ope...
vincentkoc · 2026-06-21 · via Recent Commits to openclaw:main
1+

import { spawnSync } from "node:child_process";

2+

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

3+

import path from "node:path";

4+

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

5+

import { cleanupTempDirs, makeTempDir } from "../helpers/temp-dir.js";

6+7+

const BUILD_INFO_COMMIT_SCRIPT = path.resolve(

8+

"scripts/e2e/lib/parallels-package/build-info-commit.mjs",

9+

);

10+

const tempDirs: string[] = [];

11+12+

afterEach(() => {

13+

cleanupTempDirs(tempDirs);

14+

});

15+16+

function shellQuote(value: string): string {

17+

return `'${value.replaceAll("'", "'\\''")}'`;

18+

}

19+20+

function runBash(script: string, env: NodeJS.ProcessEnv = {}) {

21+

return spawnSync("/bin/bash", ["-c", script], {

22+

cwd: process.cwd(),

23+

encoding: "utf8",

24+

env: { ...process.env, ...env },

25+

});

26+

}

27+28+

describe("Parallels lib helpers", () => {

29+

it("reads build-info commit metadata from the current package cwd", () => {

30+

const root = makeTempDir(tempDirs, "openclaw-parallels-build-info-");

31+32+

const missingResult = spawnSync(process.execPath, [BUILD_INFO_COMMIT_SCRIPT], {

33+

cwd: root,

34+

encoding: "utf8",

35+

env: { ...process.env },

36+

});

37+

expect(missingResult.status).toBe(0);

38+

expect(missingResult.stdout).toBe("\n");

39+40+

mkdirSync(path.join(root, "dist"));

41+

writeFileSync(

42+

path.join(root, "dist", "build-info.json"),

43+

`${JSON.stringify({ commit: "abc123" })}\n`,

44+

);

45+

const result = spawnSync(process.execPath, [BUILD_INFO_COMMIT_SCRIPT], {

46+

cwd: root,

47+

encoding: "utf8",

48+

env: { ...process.env },

49+

});

50+51+

expect(result.status).toBe(0);

52+

expect(result.stdout).toBe("abc123\n");

53+

});

54+55+

it("reclaims stale package shell locks and releases current locks", () => {

56+

const root = makeTempDir(tempDirs, "openclaw-parallels-package-lock-");

57+

const lockDir = path.join(root, "build.lock");

58+

const result = runBash(`

59+

set -euo pipefail

60+

source scripts/e2e/lib/parallels-package-common.sh

61+

lock_dir=${shellQuote(lockDir)}

62+

mkdir -p "$lock_dir"

63+

printf '%s\\n' 999999999 >"$lock_dir/pid"

64+

parallels_package_acquire_build_lock "$lock_dir"

65+

owner="$(cat "$lock_dir/pid")"

66+

parallels_package_release_build_lock "$lock_dir"

67+

printf 'owner=%s exists=%s\\n' "$owner" "$([[ -e "$lock_dir" ]] && echo yes || echo no)"

68+

`);

69+70+

expect(result.status).toBe(0);

71+

expect(result.stderr).toContain("warn: Removing stale Parallels build lock");

72+

expect(result.stdout).toMatch(/^owner=\d+ exists=no\n$/u);

73+

expect(result.stdout).not.toContain("owner=999999999");

74+

});

75+76+

it("resolves macOS desktop users through prlctl fallbacks", () => {

77+

const root = makeTempDir(tempDirs, "openclaw-parallels-macos-common-");

78+

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

79+

const macHome = `${"/"}Users/alice`;

80+

mkdirSync(binDir);

81+

const prlctlShim = path.join(binDir, "prlctl");

82+

writeFileSync(

83+

prlctlShim,

84+

`#!/usr/bin/env bash

85+

args="$*"

86+

if [[ "$args" == *"/usr/bin/stat -f %Su /dev/console"* ]]; then

87+

printf 'loginwindow\\r\\n'

88+

exit 0

89+

fi

90+

if [[ "$args" == *"/usr/bin/dscl . -list /Users NFSHomeDirectory"* ]]; then

91+

printf '_daemon /var/root\\r\\nShared %s\\r\\nalice %s\\r\\n' "${`${"/"}Users/Shared`}" "${macHome}"

92+

exit 0

93+

fi

94+

if [[ "$args" == *"-read ${macHome} NFSHomeDirectory"* ]]; then

95+

printf 'NFSHomeDirectory: %s\\r\\n' "${macHome}"

96+

exit 0

97+

fi

98+

exit 1

99+

`,

100+

);

101+

chmodSync(prlctlShim, 0o755);

102+103+

const result = runBash(

104+

`

105+

set -euo pipefail

106+

source scripts/e2e/lib/parallels-macos-common.sh

107+

printf 'user=%s\\n' "$(parallels_macos_resolve_desktop_user macos-vm)"

108+

printf 'home=%s\\n' "$(parallels_macos_resolve_desktop_home macos-vm alice)"

109+

`,

110+

{ PATH: `${binDir}${path.delimiter}${process.env.PATH ?? ""}` },

111+

);

112+113+

expect(result.status).toBe(0);

114+

expect(result.stdout).toBe(`user=alice\nhome=${macHome}\n`);

115+

});

116+

});