Files
bare-operating-system/packages/bare-os-coreutils/test/getconf-posix-shm.test.mjs
T
Raven Scott 4af98ef97b feat(booter): harden guest vs user isolation and POSIX/P2P parity
- Guest-safe legacy personal-root migration with state file and env gates
- VFS guest deny for sensitive /.bare paths; warm-cache clear on identity switch
- Optional acct/<hash>/ personal layout, guest scrub, vault exclude alignment
- Shell session reset + errexit; fish history reload hook; replication metric
- Audit NDJSON for migration/scrub; structured booter logging paths
- Bump POSIX profile; getconf keys; syscall/socket contract + handbook/docs pass
- Booter tests (Bare vs Node split for identity-session); release-checklist audit hook
2026-04-05 03:16:33 -04:00

70 lines
1.7 KiB
JavaScript

/**
* Static getconf entries for POSIX-ish shared memory / IPC hints.
*/
import { readFile } from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import test from 'brittle'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor
async function loadBin(name) {
const runtime = await readFile(
path.join(__dirname, '../lib/runtime.js'),
'utf8'
)
const body = await readFile(
path.join(__dirname, `../src/${name}.js`),
'utf8'
)
return new AsyncFunction(
'ctx',
'argv',
`${runtime}\n${body}\nif (typeof run === 'function') return await run(ctx, argv)\n`
)
}
test('getconf _POSIX_SHARED_MEMORY_OBJECTS is 1', async (t) => {
const run = await loadBin('getconf')
const lines = []
const ctx = {
console: { log: (m) => lines.push(String(m)) },
exitCode: 0
}
await run(ctx, ['getconf', '_POSIX_SHARED_MEMORY_OBJECTS'])
t.is(ctx.exitCode, 0)
t.is(lines[0], '1')
})
test('getconf BARE_OS_GUEST_SENSITIVE_BARE_DENY catalog entry', async (t) => {
const run = await loadBin('getconf')
const lines = []
const ctx = {
vfs: { env: {} },
console: {
log(s) {
lines.push(String(s))
},
error() {}
},
exitCode: 0,
b4a: await import('b4a')
}
await run(ctx, ['getconf', 'BARE_OS_GUEST_SENSITIVE_BARE_DENY'])
t.is(lines.join('\n').trim(), '1')
})
test('getconf _SC_PAGESIZE static table', async (t) => {
const run = await loadBin('getconf')
const lines = []
const ctx = {
console: { log: (m) => lines.push(String(m)) },
exitCode: 0
}
await run(ctx, ['getconf', '_SC_PAGESIZE'])
t.is(ctx.exitCode, 0)
t.is(lines[0], '4096')
})