From 5da698b4bfd7e8ec45603fb6069b5ce2cbaadecd Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 15 Sep 2020 19:56:46 +0300 Subject: [PATCH] tests: add support for skipping tests in vlib/v/compiler_errors_test.v too --- vlib/v/compiler_errors_test.v | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/vlib/v/compiler_errors_test.v b/vlib/v/compiler_errors_test.v index 3066b3fabe..7a4eb0f07a 100644 --- a/vlib/v/compiler_errors_test.v +++ b/vlib/v/compiler_errors_test.v @@ -7,6 +7,12 @@ import sync import runtime import benchmark +const ( + skip_files = [ + 'nonexisting' + ] +) + struct TaskDescription { vexe string dir string @@ -15,6 +21,7 @@ struct TaskDescription { path string mut: is_error bool + is_skipped bool expected string found___ string took time.Duration @@ -67,7 +74,14 @@ fn (mut tasks []TaskDescription) run() { bench.set_total_expected_steps(tasks.len) mut work := sync.new_channel(tasks.len) mut results := sync.new_channel(tasks.len) + mut m_skip_files := skip_files + $if noskip ? { + m_skip_files = [] + } for i in 0 .. tasks.len { + if tasks[i].path in m_skip_files { + tasks[i].is_skipped = true + } work.push(&tasks[i]) } work.close() @@ -79,6 +93,12 @@ fn (mut tasks []TaskDescription) run() { mut task := TaskDescription{} results.pop(&task) bench.step() + if task.is_skipped { + bench.skip() + eprintln(bench.step_message_with_label_and_duration(benchmark.b_skip, task.path, + task.took)) + continue + } if task.is_error { total_errors++ bench.fail() @@ -121,6 +141,9 @@ fn work_processor(mut work sync.Channel, mut results sync.Channel) { // actual processing; NB: no output is done here at all fn (mut task TaskDescription) execute() { + if task.is_skipped { + return + } program := task.path cli_cmd := '$task.vexe $task.voptions $program' res := os.exec(cli_cmd) or {