1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tooling: use term.header for tests

This commit is contained in:
Delyan Angelov
2020-02-08 18:01:10 +02:00
committed by GitHub
parent 9d8116f895
commit 4bb5d7de8b
5 changed files with 38 additions and 16 deletions

View File

@@ -80,17 +80,17 @@ pub fn (ts mut TestSession) test() {
ts.files = remaining_files
ts.benchmark.set_total_expected_steps(remaining_files.len)
mut ncpus := runtime.nr_cpus()
mut njobs := runtime.nr_jobs()
$if msvc {
// NB: MSVC can not be launched in parallel, without giving it
// the option /FS because it uses a shared PDB file, which should
// 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
// Instead, just run tests on 1 core for now.
ncpus = 1
}
ts.waitgroup.add( ncpus )
for i:=0; i < ncpus; i++ {
njobs = 1
}
ts.waitgroup.add( njobs )
for i:=0; i < njobs; i++ {
go process_in_thread(ts)
}
ts.waitgroup.wait()
@@ -140,7 +140,7 @@ fn (ts mut TestSession) process_files() {
ts.benchmark.step()
tls_bench.step()
if show_stats {
eprintln('-------------------------------------------------')
eprintln(term.h_divider('-'))
status := os.system(cmd)
if status == 0 {
ts.benchmark.ok()
@@ -196,8 +196,8 @@ pub fn v_build_failing(zargs string, folder string) bool {
parent_dir := filepath.dir(vexe)
vlib_should_be_present(parent_dir)
vargs := zargs.replace(vexe, '')
eprintln(main_label)
eprintln(' v compiler args: "$vargs"')
eheader(main_label)
eprintln('v compiler args: "$vargs"')
mut session := new_test_session(vargs)
files := os.walk_ext(filepath.join(parent_dir,folder), '.v')
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 {
eprintln('Building V binaries...')
eheader('Building V binaries...')
eprintln('VFLAGS is: "' + os.getenv('VFLAGS') + '"')
vexe := testing.vexe_path()
parent_dir := filepath.dir(vexe)
@@ -262,3 +262,11 @@ pub fn building_any_v_binaries_failed() bool {
eprintln(bmark.total_message('building v binaries'))
return failed
}
pub fn eheader(msg string) {
eprintln(term.header(msg,'-'))
}
pub fn header(msg string) {
println(term.header(msg,'-'))
}