mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools: make v test-cleancode
test everything by default (#10050)
This commit is contained in:
@ -12,6 +12,10 @@ const github_job = os.getenv('GITHUB_JOB')
|
||||
|
||||
const show_start = os.getenv('VTEST_SHOW_START') == '1'
|
||||
|
||||
const hide_skips = os.getenv('VTEST_HIDE_SKIP') == '1'
|
||||
|
||||
const hide_oks = os.getenv('VTEST_HIDE_OK') == '1'
|
||||
|
||||
pub struct TestSession {
|
||||
pub mut:
|
||||
files []string
|
||||
@ -108,43 +112,50 @@ pub fn (mut ts TestSession) print_messages() {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_test_session(_vargs string) TestSession {
|
||||
pub fn new_test_session(_vargs string, will_compile bool) TestSession {
|
||||
mut skip_files := []string{}
|
||||
$if solaris {
|
||||
skip_files << 'examples/gg/gg2.v'
|
||||
skip_files << 'examples/pico/pico.v'
|
||||
skip_files << 'examples/sokol/fonts.v'
|
||||
skip_files << 'examples/sokol/drawing.v'
|
||||
}
|
||||
$if macos {
|
||||
skip_files << 'examples/database/mysql.v'
|
||||
skip_files << 'examples/database/orm.v'
|
||||
skip_files << 'examples/database/pg/customer.v'
|
||||
}
|
||||
$if windows {
|
||||
skip_files << 'examples/database/mysql.v'
|
||||
skip_files << 'examples/database/orm.v'
|
||||
skip_files << 'examples/websocket/ping.v' // requires OpenSSL
|
||||
skip_files << 'examples/websocket/client-server/client.v' // requires OpenSSL
|
||||
skip_files << 'examples/websocket/client-server/server.v' // requires OpenSSL
|
||||
$if tinyc {
|
||||
skip_files << 'examples/database/orm.v' // try fix it
|
||||
if will_compile {
|
||||
$if solaris {
|
||||
skip_files << 'examples/gg/gg2.v'
|
||||
skip_files << 'examples/pico/pico.v'
|
||||
skip_files << 'examples/sokol/fonts.v'
|
||||
skip_files << 'examples/sokol/drawing.v'
|
||||
}
|
||||
$if macos {
|
||||
skip_files << 'examples/database/mysql.v'
|
||||
skip_files << 'examples/database/orm.v'
|
||||
skip_files << 'examples/database/pg/customer.v'
|
||||
}
|
||||
$if windows {
|
||||
skip_files << 'examples/database/mysql.v'
|
||||
skip_files << 'examples/database/orm.v'
|
||||
skip_files << 'examples/websocket/ping.v' // requires OpenSSL
|
||||
skip_files << 'examples/websocket/client-server/client.v' // requires OpenSSL
|
||||
skip_files << 'examples/websocket/client-server/server.v' // requires OpenSSL
|
||||
$if tinyc {
|
||||
skip_files << 'examples/database/orm.v' // try fix it
|
||||
}
|
||||
}
|
||||
if testing.github_job != 'sokol-shaders-can-be-compiled' {
|
||||
// These examples need .h files that are produced from the supplied .glsl files,
|
||||
// using by the shader compiler tools in https://github.com/floooh/sokol-tools-bin/archive/pre-feb2021-api-changes.tar.gz
|
||||
skip_files << 'examples/sokol/02_cubes_glsl/cube_glsl.v'
|
||||
skip_files << 'examples/sokol/03_march_tracing_glsl/rt_glsl.v'
|
||||
skip_files << 'examples/sokol/04_multi_shader_glsl/rt_glsl.v'
|
||||
skip_files << 'examples/sokol/05_instancing_glsl/rt_glsl.v'
|
||||
// Skip obj_viewer code in the CI
|
||||
skip_files << 'examples/sokol/06_obj_viewer/show_obj.v'
|
||||
}
|
||||
if testing.github_job != 'ubuntu-tcc' {
|
||||
skip_files << 'examples/c_interop_wkhtmltopdf.v' // needs installation of wkhtmltopdf from https://github.com/wkhtmltopdf/packaging/releases
|
||||
// the ttf_test.v is not interactive, but needs X11 headers to be installed, which is done only on ubuntu-tcc for now
|
||||
skip_files << 'vlib/x/ttf/ttf_test.v'
|
||||
}
|
||||
if testing.github_job != 'audio-examples' {
|
||||
skip_files << 'examples/sokol/sounds/melody.v'
|
||||
skip_files << 'examples/sokol/sounds/wav_player.v'
|
||||
skip_files << 'examples/sokol/sounds/simple_sin_tones.v'
|
||||
}
|
||||
}
|
||||
if testing.github_job != 'sokol-shaders-can-be-compiled' {
|
||||
// These examples need .h files that are produced from the supplied .glsl files,
|
||||
// using by the shader compiler tools in https://github.com/floooh/sokol-tools-bin/archive/pre-feb2021-api-changes.tar.gz
|
||||
skip_files << 'examples/sokol/02_cubes_glsl/cube_glsl.v'
|
||||
skip_files << 'examples/sokol/03_march_tracing_glsl/rt_glsl.v'
|
||||
skip_files << 'examples/sokol/04_multi_shader_glsl/rt_glsl.v'
|
||||
skip_files << 'examples/sokol/05_instancing_glsl/rt_glsl.v'
|
||||
// Skip obj_viewer code in the CI
|
||||
skip_files << 'examples/sokol/06_obj_viewer/show_obj.v'
|
||||
}
|
||||
if testing.github_job != 'ubuntu-tcc' {
|
||||
skip_files << 'examples/c_interop_wkhtmltopdf.v' // needs installation of wkhtmltopdf from https://github.com/wkhtmltopdf/packaging/releases
|
||||
// the ttf_test.v is not interactive, but needs X11 headers to be installed, which is done only on ubuntu-tcc for now
|
||||
skip_files << 'vlib/x/ttf/ttf_test.v'
|
||||
}
|
||||
vargs := _vargs.replace('-progress', '').replace('-progress', '')
|
||||
vexe := pref.vexe_path()
|
||||
@ -268,7 +279,9 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
|
||||
if relative_file.replace('\\', '/') in ts.skip_files {
|
||||
ts.benchmark.skip()
|
||||
tls_bench.skip()
|
||||
ts.append_message(.skip, tls_bench.step_message_skip(relative_file))
|
||||
if !testing.hide_skips {
|
||||
ts.append_message(.skip, tls_bench.step_message_skip(relative_file))
|
||||
}
|
||||
return pool.no_result
|
||||
}
|
||||
if show_stats {
|
||||
@ -304,7 +317,9 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
|
||||
} else {
|
||||
ts.benchmark.ok()
|
||||
tls_bench.ok()
|
||||
ts.append_message(.ok, tls_bench.step_message_ok(relative_file))
|
||||
if !testing.hide_oks {
|
||||
ts.append_message(.ok, tls_bench.step_message_ok(relative_file))
|
||||
}
|
||||
}
|
||||
}
|
||||
if os.exists(generated_binary_fpath) {
|
||||
@ -336,7 +351,7 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
|
||||
if vargs.len > 0 {
|
||||
eprintln('v compiler args: "$vargs"')
|
||||
}
|
||||
mut session := new_test_session(vargs)
|
||||
mut session := new_test_session(vargs, true)
|
||||
files := os.walk_ext(os.join_path(parent_dir, folder), '.v')
|
||||
mut mains := []string{}
|
||||
mut skipped := oskipped.clone()
|
||||
@ -414,7 +429,9 @@ pub fn building_any_v_binaries_failed() bool {
|
||||
continue
|
||||
}
|
||||
bmark.ok()
|
||||
eprintln(bmark.step_message_ok('command: $cmd'))
|
||||
if !testing.hide_oks {
|
||||
eprintln(bmark.step_message_ok('command: $cmd'))
|
||||
}
|
||||
}
|
||||
bmark.stop()
|
||||
eprintln(term.h_divider('-'))
|
||||
|
Reference in New Issue
Block a user