Files
qwen-code/scripts/tests/landlock-helper-assets.test.js
jinyeandQwen-Coder 1a5a74bc35 feat(core): Add Landlock execution fallback (#12278)
* feat(core): Add Landlock execution fallback

Co-authored-by: Qwen-Coder <[email protected]>

* fix(ci): Track Landlock helper workflow size

Co-authored-by: Qwen-Coder <[email protected]>

* docs(sandbox): Clarify Landlock compatibility limits

Co-authored-by: Qwen-Coder <[email protected]>

* fix(sandbox): Repair installed Landlock helpers and prompt guidance

Restore missing execute bits only for the bundled helper, anchor asset lookup to the actual source layout, and describe the effective Landlock boundary in the model prompt. Keep portable asset checks on Windows.

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: Qwen-Coder <[email protected]>
2026-09-29 03:45:46 +00:00

38 lines
1007 B
JavaScript

/**
* @license
* Copyright 2026 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/
import { readFileSync, statSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
const root = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'../..',
);
describe('bundled Landlock helpers', () => {
it.each([
['x64', 62],
['arm64', 183],
])('ships an executable Linux ELF for %s', (arch, machine) => {
const binary = path.join(
root,
'packages/core/vendor/landlock-run',
`${arch}-linux`,
'qwen-landlock-run',
);
const header = readFileSync(binary).subarray(0, 20);
expect([...header.subarray(0, 4)]).toEqual([0x7f, 0x45, 0x4c, 0x46]);
expect(header[4]).toBe(2);
expect(header[5]).toBe(1);
expect(header.readUInt16LE(18)).toBe(machine);
if (process.platform !== 'win32') {
expect(statSync(binary).mode & 0o111).not.toBe(0);
}
});
});