-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Expand file tree
/
Copy pathbuild-llama-cpp-dflash-targets.test.mjs
More file actions
40 lines (36 loc) · 1.53 KB
/
build-llama-cpp-dflash-targets.test.mjs
File metadata and controls
40 lines (36 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import assert from "node:assert/strict";
import { it as test } from "vitest";
import { formatHelpText, parseArgs } from "./build-llama-cpp-dflash.mjs";
test("help advertises supported fused targets but not mobile fused targets", () => {
const helpText = formatHelpText();
assert.match(helpText, /linux-aarch64-cuda-fused/);
assert.match(helpText, /darwin-arm64-metal-fused/);
assert.doesNotMatch(helpText, /android-arm64-cpu-fused/);
assert.doesNotMatch(helpText, /android-x86_64-cpu-fused/);
assert.doesNotMatch(helpText, /ios-arm64-metal-fused/);
assert.doesNotMatch(helpText, /ios-arm64-simulator-metal-fused/);
});
test("unsupported mobile fused targets fail closed with explicit diagnostics", () => {
const cases = [
["android-arm64-cpu-fused", /Android fused FFI is not wired/],
["android-arm64-vulkan-fused", /Android fused FFI is not wired/],
[
"android-x86_64-cpu-fused",
/Android x86_64 fused FFI is not a dflash target/,
],
[
"android-x86_64-vulkan-fused",
/Android x86_64 fused FFI is not a dflash target/,
],
["ios-arm64-metal-fused", /iOS fused FFI is not wired/],
["ios-arm64-simulator-metal-fused", /iOS fused FFI is not wired/],
];
for (const [target, pattern] of cases) {
assert.throws(() => parseArgs(["--target", target, "--dry-run"]), (err) => {
const message = err instanceof Error ? err.message : String(err);
assert.match(message, pattern, message);
assert.match(message, new RegExp(target), message);
return true;
});
}
});