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

ci: make the compiler_errors_test.v output silent in the CI for the OK cases

This commit is contained in:
Delyan Angelov 2021-03-31 12:07:12 +03:00
parent 6f318be96c
commit 024787b01c
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 42 additions and 12 deletions

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by an MIT license // Use of this source code is governed by an MIT license
// that can be found in the LICENSE file. // that can be found in the LICENSE file.
module term module term
// Sources for ANSI Control Sequences // Sources for ANSI Control Sequences
// https://github.com/RajeshPatkarInstitute/Panim // https://github.com/RajeshPatkarInstitute/Panim
// https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html // https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html
@ -61,7 +62,7 @@ pub fn erase_tobeg() {
// clears entire screen and returns cursor to top left-corner // clears entire screen and returns cursor to top left-corner
pub fn erase_clear() { pub fn erase_clear() {
print("\033[H\033[J") print('\033[H\033[J')
} }
pub fn erase_del_clear() { pub fn erase_del_clear() {
@ -97,3 +98,11 @@ pub fn show_cursor() {
pub fn hide_cursor() { pub fn hide_cursor() {
print('\x1b[?25l') print('\x1b[?25l')
} }
// clear_previous_line - useful for progressbars.
// It moves the cursor to start of line, then 1 line above,
// then erases the line. In effect the next println will overwrite
// the previous content.
pub fn clear_previous_line() {
print('\r\x1b[1A\x1b[2K')
}

View File

@ -8,12 +8,12 @@ import runtime
import benchmark import benchmark
const skip_files = [ const skip_files = [
'non_existing.vv' /* minimize commit diff churn, do not remove */, 'non_existing.vv' /* minimize commit diff churn, do not remove */,
] ]
const skip_on_ubuntu_musl = [ const skip_on_ubuntu_musl = [
'vlib/v/checker/tests/vweb_tmpl_used_var.vv', 'vlib/v/checker/tests/vweb_tmpl_used_var.vv',
] ]
const turn_off_vcolors = os.setenv('VCOLORS', 'never', true) const turn_off_vcolors = os.setenv('VCOLORS', 'never', true)
@ -117,14 +117,22 @@ fn test_all() {
parallel_jobs: 1 parallel_jobs: 1
label: 'comptime define tests' label: 'comptime define tests'
} }
ct_tasks.add_checked_run('-d mysymbol run', '.mysymbol.run.out', ['custom_comptime_define_error.vv']) ct_tasks.add_checked_run('-d mysymbol run', '.mysymbol.run.out', [
ct_tasks.add_checked_run('-d mydebug run', '.mydebug.run.out', ['custom_comptime_define_if_flag.vv']) 'custom_comptime_define_error.vv',
ct_tasks.add_checked_run('-d nodebug run', '.nodebug.run.out', ['custom_comptime_define_if_flag.vv']) ])
ct_tasks.add_checked_run('-d mydebug run', '.mydebug.run.out', [
'custom_comptime_define_if_flag.vv',
])
ct_tasks.add_checked_run('-d nodebug run', '.nodebug.run.out', [
'custom_comptime_define_if_flag.vv',
])
ct_tasks.add_checked_run('run', '.run.out', ['custom_comptime_define_if_debug.vv']) ct_tasks.add_checked_run('run', '.run.out', ['custom_comptime_define_if_debug.vv'])
ct_tasks.add_checked_run('-g run', '.g.run.out', ['custom_comptime_define_if_debug.vv']) ct_tasks.add_checked_run('-g run', '.g.run.out', ['custom_comptime_define_if_debug.vv'])
ct_tasks.add_checked_run('-cg run', '.cg.run.out', ['custom_comptime_define_if_debug.vv']) ct_tasks.add_checked_run('-cg run', '.cg.run.out', ['custom_comptime_define_if_debug.vv'])
ct_tasks.add_checked_run('-d debug run', '.debug.run.out', ['custom_comptime_define_if_debug.vv']) ct_tasks.add_checked_run('-d debug run', '.debug.run.out', ['custom_comptime_define_if_debug.vv'])
ct_tasks.add_checked_run('-d debug -d bar run', '.debug.bar.run.out', ['custom_comptime_define_if_debug.vv']) ct_tasks.add_checked_run('-d debug -d bar run', '.debug.bar.run.out', [
'custom_comptime_define_if_debug.vv',
])
ct_tasks.run() ct_tasks.run()
} }
@ -179,10 +187,10 @@ fn (mut tasks Tasks) run() {
} }
$if msvc { $if msvc {
m_skip_files << 'vlib/v/checker/tests/asm_alias_does_not_exist.vv' m_skip_files << 'vlib/v/checker/tests/asm_alias_does_not_exist.vv'
m_skip_files << 'vlib/v/checker/tests/asm_immutable_err.vv' m_skip_files << 'vlib/v/checker/tests/asm_immutable_err.vv'
// TODO: investigate why MSVC regressed // TODO: investigate why MSVC regressed
m_skip_files << 'vlib/v/checker/tests/missing_c_lib_header_1.vv' m_skip_files << 'vlib/v/checker/tests/missing_c_lib_header_1.vv'
m_skip_files << 'vlib/v/checker/tests/missing_c_lib_header_with_explanation_2.vv' m_skip_files << 'vlib/v/checker/tests/missing_c_lib_header_with_explanation_2.vv'
} }
for i in 0 .. tasks.all.len { for i in 0 .. tasks.all.len {
if tasks.all[i].path in m_skip_files { if tasks.all[i].path in m_skip_files {
@ -194,6 +202,10 @@ fn (mut tasks Tasks) run() {
for _ in 0 .. vjobs { for _ in 0 .. vjobs {
go work_processor(mut work, mut results) go work_processor(mut work, mut results)
} }
if github_job == '' {
println('')
}
mut line_can_be_erased := true
mut total_errors := 0 mut total_errors := 0
for _ in 0 .. tasks.all.len { for _ in 0 .. tasks.all.len {
mut task := TaskDescription{} mut task := TaskDescription{}
@ -202,6 +214,7 @@ fn (mut tasks Tasks) run() {
if task.is_skipped { if task.is_skipped {
bench.skip() bench.skip()
eprintln(bstep_message(mut bench, benchmark.b_skip, task.path, task.took)) eprintln(bstep_message(mut bench, benchmark.b_skip, task.path, task.took))
line_can_be_erased = false
continue continue
} }
if task.is_error { if task.is_error {
@ -219,14 +232,22 @@ fn (mut tasks Tasks) run() {
println(task.found___) println(task.found___)
println('============\n') println('============\n')
diff_content(task.expected, task.found___) diff_content(task.expected, task.found___)
line_can_be_erased = false
} else { } else {
bench.ok() bench.ok()
if tasks.show_cmd { if tasks.show_cmd {
eprintln(bstep_message(mut bench, benchmark.b_ok, '$task.cli_cmd $task.path', eprintln(bstep_message(mut bench, benchmark.b_ok, '$task.cli_cmd $task.path',
task.took)) task.took))
} else { } else {
eprintln(bstep_message(mut bench, benchmark.b_ok, task.path, task.took)) if github_job == '' {
// local mode:
if line_can_be_erased {
term.clear_previous_line()
}
println(bstep_message(mut bench, benchmark.b_ok, task.path, task.took))
}
} }
line_can_be_erased = true
} }
} }
bench.stop() bench.stop()