Skip to content

Commit 0091370

Browse files
committed
not_ok_is_cf mode supported
1 parent b306f3c commit 0091370

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

bin/ej-compile.c

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
/*
1818
* This program compiles incoming source files and puts the resulting
1919
* executables into the spool directory.
20-
*
21-
* Note: this program must compile and work on win32
2220
*/
2321

2422
#include "ejudge/config.h"
@@ -185,8 +183,14 @@ invoke_style_checker(
185183
if (!r) {
186184
retval = RUN_OK;
187185
} else {
188-
retval = RUN_STYLE_ERR;
189-
fprintf(log_f, "\nStyle checker detected errors\n");
186+
if (req->not_ok_is_cf > 0) {
187+
retval = RUN_CHECK_FAILED;
188+
fprintf(log_f, "\nStyle checker detected errors\n");
189+
fprintf(log_f, "Check failed on non-OK result mode enabled\n");
190+
} else {
191+
retval = RUN_STYLE_ERR;
192+
fprintf(log_f, "\nStyle checker detected errors\n");
193+
}
190194
}
191195

192196
cleanup:
@@ -303,13 +307,25 @@ invoke_compiler(
303307

304308
if (task_IsTimeout(tsk)) {
305309
err("Compilation process timed out");
306-
fprintf(log_f, "\nCompilation process timed out\n");
307310
task_Delete(tsk);
308-
return RUN_COMPILE_ERR;
311+
if (req->not_ok_is_cf > 0) {
312+
fprintf(log_f, "\nCompilation process timed out\n");
313+
fprintf(log_f, "Check failed on non-OK result mode enabled\n");
314+
return RUN_CHECK_FAILED;
315+
} else {
316+
fprintf(log_f, "\nCompilation process timed out\n");
317+
return RUN_COMPILE_ERR;
318+
}
309319
} else if (task_IsAbnormal(tsk)) {
310320
info("Compilation failed");
311321
task_Delete(tsk);
312-
return RUN_COMPILE_ERR;
322+
if (req->not_ok_is_cf > 0) {
323+
fprintf(log_f, "\nCompilation failed\n");
324+
fprintf(log_f, "Check failed on non-OK result mode enabled\n");
325+
return RUN_CHECK_FAILED;
326+
} else {
327+
return RUN_COMPILE_ERR;
328+
}
313329
} else {
314330
info("Compilation sucessful");
315331
task_Delete(tsk);

0 commit comments

Comments
 (0)