chore: integrate main after receiver regression test repair
This commit is contained in:
@@ -47,6 +47,10 @@ const writes = {
|
||||
constructor:
|
||||
"function Box() { return shared; } const t = new Box(); t.x = 2;",
|
||||
callback: "const get = () => shared; [0].forEach(() => { get().x = 2; });",
|
||||
wideMethods: `const box = { ${Array.from(
|
||||
{ length: 64 },
|
||||
(_, index) => `m${index}() { return shared; }`,
|
||||
).join(", ")} }; box.m0().x = 2; box.m63().other = 3;`,
|
||||
};
|
||||
const source = [
|
||||
...Object.entries(writes).map(
|
||||
@@ -61,6 +65,8 @@ const source = [
|
||||
"export function unused(){ const shared = {x: 1}; const get = () => shared; get(); return shared.x; }",
|
||||
"export function nestedCallable(){ const shared = {x: 1}; const get = () => { const inner = () => shared; return {x: 0}; }; get().x = 2; return shared.x; }",
|
||||
"export function unrelated(){ const shared = {x: 1}; const other = {x: 9}; const get = () => shared; get().x = 2; return other.x; }",
|
||||
"export function receiverDistinctScopes(){ const shared = {x: 1}; const box = {outer(){ return shared; }, inner(){ const shared = {x: 9}; return shared; }, noop(){}}; box.noop(); return {outer: shared.x, inner: box.inner().x}; }",
|
||||
"export function receiverDistinctPaths(){ const parent = {left: {x: 1}, right: {x: 9}, keep: 7}; const box = {left(){ return parent.left; }, right(){ return parent.right; }, noop(){}}; box.noop(); return {left: parent.left.x, right: parent.right.x, keep: parent.keep}; }",
|
||||
].join("\n");
|
||||
|
||||
const assertReturns = (fields: JavaScriptReturnFields): void => {
|
||||
@@ -91,6 +97,17 @@ const assertReturns = (fields: JavaScriptReturnFields): void => {
|
||||
expect(fields("unrelated")).toContainEqual(
|
||||
expect.objectContaining({ path: "", state: "literal", value: 9 }),
|
||||
);
|
||||
for (const path of ["/outer", "/inner"])
|
||||
expect(fields("receiverDistinctScopes")).toContainEqual(
|
||||
expect.objectContaining({ path, state: "unknown" }),
|
||||
);
|
||||
for (const path of ["/left", "/right"])
|
||||
expect(fields("receiverDistinctPaths")).toContainEqual(
|
||||
expect.objectContaining({ path, state: "unknown" }),
|
||||
);
|
||||
expect(fields("receiverDistinctPaths")).toContainEqual(
|
||||
expect.objectContaining({ path: "/keep", state: "literal", value: 7 }),
|
||||
);
|
||||
};
|
||||
|
||||
cliTest(
|
||||
|
||||
@@ -33,6 +33,80 @@ describe("ZIP signature detection", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it("uses ZIP magic before the filename suffix", async () => {
|
||||
const root = await createTestTempDirectory("rea-zip-suffix-");
|
||||
const apk = join(root, "renamed.apk");
|
||||
const program = join(root, "program.apk");
|
||||
await writeFile(apk, Buffer.from([0x50, 0x4b, 0x03, 0x04]));
|
||||
await writeFile(program, Buffer.from([0x7f, 0x45, 0x4c, 0x46]));
|
||||
expect(
|
||||
(await classifyAndHashRoot(apk, false, await lstat(apk))).format,
|
||||
).toBe("apk");
|
||||
expect(
|
||||
(await classifyAndHashRoot(program, false, await lstat(program))).format,
|
||||
).toBe("elf");
|
||||
});
|
||||
|
||||
it("requires container magic for asar, pkg, and dmg suffixes", async () => {
|
||||
const root = await createTestTempDirectory("rea-container-magic-");
|
||||
const asar = join(root, "app.asar");
|
||||
const textAsar = join(root, "notes.asar");
|
||||
const pkg = join(root, "install.pkg");
|
||||
const textPkg = join(root, "notes.pkg");
|
||||
const dmg = join(root, "image.dmg");
|
||||
const textDmg = join(root, "notes.dmg");
|
||||
const headerSize = 20;
|
||||
await writeFile(
|
||||
asar,
|
||||
Buffer.from([
|
||||
4,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
headerSize,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
headerSize - 4,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0x7b,
|
||||
0x7d,
|
||||
]),
|
||||
);
|
||||
await writeFile(textAsar, Buffer.from("not an asar"));
|
||||
await writeFile(pkg, Buffer.from("xar!"));
|
||||
await writeFile(textPkg, Buffer.from("not a pkg"));
|
||||
const image = Buffer.alloc(512);
|
||||
image.write("koly", 0, "ascii");
|
||||
await writeFile(dmg, image);
|
||||
await writeFile(textDmg, Buffer.from("not a dmg"));
|
||||
expect(
|
||||
(await classifyAndHashRoot(asar, false, await lstat(asar))).format,
|
||||
).toBe("asar");
|
||||
expect(
|
||||
(await classifyAndHashRoot(textAsar, false, await lstat(textAsar)))
|
||||
.format,
|
||||
).toBe("file");
|
||||
expect(
|
||||
(await classifyAndHashRoot(pkg, false, await lstat(pkg))).format,
|
||||
).toBe("pkg");
|
||||
expect(
|
||||
(await classifyAndHashRoot(textPkg, false, await lstat(textPkg))).format,
|
||||
).toBe("file");
|
||||
expect(
|
||||
(await classifyAndHashRoot(dmg, false, await lstat(dmg))).format,
|
||||
).toBe("dmg");
|
||||
expect(
|
||||
(await classifyAndHashRoot(textDmg, false, await lstat(textDmg))).format,
|
||||
).toBe("file");
|
||||
});
|
||||
|
||||
it.each([[], [0x50], [0x50, 0x4b], [0x50, 0x4b, 0x03]])(
|
||||
"rejects an incomplete signature %j",
|
||||
async (...bytes) => {
|
||||
|
||||
@@ -324,7 +324,7 @@ it("cancels a waiting request promptly while keeping later launches behind the a
|
||||
await assertFirmwareCleanup(fixture.launches);
|
||||
});
|
||||
|
||||
it("retains an uncertain workspace and blocks new launches after cleanup failure", async () => {
|
||||
it("retains an uncertain workspace and lets the next operation create a new root", async () => {
|
||||
const fixture = await firmwareFixture("cleanup-failure");
|
||||
const first = await fixture.service.execute("inspect_firmware_regions", {
|
||||
path: fixture.path,
|
||||
@@ -335,12 +335,18 @@ it("retains an uncertain workspace and blocks new launches after cleanup failure
|
||||
});
|
||||
const workspace = fixture.launches[0]?.cwd;
|
||||
expect(workspace).toBeDefined();
|
||||
if (workspace !== undefined) await access(workspace);
|
||||
if (workspace === undefined) return;
|
||||
await access(workspace);
|
||||
const next = await fixture.service.execute("inspect_firmware_regions", {
|
||||
path: fixture.path,
|
||||
});
|
||||
expect(next).toMatchObject({ ok: false, error: { cleanupIncomplete: true } });
|
||||
expect(fixture.launches).toHaveLength(1);
|
||||
expect(fixture.launches).toHaveLength(2);
|
||||
const nextWorkspace = fixture.launches[1]?.cwd;
|
||||
expect(nextWorkspace).toBeDefined();
|
||||
expect(nextWorkspace).not.toBe(workspace);
|
||||
await access(workspace);
|
||||
if (nextWorkspace !== undefined) await access(nextWorkspace);
|
||||
});
|
||||
|
||||
it("accepts another build on the verified release line and reports it", async () => {
|
||||
|
||||
@@ -37,12 +37,14 @@ describe("Android application projection", () => {
|
||||
Uint8Array.from([0x64, 0x65, 0x78, 0x0a, 0x30, 0x33, 0x35, 0]),
|
||||
),
|
||||
);
|
||||
await writer.add(
|
||||
"lib/arm64-v8a/libreactnativejni.so",
|
||||
const elf = () =>
|
||||
new Uint8ArrayReader(
|
||||
Uint8Array.from([0x7f, 0x45, 0x4c, 0x46, 2, 1, 1, 0]),
|
||||
),
|
||||
);
|
||||
);
|
||||
await writer.add("lib/arm64-v8a/libreactnativejni.so", elf());
|
||||
await writer.add("lib/arm64-v8a/libflutter.so", elf());
|
||||
await writer.add("lib/arm64-v8a/libunity.so", elf());
|
||||
await writer.add("lib/arm64-v8a/libcommunity.so", elf());
|
||||
await writer.add("assets/index.js", new TextReader("bridge();"));
|
||||
await writer.add("META-INF/FIXTURE.RSA", new TextReader("opaque signing"));
|
||||
await writeFile(path, await writer.close());
|
||||
@@ -72,20 +74,34 @@ describe("Android application projection", () => {
|
||||
});
|
||||
expect(left.components.manifests).toHaveLength(1);
|
||||
expect(left.components.dex).toHaveLength(1);
|
||||
expect(left.components.native_libraries).toHaveLength(1);
|
||||
expect(left.components.native_libraries).toHaveLength(4);
|
||||
expect(left.components.javascript).toHaveLength(1);
|
||||
expect(left.components.signing).toHaveLength(1);
|
||||
expect(left.runtime_families).toEqual(
|
||||
expect.arrayContaining([
|
||||
"dalvik-art",
|
||||
"flutter",
|
||||
"javascript",
|
||||
"native",
|
||||
"react-native",
|
||||
"unity",
|
||||
]),
|
||||
);
|
||||
expect(left.bridge_candidates).toEqual([
|
||||
expect.objectContaining({ basis: "react-native-convention" }),
|
||||
]);
|
||||
expect(left.runtime_families).not.toContain("community");
|
||||
expect(left.bridge_candidates).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ basis: "react-native-convention" }),
|
||||
expect.objectContaining({ basis: "flutter-convention" }),
|
||||
expect.objectContaining({ basis: "unity-convention" }),
|
||||
]),
|
||||
);
|
||||
const community = left.bridge_candidates.filter(({ native_path }) =>
|
||||
native_path.endsWith("libcommunity.so"),
|
||||
);
|
||||
expect(community.length).toBeGreaterThan(0);
|
||||
expect(
|
||||
community.every(({ basis }) => basis === "jni-library-convention"),
|
||||
).toBe(true);
|
||||
expect(left.limitations).toEqual(
|
||||
expect.arrayContaining([
|
||||
"A bridge basis is inferred from the native path and is repeated for every managed component.",
|
||||
|
||||
Reference in New Issue
Block a user