tools: add SKIP_TESTS env variable support for parser_speed.v and scanner_speed.v

This commit is contained in:
Delyan Angelov 2023-08-18 09:19:27 +03:00
parent 68d962f6b3
commit 56644b2b52
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,8 @@ import v.parser
import v.errors import v.errors
import v.scanner import v.scanner
const skip_tests = os.getenv_opt('SKIP_TESTS') or { '' }.bool()
fn main() { fn main() {
files := os.args#[1..] files := os.args#[1..]
if files.len > 0 && files[0].starts_with('@') { if files.len > 0 && files[0].starts_with('@') {
@ -31,7 +33,7 @@ fn process_files(files []string) ! {
if f == '' { if f == '' {
continue continue
} }
if f.ends_with('_test.v') { if skip_tests && f.ends_with('_test.v') {
continue continue
} }
// do not measure the scanning, but only the parsing: // do not measure the scanning, but only the parsing:

View File

@ -3,6 +3,8 @@ import time
import v.scanner import v.scanner
import v.pref import v.pref
const skip_tests = os.getenv_opt('SKIP_TESTS') or { '' }.bool()
fn main() { fn main() {
files := os.args#[1..] files := os.args#[1..]
if files.len > 0 && files[0].starts_with('@') { if files.len > 0 && files[0].starts_with('@') {
@ -27,7 +29,7 @@ fn process_files(files []string) ! {
if f == '' { if f == '' {
continue continue
} }
if f.ends_with('_test.v') { if skip_tests && f.ends_with('_test.v') {
continue continue
} }
sw.restart() sw.restart()