Deeper test x86

This commit is contained in:
Channing Conger
2026-07-01 11:24:27 -07:00
parent 739cfc5849
commit 432d78dd79
8 changed files with 271 additions and 24 deletions
+111
View File
@@ -0,0 +1,111 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "usage: $0 <archive> <binding> <sandbox:true|false> <cargo-target-dir>" >&2
exit 2
}
[[ $# -eq 4 ]] || usage
archive="$1"
binding="$2"
sandbox="$3"
target_dir="$4"
case "$sandbox" in
true | false) ;;
*) usage ;;
esac
if [[ "$(uname -s)" != "Darwin" || "$(uname -m)" != "x86_64" ]]; then
echo "Intel macOS V8 smoke must run natively on x86_64 macOS." >&2
exit 1
fi
if [[ ! -f "$archive" || ! -f "$binding" ]]; then
echo "V8 archive or binding is missing." >&2
exit 1
fi
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
production_entitlements="${repo_root}/.github/scripts/macos-signing/codex.entitlements.plist"
expanded_entitlements="${target_dir}/codex-allow-unsigned-executable-memory.entitlements.plist"
crash_report_dir="${target_dir}/crash-reports"
crash_report_marker="${target_dir}/runtime-smoke-started"
mkdir -p "$target_dir" "$crash_report_dir"
touch "$crash_report_marker"
cp "$production_entitlements" "$expanded_entitlements"
if /usr/libexec/PlistBuddy \
-c "Print :com.apple.security.cs.allow-unsigned-executable-memory" \
"$expanded_entitlements" >/dev/null 2>&1; then
/usr/libexec/PlistBuddy \
-c "Set :com.apple.security.cs.allow-unsigned-executable-memory true" \
"$expanded_entitlements"
else
/usr/libexec/PlistBuddy \
-c "Add :com.apple.security.cs.allow-unsigned-executable-memory bool true" \
"$expanded_entitlements"
fi
cargo_features=()
if [[ "$sandbox" == "true" ]]; then
cargo_features=(--features sandbox)
fi
(
cd "${repo_root}/codex-rs"
export CARGO_TARGET_DIR="$target_dir"
export RUSTY_V8_ARCHIVE="$archive"
export RUSTY_V8_SRC_BINDING_PATH="$binding"
cargo test -p codex-v8-poc "${cargo_features[@]}"
cargo build --release -p codex-v8-poc --example code_mode_runtime_smoke \
"${cargo_features[@]}"
)
probe="${target_dir}/release/examples/code_mode_runtime_smoke"
if [[ ! -x "$probe" ]]; then
echo "Runtime smoke executable was not built at $probe." >&2
exit 1
fi
if [[ "$(lipo -archs "$probe")" != "x86_64" ]]; then
echo "Runtime smoke executable is not x86_64: $(lipo -archs "$probe")" >&2
exit 1
fi
failures=0
for entitlement_profile in production allow-unsigned-executable-memory; do
case "$entitlement_profile" in
production) entitlements="$production_entitlements" ;;
allow-unsigned-executable-memory) entitlements="$expanded_entitlements" ;;
esac
signed_probe="${target_dir}/code_mode_runtime_smoke-${entitlement_profile}"
cp "$probe" "$signed_probe"
codesign --force --sign - --options runtime --entitlements "$entitlements" "$signed_probe"
codesign --verify --strict --verbose=2 "$signed_probe"
for provider in ring aws-lc; do
echo "Running code-mode runtime smoke: entitlements=${entitlement_profile} provider=${provider}"
if "$signed_probe" "$provider"; then
echo "PASS entitlements=${entitlement_profile} provider=${provider}"
else
status=$?
echo "FAIL entitlements=${entitlement_profile} provider=${provider} status=${status}" >&2
failures=$((failures + 1))
fi
done
done
diagnostic_reports="${HOME}/Library/Logs/DiagnosticReports"
if [[ -d "$diagnostic_reports" ]]; then
find "$diagnostic_reports" -type f -name '*.ips' -newer "$crash_report_marker" \
-exec cp {} "$crash_report_dir" \;
fi
if ((failures > 0)); then
echo "$failures Intel macOS code-mode runtime smoke configuration(s) failed." >&2
exit 1
fi
@@ -4,6 +4,7 @@ import unittest
from pathlib import Path
from v8_canary_changes import changed_files
from v8_canary_changes import canary_required
from v8_canary_changes import merge_base
from v8_canary_changes import resolved_v8_version
from v8_canary_changes import windows_source_required
@@ -56,6 +57,14 @@ version = "149.2.0"
)
)
def test_runtime_smoke_changes_require_canary(self) -> None:
for path in (
".github/scripts/smoke_macos_x86_v8.sh",
"codex-rs/v8-poc/examples/code_mode_runtime_smoke.rs",
):
with self.subTest(path=path):
self.assertTrue(canary_required({path}, "149.2.0", "149.2.0"))
def test_changed_files_excludes_changes_made_only_on_base_branch(self) -> None:
with tempfile.TemporaryDirectory() as temp_dir:
root = Path(temp_dir)
+2
View File
@@ -24,6 +24,7 @@ CANARY_PATH_PATTERNS = {
".github/scripts/run_bazel_with_buildbuddy.py",
".github/scripts/rusty_v8_bazel.py",
".github/scripts/rusty_v8_module_bazel.py",
".github/scripts/smoke_macos_x86_v8.sh",
".github/scripts/v8_canary_changes.py",
".github/workflows/postmerge-ci.yml",
".github/workflows/rusty-v8-release.yml",
@@ -31,6 +32,7 @@ CANARY_PATH_PATTERNS = {
"MODULE.bazel",
"MODULE.bazel.lock",
"codex-rs/Cargo.toml",
"codex-rs/v8-poc/**",
"patches/BUILD.bazel",
"patches/llvm_*.patch",
"patches/rules_cc_*.patch",
+14 -12
View File
@@ -320,7 +320,7 @@ jobs:
name: rusty-v8-${{ needs.metadata.outputs.v8_version }}-${{ matrix.variant }}-x86_64-apple-darwin
path: dist/x86_64-apple-darwin
- name: Smoke test staged artifact with Cargo
- name: Smoke test staged artifact and code-mode runtime
env:
SANDBOX: ${{ matrix.sandbox }}
TARGET: x86_64-apple-darwin
@@ -335,18 +335,20 @@ jobs:
exit 1
fi
cargo_args=(test -p codex-v8-poc)
if [[ "${SANDBOX}" == "true" ]]; then
cargo_args+=(--features sandbox)
fi
.github/scripts/smoke_macos_x86_v8.sh \
"${GITHUB_WORKSPACE}/${archive}" \
"${GITHUB_WORKSPACE}/${binding}" \
"${SANDBOX}" \
"${RUNNER_TEMP}/rusty-v8-cargo-smoke-${TARGET}-${SANDBOX}"
(
cd codex-rs
CARGO_TARGET_DIR="${RUNNER_TEMP}/rusty-v8-cargo-smoke-${TARGET}-${SANDBOX}" \
RUSTY_V8_ARCHIVE="${GITHUB_WORKSPACE}/${archive}" \
RUSTY_V8_SRC_BINDING_PATH="${GITHUB_WORKSPACE}/${binding}" \
cargo "${cargo_args[@]}"
)
- name: Upload crash reports
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: rusty-v8-${{ needs.metadata.outputs.v8_version }}-${{ matrix.variant }}-x86_64-macos-crash-reports
path: ${{ runner.temp }}/rusty-v8-cargo-smoke-x86_64-apple-darwin-${{ matrix.sandbox }}/crash-reports/*
if-no-files-found: ignore
retention-days: 7
build-windows-source:
name: Build ptrcomp-sandbox ${{ matrix.target }} from source
+14 -12
View File
@@ -343,7 +343,7 @@ jobs:
name: v8-canary-${{ needs.metadata.outputs.v8_version }}-${{ matrix.variant }}-x86_64-apple-darwin
path: dist/x86_64-apple-darwin
- name: Smoke test staged artifact with Cargo
- name: Smoke test staged artifact and code-mode runtime
env:
SANDBOX: ${{ matrix.sandbox }}
TARGET: x86_64-apple-darwin
@@ -358,18 +358,20 @@ jobs:
exit 1
fi
cargo_args=(test -p codex-v8-poc)
if [[ "${SANDBOX}" == "true" ]]; then
cargo_args+=(--features sandbox)
fi
.github/scripts/smoke_macos_x86_v8.sh \
"${GITHUB_WORKSPACE}/${archive}" \
"${GITHUB_WORKSPACE}/${binding}" \
"${SANDBOX}" \
"${RUNNER_TEMP}/rusty-v8-cargo-smoke-${TARGET}-${SANDBOX}"
(
cd codex-rs
CARGO_TARGET_DIR="${RUNNER_TEMP}/rusty-v8-cargo-smoke-${TARGET}-${SANDBOX}" \
RUSTY_V8_ARCHIVE="${GITHUB_WORKSPACE}/${archive}" \
RUSTY_V8_SRC_BINDING_PATH="${GITHUB_WORKSPACE}/${binding}" \
cargo "${cargo_args[@]}"
)
- name: Upload crash reports
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: v8-canary-${{ needs.metadata.outputs.v8_version }}-${{ matrix.variant }}-x86_64-macos-crash-reports
path: ${{ runner.temp }}/rusty-v8-cargo-smoke-x86_64-apple-darwin-${{ matrix.sandbox }}/crash-reports/*
if-no-files-found: ignore
retention-days: 7
- name: Check for a clean worktree
if: always() && !cancelled()