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.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 (
|
||||
skip_compile_files = [
|
||||
'vlib/v/tests/valgrind/option_reassigned.v',
|
||||
]
|
||||
skip_valgrind_files = [
|
||||
'vlib/v/tests/valgrind/struct_field.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/option_simple.v',
|
||||
]
|
||||
)
|
||||
|
||||
@ -50,14 +64,8 @@ fn test_all() {
|
||||
bench.set_total_expected_steps(tests.len)
|
||||
for test in tests {
|
||||
bench.step()
|
||||
if !test.contains('1.') {
|
||||
bench.skip()
|
||||
eprintln(bench.step_message_skip(test))
|
||||
continue
|
||||
}
|
||||
//
|
||||
if test in skip_valgrind_files {
|
||||
$if !noskip ? {
|
||||
if test in skip_compile_files {
|
||||
$if !noskipcompile ? {
|
||||
bench.skip()
|
||||
eprintln(bench.step_message_skip(test))
|
||||
continue
|
||||
@ -79,6 +87,13 @@ fn test_all() {
|
||||
eprintln(res.output)
|
||||
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'
|
||||
vprintln('valgrind cmd: ${util.bold(valgrind_cmd)}')
|
||||
valgrind_res := os.exec(valgrind_cmd) or {
|
||||
|
Loading…
Reference in New Issue
Block a user