mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
autofree: add option_reassigned.v and option_simple.v tests.
This commit is contained in:
parent
bffa100aa6
commit
bbf4983524
9
vlib/v/tests/valgrind/option_reassigned.v
Normal file
9
vlib/v/tests/valgrind/option_reassigned.v
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
mut a := 'abc'
|
||||||
|
a = os.find_abs_path_of_executable('ls') or {
|
||||||
|
''
|
||||||
|
}
|
||||||
|
eprintln(a)
|
||||||
|
}
|
8
vlib/v/tests/valgrind/option_simple.v
Normal file
8
vlib/v/tests/valgrind/option_simple.v
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
a := os.find_abs_path_of_executable('ls') or {
|
||||||
|
''
|
||||||
|
}
|
||||||
|
eprintln(a)
|
||||||
|
}
|
@ -4,11 +4,25 @@ import benchmark
|
|||||||
import v.util
|
import v.util
|
||||||
import v.util.vtest
|
import v.util.vtest
|
||||||
|
|
||||||
|
//
|
||||||
|
// NB: skip_compile_files can be used for totally skipping .v files temporarily.
|
||||||
|
// .v files in skip_valgrind_files will be compiled, but will not be run under
|
||||||
|
// valgrind. This ensures that at least the generated code does not have C syntax
|
||||||
|
// errors.
|
||||||
|
// Use: `./v -d noskipcompile vlib/v/tests/valgrind/valgrind_test.v` to ignore the
|
||||||
|
// skip_compile_files list.
|
||||||
|
// Use: `./v -d noskip vlib/v/tests/valgrind/valgrind_test.v` to ignore skip_valgrind_files
|
||||||
|
// Use: `./v -d noskipcompile -d noskip vlib/v/tests/valgrind/valgrind_test.v` to ignore both
|
||||||
|
//
|
||||||
const (
|
const (
|
||||||
|
skip_compile_files = [
|
||||||
|
'vlib/v/tests/valgrind/option_reassigned.v',
|
||||||
|
]
|
||||||
skip_valgrind_files = [
|
skip_valgrind_files = [
|
||||||
'vlib/v/tests/valgrind/struct_field.v',
|
'vlib/v/tests/valgrind/struct_field.v',
|
||||||
'vlib/v/tests/valgrind/fn_returning_string_param.v',
|
'vlib/v/tests/valgrind/fn_returning_string_param.v',
|
||||||
'vlib/v/tests/valgrind/fn_with_return_should_free_local_vars.v',
|
'vlib/v/tests/valgrind/fn_with_return_should_free_local_vars.v',
|
||||||
|
'vlib/v/tests/valgrind/option_simple.v',
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,14 +64,8 @@ fn test_all() {
|
|||||||
bench.set_total_expected_steps(tests.len)
|
bench.set_total_expected_steps(tests.len)
|
||||||
for test in tests {
|
for test in tests {
|
||||||
bench.step()
|
bench.step()
|
||||||
if !test.contains('1.') {
|
if test in skip_compile_files {
|
||||||
bench.skip()
|
$if !noskipcompile ? {
|
||||||
eprintln(bench.step_message_skip(test))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if test in skip_valgrind_files {
|
|
||||||
$if !noskip ? {
|
|
||||||
bench.skip()
|
bench.skip()
|
||||||
eprintln(bench.step_message_skip(test))
|
eprintln(bench.step_message_skip(test))
|
||||||
continue
|
continue
|
||||||
@ -79,6 +87,13 @@ fn test_all() {
|
|||||||
eprintln(res.output)
|
eprintln(res.output)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if test in skip_valgrind_files {
|
||||||
|
$if !noskip ? {
|
||||||
|
bench.skip()
|
||||||
|
eprintln(bench.step_message_skip(test))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
valgrind_cmd := 'valgrind --error-exitcode=1 --leak-check=full $exe_filename'
|
valgrind_cmd := 'valgrind --error-exitcode=1 --leak-check=full $exe_filename'
|
||||||
vprintln('valgrind cmd: ${util.bold(valgrind_cmd)}')
|
vprintln('valgrind cmd: ${util.bold(valgrind_cmd)}')
|
||||||
valgrind_res := os.exec(valgrind_cmd) or {
|
valgrind_res := os.exec(valgrind_cmd) or {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user