mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
AppImage.yml wraps the musl bundles too, whose Node.js needs no glibc libraries; tests/nodeRuntimeDependency.test.cjs still requires node-runtime/libatomic.so.1 for every glibc bundle. Thanks to xet7 !
44 lines
2.5 KiB
JavaScript
44 lines
2.5 KiB
JavaScript
const { test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const { spawnSync } = require('node:child_process');
|
|
const read = file => fs.readFileSync(file, 'utf8');
|
|
|
|
test('runtime bundler rejects foreign architectures and preserves licensing', () => {
|
|
const result = spawnSync('python3', ['-B', 'tests/bundle-node-runtime.py'], { encoding: 'utf8' });
|
|
assert.equal(result.status, 0, result.stdout + result.stderr);
|
|
});
|
|
test('Docker keeps libatomic outside the removable build dependencies', () => {
|
|
const docker = read('Dockerfile');
|
|
assert.match(docker, /apt-get install[^\n]*file libatomic1/);
|
|
// There is no removable build-dependency list any more (nothing in the image
|
|
// is compiled); what must hold is that nothing purges it again.
|
|
assert.doesNotMatch(docker, /apt-get (?:remove|purge)[^\n]*libatomic1/);
|
|
assert.doesNotMatch((docker.match(/ENV BUILD_DEPS="[^"]*"/) || [''])[0], /libatomic1/);
|
|
});
|
|
test('native and emulated Linux bundles both package their own runtime', () => {
|
|
assert.match(read('releases/embed-verified-node.sh'), /python3 "\$here\/bundle-node-runtime.py" "\$dest" \|\| exit 1/);
|
|
const emulated = read('releases/install-node-for-arch.sh');
|
|
assert.match(emulated, /apt-install.sh[^\n]*libatomic1/);
|
|
assert.match(emulated, /bundle-node-runtime.py" \/bundle\/node/);
|
|
const launch = read('releases/ferretdb/start-wekan.sh');
|
|
assert.match(launch, /export LD_LIBRARY_PATH="\$DIR\/node-runtime\$\{LD_LIBRARY_PATH:\+:\$LD_LIBRARY_PATH\}"/);
|
|
});
|
|
test('AppImage and Flatpak require the bundled library and preserve the bundle', () => {
|
|
for (const name of ['AppImage', 'Flatpak']) {
|
|
const workflow = read(`.github/workflows/${name}.yml`);
|
|
// AppImage also wraps the musl bundles, whose Node.js needs no glibc
|
|
// libraries; every glibc bundle must still carry node-runtime.
|
|
assert.match(workflow, name === 'AppImage'
|
|
? /\[ '\$\{\{ matrix\.musl \}\}' = true \] \|\| required="\$required bundle\/node-runtime\/libatomic\.so\.1"\n\s+for f in \$required/
|
|
: /for f in [^\n]*bundle\/node-runtime\/libatomic.so.1/);
|
|
assert.match(workflow, /cp -a bundle /);
|
|
}
|
|
});
|
|
test('Sandstorm includes and checks libatomic in its private library tree', () => {
|
|
const source = read('sandstorm-src/build-deps.sh');
|
|
assert.match(source, /libz.so.1 libatomic.so.1; do/);
|
|
assert.match(source, /\[ -f "\$DEPS\/lib\/x86_64-linux-gnu\/libatomic.so.1" \] \|\|/);
|
|
assert.match(source, /cp -L \/usr\/share\/doc\/libatomic1\/copyright/);
|
|
});
|