Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(cua-driver): build macOS fixtures for the host architecture (#5202)
injaneityc93de1ae9c91
diff --git a/libs/cua-driver/scripts/tests/test_fixture_macos_arch.py b/libs/cua-driver/scripts/tests/test_fixture_macos_arch.pynew file mode 100644index 0000000000..b69eede053--- /dev/null+++ b/libs/cua-driver/scripts/tests/test_fixture_macos_arch.py@@ -0,0 +1,58 @@+from __future__ import annotations++import os+import shutil+import subprocess+from pathlib import Path++import pytest++REPO_ROOT = Path(__file__).resolve().parents[4]+BUILD_SCRIPT = REPO_ROOT / "libs/cua-driver/tests/fixtures/build/macos.sh"++FAKE_UNAME = '#!/usr/bin/env bash\nprintf "%s\\n" "$FAKE_UNAME_ARCH"\n'+FAKE_XCRUN = """#!/usr/bin/env bash+printf '%s\\n' "$*" >> "$FAKE_TOOL_LOG"+while [[ $# -gt 0 && "$1" != "-o" ]]; do shift; done+: > "$2"+"""+++def _write_executable(path: Path, body: str) -> None:+ path.write_text(body, encoding="utf-8")+ path.chmod(0o755)+++ os.name != "posix" or shutil.which("bash") is None,+ reason="requires a posix host with bash",+)[email protected]("arch", ["x86_64", "arm64"])+def test_fixture_build_targets_host_arch(tmp_path: Path, arch: str) -> None:+ driver_root = tmp_path / "cua-driver"+ script = driver_root / "tests/fixtures/build/macos.sh"+ script.parent.mkdir(parents=True)+ shutil.copy2(BUILD_SCRIPT, script)+ (driver_root / "rust/test-apps").mkdir(parents=True)++ fake_bin = tmp_path / "fake-bin"+ fake_bin.mkdir()+ _write_executable(fake_bin / "uname", FAKE_UNAME)+ _write_executable(fake_bin / "xcrun", FAKE_XCRUN)+ tool_log = tmp_path / "tools.log"++ result = subprocess.run(+ ["bash", str(script), "--only", "appkit"],+ check=False,+ capture_output=True,+ text=True,+ env={+ **os.environ,+ "PATH": f"{fake_bin}{os.pathsep}{os.environ['PATH']}",+ "FAKE_TOOL_LOG": str(tool_log),+ "FAKE_UNAME_ARCH": arch,+ },+ )++ assert result.returncode == 0, result.stderr+ assert f"-target {arch}-apple-macos13.0 " in tool_log.read_text(encoding="utf-8")diff --git a/libs/cua-driver/tests/fixtures/build/macos.sh b/libs/cua-driver/tests/fixtures/build/macos.shindex 8c50f2d375..06537265b3 100755--- a/libs/cua-driver/tests/fixtures/build/macos.sh+++ b/libs/cua-driver/tests/fixtures/build/macos.sh@@ -64,7 +64,7 @@ build_app() {# shellcheck disable=SC2086 # word-splitting on $frameworks is intentionalxcrun swiftc \-O \- -target arm64-apple-macos13.0 \+ -target "$(uname -m)-apple-macos13.0" \$frameworks \-parse-as-library \-o "$exe_path" \