Skip to content

Commit f54e206

Browse files
committed
fix(scripts): smoke probe skips cross-compiled targets instead of failing
Cross-compiled binaries (Android arm64 built on Linux x64, etc.) cannot execute --version on the build host — that's expected, not a regression. The smoke script now reports them as SKIP with a clear log line and continues, so CI runners only fail on truly broken targets that match their host architecture.
1 parent 318e7b6 commit f54e206

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

scripts/local-inference-smoke.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,26 @@ function listTargets(root) {
4343
.sort();
4444
}
4545

46+
/**
47+
* Decide whether `target` (e.g. "android-arm64-cpu") can plausibly execute
48+
* on the current host. Cross-compiled binaries (Android arm64 on Linux x64,
49+
* Windows on POSIX, etc.) are recognised as `--version` failures only because
50+
* they're for a different platform — not because they're broken. We skip
51+
* those with a clear log line so CI runners don't false-fail on cross builds.
52+
*/
53+
function targetMatchesHost(target) {
54+
const [targetPlatform, targetArch] = target.split("-");
55+
const hostPlatform = process.platform;
56+
const hostArch = process.arch;
57+
// platform: linux | darwin | win32 | android | windows
58+
const platformMatch =
59+
targetPlatform === hostPlatform ||
60+
(targetPlatform === "windows" && hostPlatform === "win32");
61+
// arch: x64 | arm64 | armv7l | ... (matches Node's process.arch)
62+
const archMatch = targetArch === hostArch;
63+
return platformMatch && archMatch;
64+
}
65+
4666
function probeBinary(binaryPath) {
4767
if (!fs.existsSync(binaryPath)) {
4868
return { ok: false, reason: `missing: ${binaryPath}` };
@@ -106,6 +126,12 @@ function main() {
106126
}
107127
let allOk = true;
108128
for (const target of targets) {
129+
if (!targetMatchesHost(target)) {
130+
console.log(
131+
`SKIP ${target} cross-compiled for ${process.platform}-${process.arch} host (verify on a matching device)`,
132+
);
133+
continue;
134+
}
109135
const targetDir = path.join(root, target);
110136
const ok = probeTarget(targetDir, target);
111137
if (!ok) allOk = false;

0 commit comments

Comments
 (0)