vtest,pref: add ability to have platform specific _test.v files (#20810)

This commit is contained in:
syrmel 2024-02-13 11:06:47 +01:00 committed by GitHub
parent c9933da675
commit 6a4f2937ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 89 additions and 7 deletions

View file

@ -210,10 +210,12 @@ pub fn (mut ts TestSession) print_messages() {
pub fn new_test_session(_vargs string, will_compile bool) TestSession {
mut skip_files := []string{}
if will_compile {
// Skip the call_v_from_c files. They need special instructions for compilation.
// Skip the call_v_from_* files. They need special instructions for compilation.
// Check the README.md for detailed information.
skip_files << 'examples/call_v_from_c/v_test_print.v'
skip_files << 'examples/call_v_from_c/v_test_math.v'
skip_files << 'examples/call_v_from_python/test.v' // the example only makes sense to be compiled, when python is installed
skip_files << 'examples/call_v_from_ruby/test.v' // the example only makes sense to be compiled, when ruby is installed
// Skip the compilation of the coroutines example for now, since the Photon wrapper
// is only available on macos for now, and it is not yet trivial enough to
// build/install on the CI:
@ -262,8 +264,6 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
}
if testing.runner_os != 'Linux' || testing.github_job != 'tcc' {
skip_files << 'examples/c_interop_wkhtmltopdf.v' // needs installation of wkhtmltopdf from https://github.com/wkhtmltopdf/packaging/releases
skip_files << 'examples/call_v_from_python/test.v' // the example only makes sense to be compiled, when python is installed
skip_files << 'examples/call_v_from_ruby/test.v' // the example only makes sense to be compiled, when ruby is installed
skip_files << 'vlib/vweb/vweb_app_test.v' // imports the `sqlite` module, which in turn includes sqlite3.h
skip_files << 'vlib/x/vweb/tests/vweb_app_test.v' // imports the `sqlite` module, which in turn includes sqlite3.h
}
@ -296,6 +296,7 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
skip_files << 'examples/wasm/mandelbrot/mandelbrot.wasm.v'
skip_files << 'examples/wasm/change_color_by_id/change_color_by_id.wasm.v'
}
skip_files = skip_files.map(os.abs_path)
vargs := _vargs.replace('-progress', '')
vexe := pref.vexe_path()
vroot := os.dir(vexe)
@ -439,7 +440,8 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
tls_bench.no_cstep = true
tls_bench.njobs = ts.benchmark.njobs
mut relative_file := os.real_path(p.get_item[string](idx))
abs_path := os.real_path(p.get_item[string](idx))
mut relative_file := abs_path
mut cmd_options := [ts.vargs]
mut run_js := false
@ -521,7 +523,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
ts.benchmark.step()
tls_bench.step()
if relative_file.replace('\\', '/') in ts.skip_files {
if abs_path in ts.skip_files {
ts.benchmark.skip()
tls_bench.skip()
if !testing.hide_skips {