1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

test: handle compilation errors when running tests specially in the teamcity runner (#17511)

This commit is contained in:
Petr Makhnev 2023-03-05 12:14:23 +04:00 committed by GitHub
parent 1a48d08d7a
commit c1f249af6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -466,7 +466,15 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
ts.append_message(.cmd_begin, cmd, mtc) ts.append_message(.cmd_begin, cmd, mtc)
d_cmd := time.new_stopwatch() d_cmd := time.new_stopwatch()
mut status := os.system(cmd)
mut res := os.execute(cmd)
if res.exit_code != 0 {
eprintln(res.output)
} else {
println(res.output)
}
mut status := res.exit_code
mut cmd_duration := d_cmd.elapsed() mut cmd_duration := d_cmd.elapsed()
ts.append_message_with_duration(.cmd_end, '', cmd_duration, mtc) ts.append_message_with_duration(.cmd_end, '', cmd_duration, mtc)
@ -498,6 +506,12 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
goto test_passed_system goto test_passed_system
} }
} }
// most probably compiler error
if res.output.contains(': error: ') {
ts.append_message(.cannot_compile, 'Cannot compile file ${file}', mtc)
}
ts.benchmark.fail() ts.benchmark.fail()
tls_bench.fail() tls_bench.fail()
ts.add_failed_cmd(cmd) ts.add_failed_cmd(cmd)

View File

@ -11,6 +11,8 @@ pub enum MessageKind {
skip // the _test.v file was skipped for some reason skip // the _test.v file was skipped for some reason
info // a generic information message, detailing the actions of the `v test` program (some tests could be repeated for example, and the details are sent with an .info status) info // a generic information message, detailing the actions of the `v test` program (some tests could be repeated for example, and the details are sent with an .info status)
// //
cannot_compile // when the _test.v file compiled with errors
//
sentinel // send just once after all executions are done; it signals that the reporting/printing thread should stop the loop and exit sentinel // send just once after all executions are done; it signals that the reporting/printing thread should stop the loop and exit
} }

View File

@ -20,6 +20,9 @@ pub fn (r TeamcityReporter) report(index int, message LogMessage) {
.cmd_end { .cmd_end {
eprintln("##teamcity[testSuiteFinished name='${name}' flowId='${message.flow_id}' duration='${message.took}']") eprintln("##teamcity[testSuiteFinished name='${name}' flowId='${message.flow_id}' duration='${message.took}']")
} }
.cannot_compile {
eprintln("##teamcity[testFailed name='${name}' message='${message.message}']")
}
else {} else {}
} }
} }