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

tests: add support for skipping tests in vlib/v/compiler_errors_test.v too

This commit is contained in:
Delyan Angelov 2020-09-15 19:56:46 +03:00
parent 8b25c29323
commit 5da698b4bf

View File

@ -7,6 +7,12 @@ import sync
import runtime import runtime
import benchmark import benchmark
const (
skip_files = [
'nonexisting'
]
)
struct TaskDescription { struct TaskDescription {
vexe string vexe string
dir string dir string
@ -15,6 +21,7 @@ struct TaskDescription {
path string path string
mut: mut:
is_error bool is_error bool
is_skipped bool
expected string expected string
found___ string found___ string
took time.Duration took time.Duration
@ -67,7 +74,14 @@ fn (mut tasks []TaskDescription) run() {
bench.set_total_expected_steps(tasks.len) bench.set_total_expected_steps(tasks.len)
mut work := sync.new_channel<TaskDescription>(tasks.len) mut work := sync.new_channel<TaskDescription>(tasks.len)
mut results := sync.new_channel<TaskDescription>(tasks.len) mut results := sync.new_channel<TaskDescription>(tasks.len)
mut m_skip_files := skip_files
$if noskip ? {
m_skip_files = []
}
for i in 0 .. tasks.len { for i in 0 .. tasks.len {
if tasks[i].path in m_skip_files {
tasks[i].is_skipped = true
}
work.push(&tasks[i]) work.push(&tasks[i])
} }
work.close() work.close()
@ -79,6 +93,12 @@ fn (mut tasks []TaskDescription) run() {
mut task := TaskDescription{} mut task := TaskDescription{}
results.pop(&task) results.pop(&task)
bench.step() 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 { if task.is_error {
total_errors++ total_errors++
bench.fail() 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 // actual processing; NB: no output is done here at all
fn (mut task TaskDescription) execute() { fn (mut task TaskDescription) execute() {
if task.is_skipped {
return
}
program := task.path program := task.path
cli_cmd := '$task.vexe $task.voptions $program' cli_cmd := '$task.vexe $task.voptions $program'
res := os.exec(cli_cmd) or { res := os.exec(cli_cmd) or {