Skip to content

Commit 1f1b28b

Browse files
committed
debug(ci): add diagnostic logging for Windows test flakiness
- Log compileState, contestant, task name when traditionalTaskPrepare fails - Log judge() return value and result.size() in judgeIt() - Add waitForFinished() after kill() to fix QProcess destroyed warning - Print checkJudged/result.size/compileState for each contestant+task in test
1 parent ab9289c commit 1f1b28b

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

src/core/taskjudger.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,17 @@ auto TaskJudger::traditionalTaskPrepare() -> bool {
270270

271271
if (! isJudging) {
272272
compilerProcess.kill();
273+
compilerProcess.waitForFinished(3000);
273274
return false;
274275
}
275276
}
276277

277278
if (! flag) {
278279
compilerProcess.kill();
280+
compilerProcess.waitForFinished(3000);
279281
compileState = CompileTimeLimitExceeded;
282+
LOG("traditionalTaskPrepare: compile TIMEOUT for "
283+
<< contestantName.toStdString());
280284
} else if (compilerProcess.exitCode() != 0) {
281285
compileState = CompileError;
282286
compileMessage =
@@ -320,6 +324,9 @@ auto TaskJudger::traditionalTaskPrepare() -> bool {
320324
}
321325

322326
if (compileState != CompileSuccessfully) {
327+
LOG("traditionalTaskPrepare FAILED: compileState=" << static_cast<int>(compileState)
328+
<< " contestant=" << contestant->getContestantName().toStdString()
329+
<< " task=" << task->getProblemTitle().toStdString());
323330
emit compileError(task->getTotalTimeLimit(), static_cast<int>(compileState));
324331
return false;
325332
}
@@ -330,7 +337,13 @@ auto TaskJudger::traditionalTaskPrepare() -> bool {
330337
void TaskJudger::judgeIt() {
331338
qDebug() << "Start Judging";
332339
emit judgingStarted(task->getProblemTitle());
333-
if (judge()) {
340+
int judgeResult = judge();
341+
LOG("judgeIt: contestant=" << contestant->getContestantName().toStdString()
342+
<< " task=" << task->getProblemTitle().toStdString()
343+
<< " judge()=" << judgeResult
344+
<< " compileState=" << static_cast<int>(compileState)
345+
<< " result.size()=" << result.size());
346+
if (judgeResult) {
334347
contestant->setCheckJudged(taskId, true);
335348
contestant->setCompileMessage(taskId, compileMessage);
336349
contestant->setCompileState(taskId, compileState);
@@ -354,8 +367,14 @@ int TaskJudger::judge() {
354367
return 0;
355368

356369
if (task->getTaskType() != Task::AnswersOnly)
357-
if (! traditionalTaskPrepare())
370+
if (! traditionalTaskPrepare()) {
371+
LOG("judge: traditionalTaskPrepare FAILED for contestant="
372+
<< contestant->getContestantName().toStdString()
373+
<< " task=" << task->getProblemTitle().toStdString()
374+
<< " compileState=" << static_cast<int>(compileState)
375+
<< " result.size()=" << result.size());
358376
return 1;
377+
}
359378

360379
for (int i = 0; i < task->getTestCaseList().size(); i++) {
361380
timeUsed.append(QList<int>());

tests/test1/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ class TestContest : public QObject {
249249
QCOMPARE(contestants.size(), 2);
250250
for (const Contestant *c : contestants) {
251251
for (int taskIdx = 0; taskIdx < contest->getTaskList().size(); taskIdx++) {
252+
qDebug() << "DEBUG:" << c->getContestantName()
253+
<< "task" << taskIdx << contest->getTaskList()[taskIdx]->getProblemTitle()
254+
<< "checkJudged=" << c->getCheckJudged(taskIdx)
255+
<< "result.size=" << c->getResult(taskIdx).size()
256+
<< "compileState=" << static_cast<int>(c->getCompileState(taskIdx));
252257
QVERIFY2(c->getCheckJudged(taskIdx),
253258
qPrintable(QString("Contestant '%1' task %2 was not judged")
254259
.arg(c->getContestantName())

0 commit comments

Comments
 (0)