judge: add stack size report

This commit is contained in:
undefined committed 2025-02-05 07:43:14 +08:00
1 parent 175f5fe987
commit e81823b589
4 files changed
+50 -18

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import { LangConfig } from '@hydrooj/utils/lib/lang';
import { runQueued } from './sandbox';
export async function compilerVersions(langs: Record<string, LangConfig>) {
const result = {};
for (const lang in langs) {
const version = langs[lang].version;
if (!version) continue;
// eslint-disable-next-line no-await-in-loop
const res = await runQueued(version, {
copyIn: {},
time: 10000,
memory: 256,
}, 'compilerVersions', 5);
result[lang] = `${res.stdout}\n${res.stderr}`.trim();
}
return result;
}
export async function stackSize() {
const res = await runQueued('/bin/bash -c "ulimit -s"', {
copyIn: {},
time: 10000,
memory: 256,
}, 'stackSize', 5);
if (res.stderr) return -1;
return +res.stdout;
}