mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: fix analysis default value fallback
This commit is contained in:
1 parent
0e20de9200
commit
ab788b3d79
4 files changed
+12
-10
No files matched your search
@@ -206,12 +206,12 @@ export default async function readCases(folder: string, cfg: Record<string, any>
|
||||
const ymlConfig = path.resolve(folder, 'config.yml');
|
||||
let config;
|
||||
if (fs.existsSync(yamlConfig)) {
|
||||
config = { ...yaml.load(fs.readFileSync(yamlConfig).toString()) as object, ...cfg };
|
||||
config = { ...cfg, ...yaml.load(fs.readFileSync(yamlConfig).toString()) as object };
|
||||
} else if (fs.existsSync(ymlConfig)) {
|
||||
config = { ...yaml.load(fs.readFileSync(ymlConfig).toString()) as object, ...cfg };
|
||||
config = { ...cfg, ...yaml.load(fs.readFileSync(ymlConfig).toString()) as object };
|
||||
} else if (fs.existsSync(iniConfig)) {
|
||||
try {
|
||||
config = { ...convertIniConfig(fs.readFileSync(iniConfig).toString()), ...cfg };
|
||||
config = { ...cfg, ...convertIniConfig(fs.readFileSync(iniConfig).toString()) };
|
||||
} catch (e) {
|
||||
throw changeErrorType(e, FormatError);
|
||||
}
|
||||
|
||||
@@ -91,16 +91,17 @@ function judgeCase(c: Case, sid: string) {
|
||||
await runner(ctx, ctxSubtask);
|
||||
return;
|
||||
}
|
||||
if ([STATUS.STATUS_WRONG_ANSWER, STATUS.STATUS_RUNTIME_ERROR].includes(status)) {
|
||||
if ([STATUS.STATUS_WRONG_ANSWER, STATUS.STATUS_RUNTIME_ERROR].includes(status) && ctx.config.detail) {
|
||||
const langConfig = ctx.getLang(ctx.lang);
|
||||
if (langConfig.analysis && !ctx.analysis) {
|
||||
ctx.analysis = true;
|
||||
run(langConfig.analysis, {
|
||||
copyIn: {
|
||||
input: { src: stdin },
|
||||
...copyIn,
|
||||
input: stdin ? { src: stdin } : { content: '' },
|
||||
[langConfig.code_file || 'foo']: { content: ctx.code },
|
||||
compile: { content: langConfig.compile },
|
||||
execute: { content: langConfig.execute },
|
||||
compile: { content: langConfig.compile || '' },
|
||||
execute: { content: langConfig.execute || '' },
|
||||
},
|
||||
time: 5000,
|
||||
memory: 256,
|
||||
|
||||
@@ -86,10 +86,11 @@ export const judge = async (ctx: Context) => {
|
||||
ctx.analysis = true;
|
||||
run(langConfig.analysis, {
|
||||
copyIn: {
|
||||
...copyIn,
|
||||
input: { src: stdin },
|
||||
[langConfig.code_file || 'foo']: { content: ctx.code },
|
||||
compile: { content: langConfig.compile },
|
||||
execute: { content: langConfig.execute },
|
||||
compile: { content: langConfig.compile || '' },
|
||||
execute: { content: langConfig.execute || '' },
|
||||
},
|
||||
env: {
|
||||
...ctx.env,
|
||||
|
||||
Reference in new issue
Block a user