Skip to content

Commit 024787b

Browse files
committed
ci: make the compiler_errors_test.v output silent in the CI for the OK cases
1 parent 6f318be commit 024787b

File tree

2 files changed

+42
-12
lines changed

2 files changed

+42
-12
lines changed

vlib/term/control.v

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by an MIT license
33
// that can be found in the LICENSE file.
44
module term
5+
56
// Sources for ANSI Control Sequences
67
// https://github.com/RajeshPatkarInstitute/Panim
78
// https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html
@@ -61,7 +62,7 @@ pub fn erase_tobeg() {
6162

6263
// clears entire screen and returns cursor to top left-corner
6364
pub fn erase_clear() {
64-
print("\033[H\033[J")
65+
print('\033[H\033[J')
6566
}
6667

6768
pub fn erase_del_clear() {
@@ -97,3 +98,11 @@ pub fn show_cursor() {
9798
pub fn hide_cursor() {
9899
print('\x1b[?25l')
99100
}
101+
102+
// clear_previous_line - useful for progressbars.
103+
// It moves the cursor to start of line, then 1 line above,
104+
// then erases the line. In effect the next println will overwrite
105+
// the previous content.
106+
pub fn clear_previous_line() {
107+
print('\r\x1b[1A\x1b[2K')
108+
}

vlib/v/compiler_errors_test.v

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import runtime
88
import benchmark
99

1010
const skip_files = [
11-
'non_existing.vv' /* minimize commit diff churn, do not remove */,
12-
]
11+
'non_existing.vv' /* minimize commit diff churn, do not remove */,
12+
]
1313

1414
const skip_on_ubuntu_musl = [
15-
'vlib/v/checker/tests/vweb_tmpl_used_var.vv',
16-
]
15+
'vlib/v/checker/tests/vweb_tmpl_used_var.vv',
16+
]
1717

1818
const turn_off_vcolors = os.setenv('VCOLORS', 'never', true)
1919

@@ -117,14 +117,22 @@ fn test_all() {
117117
parallel_jobs: 1
118118
label: 'comptime define tests'
119119
}
120-
ct_tasks.add_checked_run('-d mysymbol run', '.mysymbol.run.out', ['custom_comptime_define_error.vv'])
121-
ct_tasks.add_checked_run('-d mydebug run', '.mydebug.run.out', ['custom_comptime_define_if_flag.vv'])
122-
ct_tasks.add_checked_run('-d nodebug run', '.nodebug.run.out', ['custom_comptime_define_if_flag.vv'])
120+
ct_tasks.add_checked_run('-d mysymbol run', '.mysymbol.run.out', [
121+
'custom_comptime_define_error.vv',
122+
])
123+
ct_tasks.add_checked_run('-d mydebug run', '.mydebug.run.out', [
124+
'custom_comptime_define_if_flag.vv',
125+
])
126+
ct_tasks.add_checked_run('-d nodebug run', '.nodebug.run.out', [
127+
'custom_comptime_define_if_flag.vv',
128+
])
123129
ct_tasks.add_checked_run('run', '.run.out', ['custom_comptime_define_if_debug.vv'])
124130
ct_tasks.add_checked_run('-g run', '.g.run.out', ['custom_comptime_define_if_debug.vv'])
125131
ct_tasks.add_checked_run('-cg run', '.cg.run.out', ['custom_comptime_define_if_debug.vv'])
126132
ct_tasks.add_checked_run('-d debug run', '.debug.run.out', ['custom_comptime_define_if_debug.vv'])
127-
ct_tasks.add_checked_run('-d debug -d bar run', '.debug.bar.run.out', ['custom_comptime_define_if_debug.vv'])
133+
ct_tasks.add_checked_run('-d debug -d bar run', '.debug.bar.run.out', [
134+
'custom_comptime_define_if_debug.vv',
135+
])
128136
ct_tasks.run()
129137
}
130138

@@ -179,10 +187,10 @@ fn (mut tasks Tasks) run() {
179187
}
180188
$if msvc {
181189
m_skip_files << 'vlib/v/checker/tests/asm_alias_does_not_exist.vv'
182-
m_skip_files << 'vlib/v/checker/tests/asm_immutable_err.vv'
190+
m_skip_files << 'vlib/v/checker/tests/asm_immutable_err.vv'
183191
// TODO: investigate why MSVC regressed
184192
m_skip_files << 'vlib/v/checker/tests/missing_c_lib_header_1.vv'
185-
m_skip_files << 'vlib/v/checker/tests/missing_c_lib_header_with_explanation_2.vv'
193+
m_skip_files << 'vlib/v/checker/tests/missing_c_lib_header_with_explanation_2.vv'
186194
}
187195
for i in 0 .. tasks.all.len {
188196
if tasks.all[i].path in m_skip_files {
@@ -194,6 +202,10 @@ fn (mut tasks Tasks) run() {
194202
for _ in 0 .. vjobs {
195203
go work_processor(mut work, mut results)
196204
}
205+
if github_job == '' {
206+
println('')
207+
}
208+
mut line_can_be_erased := true
197209
mut total_errors := 0
198210
for _ in 0 .. tasks.all.len {
199211
mut task := TaskDescription{}
@@ -202,6 +214,7 @@ fn (mut tasks Tasks) run() {
202214
if task.is_skipped {
203215
bench.skip()
204216
eprintln(bstep_message(mut bench, benchmark.b_skip, task.path, task.took))
217+
line_can_be_erased = false
205218
continue
206219
}
207220
if task.is_error {
@@ -219,14 +232,22 @@ fn (mut tasks Tasks) run() {
219232
println(task.found___)
220233
println('============\n')
221234
diff_content(task.expected, task.found___)
235+
line_can_be_erased = false
222236
} else {
223237
bench.ok()
224238
if tasks.show_cmd {
225239
eprintln(bstep_message(mut bench, benchmark.b_ok, '$task.cli_cmd $task.path',
226240
task.took))
227241
} else {
228-
eprintln(bstep_message(mut bench, benchmark.b_ok, task.path, task.took))
242+
if github_job == '' {
243+
// local mode:
244+
if line_can_be_erased {
245+
term.clear_previous_line()
246+
}
247+
println(bstep_message(mut bench, benchmark.b_ok, task.path, task.took))
248+
}
229249
}
250+
line_can_be_erased = true
230251
}
231252
}
232253
bench.stop()

0 commit comments

Comments
 (0)