tests: support `VTEST_ONLY=fn_,match_ ./v test-fixed` and in compiler_test.v
parent
ce31c4c03e
commit
73a259496e
|
@ -69,7 +69,7 @@ pub fn (mut ts TestSession) test() {
|
||||||
//
|
//
|
||||||
ts.init()
|
ts.init()
|
||||||
mut remaining_files := []string{}
|
mut remaining_files := []string{}
|
||||||
vtest_only := os.getenv('VTEST_ONLY')
|
vtest_only := os.getenv('VTEST_ONLY').split(',')
|
||||||
for dot_relative_file in ts.files {
|
for dot_relative_file in ts.files {
|
||||||
relative_file := dot_relative_file.replace('./', '')
|
relative_file := dot_relative_file.replace('./', '')
|
||||||
file := os.real_path(relative_file)
|
file := os.real_path(relative_file)
|
||||||
|
@ -94,7 +94,14 @@ pub fn (mut ts TestSession) test() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if vtest_only.len > 0 {
|
if vtest_only.len > 0 {
|
||||||
if !file.contains(vtest_only) {
|
mut found := 0
|
||||||
|
for substring in vtest_only {
|
||||||
|
if file.contains(substring) {
|
||||||
|
found++
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if found == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,13 +33,20 @@ fn get_tests_in_dir(dir string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_path(vexe, dir, voptions, result_extension string, tests []string) int {
|
fn check_path(vexe, dir, voptions, result_extension string, tests []string) int {
|
||||||
vtest_only := os.getenv('VTEST_ONLY')
|
vtest_only := os.getenv('VTEST_ONLY').split(',')
|
||||||
mut nb_fail := 0
|
mut nb_fail := 0
|
||||||
mut paths := []string{}
|
mut paths := []string{}
|
||||||
for test in tests {
|
for test in tests {
|
||||||
path := os.join_path(dir, test).replace('\\', '/')
|
path := os.join_path(dir, test).replace('\\', '/')
|
||||||
if vtest_only.len > 0 {
|
if vtest_only.len > 0 {
|
||||||
if !path.contains(vtest_only) {
|
mut found := 0
|
||||||
|
for substring in vtest_only {
|
||||||
|
if path.contains(substring) {
|
||||||
|
found++
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if found == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,25 @@ fn test_all() {
|
||||||
println('no compiler tests found')
|
println('no compiler tests found')
|
||||||
assert false
|
assert false
|
||||||
}
|
}
|
||||||
|
vtest_only := os.getenv('VTEST_ONLY').split(',')
|
||||||
|
mut paths := []string{}
|
||||||
for test in tests {
|
for test in tests {
|
||||||
path := os.join_path(dir, test).replace('\\', '/')
|
path := os.join_path(dir, test).replace('\\', '/')
|
||||||
|
if vtest_only.len > 0 {
|
||||||
|
mut found := 0
|
||||||
|
for substring in vtest_only {
|
||||||
|
if path.contains(substring) {
|
||||||
|
found++
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if found == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
paths << path
|
||||||
|
}
|
||||||
|
for path in paths {
|
||||||
print(path + ' ')
|
print(path + ' ')
|
||||||
program := path.replace('.vv', '.v')
|
program := path.replace('.vv', '.v')
|
||||||
os.cp(path, program) or {
|
os.cp(path, program) or {
|
||||||
|
|
Loading…
Reference in New Issue