tooling: use term.header for tests
parent
9d8116f895
commit
4bb5d7de8b
|
@ -80,17 +80,17 @@ pub fn (ts mut TestSession) test() {
|
||||||
ts.files = remaining_files
|
ts.files = remaining_files
|
||||||
ts.benchmark.set_total_expected_steps(remaining_files.len)
|
ts.benchmark.set_total_expected_steps(remaining_files.len)
|
||||||
|
|
||||||
mut ncpus := runtime.nr_cpus()
|
mut njobs := runtime.nr_jobs()
|
||||||
$if msvc {
|
$if msvc {
|
||||||
// NB: MSVC can not be launched in parallel, without giving it
|
// NB: MSVC can not be launched in parallel, without giving it
|
||||||
// the option /FS because it uses a shared PDB file, which should
|
// the option /FS because it uses a shared PDB file, which should
|
||||||
// be locked, but that makes writing slower...
|
// be locked, but that makes writing slower...
|
||||||
// See: https://docs.microsoft.com/en-us/cpp/build/reference/fs-force-synchronous-pdb-writes?view=vs-2019
|
// See: https://docs.microsoft.com/en-us/cpp/build/reference/fs-force-synchronous-pdb-writes?view=vs-2019
|
||||||
// Instead, just run tests on 1 core for now.
|
// Instead, just run tests on 1 core for now.
|
||||||
ncpus = 1
|
njobs = 1
|
||||||
}
|
}
|
||||||
ts.waitgroup.add( ncpus )
|
ts.waitgroup.add( njobs )
|
||||||
for i:=0; i < ncpus; i++ {
|
for i:=0; i < njobs; i++ {
|
||||||
go process_in_thread(ts)
|
go process_in_thread(ts)
|
||||||
}
|
}
|
||||||
ts.waitgroup.wait()
|
ts.waitgroup.wait()
|
||||||
|
@ -140,7 +140,7 @@ fn (ts mut TestSession) process_files() {
|
||||||
ts.benchmark.step()
|
ts.benchmark.step()
|
||||||
tls_bench.step()
|
tls_bench.step()
|
||||||
if show_stats {
|
if show_stats {
|
||||||
eprintln('-------------------------------------------------')
|
eprintln(term.h_divider('-'))
|
||||||
status := os.system(cmd)
|
status := os.system(cmd)
|
||||||
if status == 0 {
|
if status == 0 {
|
||||||
ts.benchmark.ok()
|
ts.benchmark.ok()
|
||||||
|
@ -196,8 +196,8 @@ pub fn v_build_failing(zargs string, folder string) bool {
|
||||||
parent_dir := filepath.dir(vexe)
|
parent_dir := filepath.dir(vexe)
|
||||||
vlib_should_be_present(parent_dir)
|
vlib_should_be_present(parent_dir)
|
||||||
vargs := zargs.replace(vexe, '')
|
vargs := zargs.replace(vexe, '')
|
||||||
eprintln(main_label)
|
eheader(main_label)
|
||||||
eprintln(' v compiler args: "$vargs"')
|
eprintln('v compiler args: "$vargs"')
|
||||||
mut session := new_test_session(vargs)
|
mut session := new_test_session(vargs)
|
||||||
files := os.walk_ext(filepath.join(parent_dir,folder), '.v')
|
files := os.walk_ext(filepath.join(parent_dir,folder), '.v')
|
||||||
mut mains := files.filter(!it.contains('modules') && !it.contains('preludes'))
|
mut mains := files.filter(!it.contains('modules') && !it.contains('preludes'))
|
||||||
|
@ -231,7 +231,7 @@ pub fn build_v_cmd_failed(cmd string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn building_any_v_binaries_failed() bool {
|
pub fn building_any_v_binaries_failed() bool {
|
||||||
eprintln('Building V binaries...')
|
eheader('Building V binaries...')
|
||||||
eprintln('VFLAGS is: "' + os.getenv('VFLAGS') + '"')
|
eprintln('VFLAGS is: "' + os.getenv('VFLAGS') + '"')
|
||||||
vexe := testing.vexe_path()
|
vexe := testing.vexe_path()
|
||||||
parent_dir := filepath.dir(vexe)
|
parent_dir := filepath.dir(vexe)
|
||||||
|
@ -262,3 +262,11 @@ pub fn building_any_v_binaries_failed() bool {
|
||||||
eprintln(bmark.total_message('building v binaries'))
|
eprintln(bmark.total_message('building v binaries'))
|
||||||
return failed
|
return failed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn eheader(msg string) {
|
||||||
|
eprintln(term.header(msg,'-'))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn header(msg string) {
|
||||||
|
println(term.header(msg,'-'))
|
||||||
|
}
|
||||||
|
|
|
@ -43,7 +43,8 @@ fn v_test_compiler(vargs string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
building_tools_failed := testing.v_build_failing(vargs, 'tools')
|
building_tools_failed := testing.v_build_failing(vargs, 'tools')
|
||||||
eprintln('\nTesting all _test.v files...')
|
eprintln('')
|
||||||
|
testing.eheader('Testing all _test.v files...')
|
||||||
mut compiler_test_session := testing.new_test_session(vargs)
|
mut compiler_test_session := testing.new_test_session(vargs)
|
||||||
compiler_test_session.files << os.walk_ext(parent_dir, '_test.v')
|
compiler_test_session.files << os.walk_ext(parent_dir, '_test.v')
|
||||||
compiler_test_session.test()
|
compiler_test_session.test()
|
||||||
|
@ -54,7 +55,8 @@ fn v_test_compiler(vargs string) {
|
||||||
building_live_failed := testing.v_build_failing(vargs + '-live', filepath.join('examples','hot_reload'))
|
building_live_failed := testing.v_build_failing(vargs + '-live', filepath.join('examples','hot_reload'))
|
||||||
eprintln('')
|
eprintln('')
|
||||||
v_module_install_cmd := '$vexe install nedpals.args'
|
v_module_install_cmd := '$vexe install nedpals.args'
|
||||||
eprintln('\nInstalling a v module with: $v_module_install_cmd ')
|
eprintln('')
|
||||||
|
testing.eheader('Installing a v module with: $v_module_install_cmd')
|
||||||
mut vmark := benchmark.new_benchmark()
|
mut vmark := benchmark.new_benchmark()
|
||||||
ret := os.system(v_module_install_cmd)
|
ret := os.system(v_module_install_cmd)
|
||||||
if ret != 0 {
|
if ret != 0 {
|
||||||
|
|
|
@ -8,13 +8,13 @@ import (
|
||||||
const (
|
const (
|
||||||
known_failing_exceptions = ['./examples/vweb/vweb_example.v',
|
known_failing_exceptions = ['./examples/vweb/vweb_example.v',
|
||||||
'./tools/gen_vc.v',
|
'./tools/gen_vc.v',
|
||||||
'./tools/modules/vgit/vgit.v', // generics
|
'./tools/modules/vgit/vgit.v', // generics
|
||||||
'./tools/preludes/live_main.v',
|
'./tools/preludes/live_main.v',
|
||||||
'./tools/preludes/live_shared.v',
|
'./tools/preludes/live_shared.v',
|
||||||
'./tools/preludes/tests_assertions.v',
|
'./tools/preludes/tests_assertions.v',
|
||||||
'./tools/preludes/tests_with_stats.v',
|
'./tools/preludes/tests_with_stats.v',
|
||||||
'./tools/performance_compare.v', // generics
|
'./tools/performance_compare.v', // generics
|
||||||
'./tools/oldv.v', // generics
|
'./tools/oldv.v', // generics
|
||||||
'./tutorials/code/blog/article.v',
|
'./tutorials/code/blog/article.v',
|
||||||
'./tutorials/code/blog/blog.v',
|
'./tutorials/code/blog/blog.v',
|
||||||
'./vlib/arrays/arrays.v',
|
'./vlib/arrays/arrays.v',
|
||||||
|
@ -45,7 +45,7 @@ fn main() {
|
||||||
|
|
||||||
fn v_test_formatting(vargs string) {
|
fn v_test_formatting(vargs string) {
|
||||||
all_v_files := v_files()
|
all_v_files := v_files()
|
||||||
eprintln('Run "v fmt" over all .v files')
|
testing.eheader('Run "v fmt" over all .v files')
|
||||||
mut vfmt_test_session := testing.new_test_session('$vargs fmt -worker')
|
mut vfmt_test_session := testing.new_test_session('$vargs fmt -worker')
|
||||||
vfmt_test_session.files << all_v_files
|
vfmt_test_session.files << all_v_files
|
||||||
vfmt_test_session.test()
|
vfmt_test_session.test()
|
||||||
|
|
|
@ -45,7 +45,7 @@ pub fn main() {
|
||||||
println('Unrecognized test file $targ .')
|
println('Unrecognized test file $targ .')
|
||||||
}
|
}
|
||||||
|
|
||||||
println('Testing...')
|
testing.header('Testing...')
|
||||||
ts.test()
|
ts.test()
|
||||||
|
|
||||||
println( ts.benchmark.total_message('running V _test.v files') )
|
println( ts.benchmark.total_message('running V _test.v files') )
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
module runtime
|
module runtime
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
//$if linux {
|
//$if linux {
|
||||||
fn C.sysconf(name int) i64
|
fn C.sysconf(name int) i64
|
||||||
//}
|
//}
|
||||||
|
@ -19,6 +21,16 @@ pub fn nr_cpus() int {
|
||||||
return nr_cpus_nix()
|
return nr_cpus_nix()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn nr_jobs() int {
|
||||||
|
mut cpus := nr_cpus()
|
||||||
|
// allow for overrides, for example using `VJOBS=32 ./v test .`
|
||||||
|
vjobs := os.getenv('VJOBS').int()
|
||||||
|
if vjobs > 0 {
|
||||||
|
cpus = vjobs
|
||||||
|
}
|
||||||
|
return cpus
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_32bit() bool {
|
pub fn is_32bit() bool {
|
||||||
mut x := false
|
mut x := false
|
||||||
$if x32 { x = true }
|
$if x32 { x = true }
|
||||||
|
|
Loading…
Reference in New Issue