mirror of
https://github.com/vlang/v.git
synced 2025-08-05 18:57:45 -04:00
tools: add support for // vtest vflags: -w
in _test.v
files, to allow v -W test .
later, for files, that have known warnings
This commit is contained in:
parent
e6a1983325
commit
91a3844ad5
@ -450,6 +450,11 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
|
|||||||
} else {
|
} else {
|
||||||
fname_without_extension
|
fname_without_extension
|
||||||
}
|
}
|
||||||
|
mut details := get_test_details(file)
|
||||||
|
if details.vflags != '' && !is_fmt {
|
||||||
|
cmd_options << details.vflags
|
||||||
|
}
|
||||||
|
|
||||||
reproduce_options := cmd_options.clone()
|
reproduce_options := cmd_options.clone()
|
||||||
generated_binary_fpath := os.join_path_single(test_folder_path, generated_binary_fname)
|
generated_binary_fpath := os.join_path_single(test_folder_path, generated_binary_fname)
|
||||||
if produces_file_output {
|
if produces_file_output {
|
||||||
@ -475,7 +480,6 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
|
|||||||
} else {
|
} else {
|
||||||
os.quoted_path(generated_binary_fpath)
|
os.quoted_path(generated_binary_fpath)
|
||||||
}
|
}
|
||||||
mut details := get_test_details(file)
|
|
||||||
mut should_be_built := true
|
mut should_be_built := true
|
||||||
if details.vbuild != '' {
|
if details.vbuild != '' {
|
||||||
should_be_built = ts.build_environment.eval(details.vbuild) or {
|
should_be_built = ts.build_environment.eval(details.vbuild) or {
|
||||||
@ -817,6 +821,7 @@ pub mut:
|
|||||||
hide_retries bool // when true, all retry tries are silent; used by `vlib/v/tests/retry_test.v`
|
hide_retries bool // when true, all retry tries are silent; used by `vlib/v/tests/retry_test.v`
|
||||||
vbuild string // could be `!(windows && tinyc)`
|
vbuild string // could be `!(windows && tinyc)`
|
||||||
vbuild_line int // for more precise error reporting, if the `vbuild` expression is incorrect
|
vbuild_line int // for more precise error reporting, if the `vbuild` expression is incorrect
|
||||||
|
vflags string // custom compilation flags for the test (enables for example: `// vtest vflags: -w`, for tests that have known warnings, but should still pass with -W)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_test_details(file string) TestDetails {
|
pub fn get_test_details(file string) TestDetails {
|
||||||
@ -836,6 +841,9 @@ pub fn get_test_details(file string) TestDetails {
|
|||||||
res.vbuild = line.all_after(':').trim_space()
|
res.vbuild = line.all_after(':').trim_space()
|
||||||
res.vbuild_line = idx + 1
|
res.vbuild_line = idx + 1
|
||||||
}
|
}
|
||||||
|
if line.starts_with('// vtest vflags:') {
|
||||||
|
res.vflags = line.all_after(':').trim_space()
|
||||||
|
}
|
||||||
if line.starts_with('// vtest hide_retries') {
|
if line.starts_with('// vtest hide_retries') {
|
||||||
res.hide_retries = true
|
res.hide_retries = true
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// vtest vflags: -w
|
||||||
module main
|
module main
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
@ -797,12 +797,14 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
|
|||||||
}
|
}
|
||||||
'-w' {
|
'-w' {
|
||||||
res.skip_warnings = true
|
res.skip_warnings = true
|
||||||
|
res.warns_are_errors = false
|
||||||
}
|
}
|
||||||
'-N' {
|
'-N' {
|
||||||
res.notes_are_errors = true
|
res.notes_are_errors = true
|
||||||
}
|
}
|
||||||
'-n' {
|
'-n' {
|
||||||
res.skip_notes = true
|
res.skip_notes = true
|
||||||
|
res.notes_are_errors = false
|
||||||
}
|
}
|
||||||
'-no-rsp' {
|
'-no-rsp' {
|
||||||
res.no_rsp = true
|
res.no_rsp = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user