tools: cleanup entries from the hardcoded skip_files list in common.v (used by v test, v test-self etc); use the new // vtest build: syntax to mark the tests instead (#23918)

This commit is contained in:
Delyan Angelov 2025-03-13 19:51:51 +02:00 committed by GitHub
parent 9f3f1291e8
commit a80bc23314
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
109 changed files with 208 additions and 322 deletions

View File

@ -45,6 +45,14 @@ pub const is_node_present = os.execute('node --version').exit_code == 0
pub const is_go_present = os.execute('go version').exit_code == 0 pub const is_go_present = os.execute('go version').exit_code == 0
pub const is_ruby_present = os.execute('ruby --version').exit_code == 0
pub const is_python_present = os.execute('python --version').exit_code == 0
pub const is_sqlite3_present = os.execute('sqlite3 --version').exit_code == 0
pub const is_openssl_present = os.execute('openssl --version').exit_code == 0
pub const all_processes = get_all_processes() pub const all_processes = get_all_processes()
pub const header_bytes_to_search_for_module_main = 500 pub const header_bytes_to_search_for_module_main = 500
@ -101,6 +109,7 @@ pub mut:
exec_mode ActionMode = .compile // .compile_and_run only for `v test` exec_mode ActionMode = .compile // .compile_and_run only for `v test`
build_environment build_constraint.Environment // see the documentation in v.build_constraint build_environment build_constraint.Environment // see the documentation in v.build_constraint
custom_defines []string // for adding custom defines, known only to the individual runners
} }
pub fn (mut ts TestSession) add_failed_cmd(cmd string) { pub fn (mut ts TestSession) add_failed_cmd(cmd string) {
@ -219,107 +228,14 @@ pub fn (mut ts TestSession) print_messages() {
pub fn new_test_session(_vargs string, will_compile bool) TestSession { pub fn new_test_session(_vargs string, will_compile bool) TestSession {
mut skip_files := []string{} mut skip_files := []string{}
if will_compile { if will_compile {
// 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:
skip_files << 'examples/coroutines/simple_coroutines.v'
skip_files << 'examples/coroutines/coroutines_bench.v'
$if msvc {
skip_files << 'vlib/v/tests/consts/const_comptime_eval_before_vinit_test.v' // _constructor used
}
$if solaris {
skip_files << 'examples/pico/pico.v'
skip_files << 'examples/pico/raw_callback.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/psql/customer.v'
}
$if windows { $if windows {
skip_files << 'examples/vanilla_http_server' // requires epoll skip_files << 'examples/vanilla_http_server' // requires epoll // TODO: find a way to support `// vtest build:` for project folders too...
skip_files << 'examples/1brc/solution/main.v' // requires mmap
skip_files << 'examples/database/mysql.v'
skip_files << 'examples/database/orm.v'
skip_files << 'examples/smtp/mail.v' // requires OpenSSL
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
skip_files << 'examples/minimal_c_like_program_using_puts.v' // declares its own `main` function, while on windows it needs to be `wWinMain` ... although only for gcc for some reason ¯\_(ツ)_/¯
skip_files << 'vlib/v/tests/websocket_logger_interface_should_compile_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/ecdsa_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/util_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/example/ecdsa_seed_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/example/ensure_compatibility_with_net_openssl_test.v' // requires OpenSSL
$if tinyc {
skip_files << 'examples/database/orm.v' // try fix it
}
}
$if windows {
// TODO: remove when closures on windows are supported...
skip_files << 'examples/pendulum-simulation/animation.v'
skip_files << 'examples/pendulum-simulation/full.v'
skip_files << 'examples/pendulum-simulation/parallel.v'
skip_files << 'examples/pendulum-simulation/parallel_with_iw.v'
skip_files << 'examples/pendulum-simulation/sequential.v'
if github_job == 'tcc-windows' {
// TODO: fix these by adding declarations for the missing functions in the prebuilt tcc
skip_files << 'vlib/net/mbedtls/mbedtls_compiles_test.v'
skip_files << 'vlib/net/ssl/ssl_compiles_test.v'
}
} }
if runner_os != 'Linux' || !github_job.starts_with('tcc-') { if runner_os != 'Linux' || !github_job.starts_with('tcc-') {
if !os.exists('/usr/local/include/wkhtmltox/pdf.h') { if !os.exists('/usr/local/include/wkhtmltox/pdf.h') {
skip_files << 'examples/c_interop_wkhtmltopdf.v' // needs installation of wkhtmltopdf from https://github.com/wkhtmltopdf/packaging/releases skip_files << 'examples/c_interop_wkhtmltopdf.v' // needs installation of wkhtmltopdf from https://github.com/wkhtmltopdf/packaging/releases
} }
skip_files << 'vlib/vweb/vweb_app_test.v' // imports the `sqlite` module, which in turn includes `sqlite3.h`
skip_files << 'vlib/veb/tests/veb_app_test.v' // imports the `sqlite` module, which in turn includes `sqlite3.h`
} }
$if !macos {
skip_files << 'examples/macos_tray/tray.v'
}
if github_job == 'docker-ubuntu-musl' {
skip_files << 'vlib/net/openssl/openssl_compiles_test.c.v'
skip_files << 'vlib/crypto/ecdsa/ecdsa_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/util_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/example/ecdsa_seed_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/example/ensure_compatibility_with_net_openssl_test.v' // requires OpenSSL
skip_files << 'vlib/x/ttf/ttf_test.v'
skip_files << 'vlib/encoding/iconv/iconv_test.v' // needs libiconv to be installed
}
if github_job == 'sanitize-memory-clang' {
skip_files << 'vlib/net/openssl/openssl_compiles_test.c.v'
skip_files << 'vlib/crypto/ecdsa/ecdsa_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/util_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/example/ecdsa_seed_test.v' // requires OpenSSL
skip_files << 'vlib/crypto/ecdsa/example/ensure_compatibility_with_net_openssl_test.v' // requires OpenSSL
// Fails compilation with: `/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line`
skip_files << 'examples/sokol/sounds/simple_sin_tones.v'
skip_files << 'examples/sokol/sounds/simple_sin_tone_using_audio_push.v'
}
if github_job != 'misc-tooling' {
// 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_files << 'examples/sokol/07_simple_shader_glsl/simple_shader.v'
skip_files << 'examples/sokol/08_sdf/sdf.v'
// Skip obj_viewer code in the CI
skip_files << 'examples/sokol/06_obj_viewer/show_obj.v'
}
// requires special compilation flags: `-b wasm -os browser`, skip it for now:
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) skip_files = skip_files.map(os.abs_path)
vargs := _vargs.replace('-progress', '') vargs := _vargs.replace('-progress', '')
@ -394,25 +310,9 @@ pub fn (mut ts TestSession) test() {
mut remaining_files := []string{} mut remaining_files := []string{}
for dot_relative_file in ts.files { for dot_relative_file in ts.files {
file := os.real_path(dot_relative_file) file := os.real_path(dot_relative_file)
$if windows {
if file.contains('sqlite') || file.contains('httpbin') {
continue
}
}
$if !macos {
if file.contains('customer') {
continue
}
}
$if msvc {
if file.contains('asm') {
continue
}
}
if ts.build_tools && dot_relative_file.ends_with('_test.v') { if ts.build_tools && dot_relative_file.ends_with('_test.v') {
continue continue
} }
// Skip OS-specific tests if we are not running that OS // Skip OS-specific tests if we are not running that OS
// Special case for android_outside_termux because of its // Special case for android_outside_termux because of its
// underscores // underscores
@ -447,7 +347,7 @@ pub fn (mut ts TestSession) test() {
pool_of_test_runners.set_shared_context(ts) pool_of_test_runners.set_shared_context(ts)
ts.reporter.worker_threads_start(remaining_files, mut ts) ts.reporter.worker_threads_start(remaining_files, mut ts)
ts.build_environment = get_build_environment() ts.setup_build_environment()
// all the testing happens here: // all the testing happens here:
pool_of_test_runners.work_on_pointers(unsafe { remaining_files.pointers() }) pool_of_test_runners.work_on_pointers(unsafe { remaining_files.pointers() })
@ -974,8 +874,44 @@ fn get_max_header_len() int {
return cols return cols
} }
fn get_build_environment() &build_constraint.Environment { // is_started_mysqld is true, when the test runner determines that there is a running mysql server
pub const is_started_mysqld = find_started_process('mysqld') or { '' }
// is_started_postgres is true, when the test runner determines that there is a running postgres server
pub const is_started_postgres = find_started_process('postgres') or { '' }
pub fn (mut ts TestSession) setup_build_environment() {
facts := os.getenv('VBUILD_FACTS').split_any(',') facts := os.getenv('VBUILD_FACTS').split_any(',')
defines := os.getenv('VBUILD_DEFINES').split_any(',') mut defines := os.getenv('VBUILD_DEFINES').split_any(',')
return build_constraint.new_environment(facts, defines) // add the runtime information, that the test runner has already determined by checking once:
if is_started_mysqld != '' {
defines << 'started_mysqld'
}
if is_started_postgres != '' {
defines << 'started_postgres'
}
if is_node_present {
defines << 'present_node'
}
if is_python_present {
defines << 'present_python'
}
if is_ruby_present {
defines << 'present_ruby'
}
if is_go_present {
defines << 'present_go'
}
if is_sqlite3_present {
defines << 'present_sqlite3'
}
if is_openssl_present {
defines << 'present_openssl'
}
defines << ts.custom_defines
$if trace_vbuild ? {
eprintln('>>> testing.get_build_environment facts: ${facts}')
eprintln('>>> testing.get_build_environment defines: ${defines}')
}
ts.build_environment = build_constraint.new_environment(facts, defines)
} }

View File

@ -73,7 +73,6 @@ fn set_output_type_from_str(format string) OutputType {
'md', 'markdown' { .markdown } 'md', 'markdown' { .markdown }
'json' { .json } 'json' { .json }
'text' { .plaintext } 'text' { .plaintext }
'ansi' { .ansi }
else { .ansi } else { .ansi }
} }
} }

View File

@ -1,3 +1,4 @@
// vtest build: !windows
module main module main
import os import os

View File

@ -97,21 +97,7 @@ const essential_list = [
'vlib/v/slow_tests/inout/compiler_test.v', 'vlib/v/slow_tests/inout/compiler_test.v',
'vlib/x/json2/tests/json2_test.v', 'vlib/x/json2/tests/json2_test.v',
] ]
const skip_test_files = [ // These tests are too slow to be run in the CI on each PR/commit in the sanitized modes:
'do_not_remove',
'cmd/tools/vdoc/vdoc_test.v', // markdown not installed
'vlib/context/deadline_test.v', // sometimes blocks
'vlib/context/onecontext/onecontext_test.v', // backtrace_symbols is missing
'vlib/db/mysql/mysql_orm_test.v', // mysql not installed
'vlib/db/mysql/mysql_test.v', // mysql not installed
'vlib/db/mysql/prepared_stmt_test.v', // mysql not installed
'vlib/db/pg/pg_orm_test.v', // pg not installed
'vlib/db/pg/pg_test.v', // pg not installed
'vlib/db/pg/pg_double_test.v', // pg not installed
'vlib/net/ftp/ftp_test.v', // currently broken
]
// These tests are too slow to be run in the CI on each PR/commit
// in the sanitized modes:
const skip_fsanitize_too_slow = [ const skip_fsanitize_too_slow = [
'do_not_remove', 'do_not_remove',
'vlib/v/compiler_errors_test.v', 'vlib/v/compiler_errors_test.v',
@ -225,33 +211,10 @@ const skip_with_fsanitize_undefined = [
'vlib/v/tests/orm_update_test.v', 'vlib/v/tests/orm_update_test.v',
'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v', // fails compilation with: undefined reference to vtable for __cxxabiv1::__function_type_info' 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v', // fails compilation with: undefined reference to vtable for __cxxabiv1::__function_type_info'
] ]
const skip_with_werror = [
'do_not_remove',
'vlib/v/embed_file/tests/embed_file_test.v',
]
const skip_with_asan_compiler = [
'do_not_remove',
]
const skip_with_msan_compiler = [
'do_not_remove',
]
const skip_with_ubsan_compiler = [
'do_not_remove',
]
const skip_on_musl = [
'do_not_remove',
'vlib/v/slow_tests/profile/profile_test.v',
'vlib/gg/draw_fns_api_test.v',
'vlib/v/tests/skip_unused/gg_code.vv',
'vlib/v/tests/c_struct_with_reserved_field_name_test.v',
'vlib/arrays/parallel/parallel_test.v',
]
const skip_on_ubuntu_musl = [ const skip_on_ubuntu_musl = [
'do_not_remove', 'do_not_remove',
'vlib/arrays/parallel/parallel_test.v', 'vlib/arrays/parallel/parallel_test.v',
//'vlib/v/gen/js/jsgen_test.v', 'vlib/builtin/js/array_test.js.v',
'vlib/net/http/cookie_test.v',
'vlib/net/http/status_test.v',
'vlib/db/sqlite/sqlite_test.v', 'vlib/db/sqlite/sqlite_test.v',
'vlib/db/sqlite/sqlite_orm_test.v', 'vlib/db/sqlite/sqlite_orm_test.v',
'vlib/db/sqlite/sqlite_comptime_field_test.v', 'vlib/db/sqlite/sqlite_comptime_field_test.v',
@ -289,92 +252,23 @@ const skip_on_ubuntu_musl = [
'vlib/v/tests/orm_create_several_tables_test.v', 'vlib/v/tests/orm_create_several_tables_test.v',
'vlib/v/tests/orm_update_test.v', 'vlib/v/tests/orm_update_test.v',
'vlib/v/tests/sql_statement_inside_fn_call_test.v', 'vlib/v/tests/sql_statement_inside_fn_call_test.v',
'vlib/v/tests/websocket_logger_interface_should_compile_test.v',
'vlib/v/tests/fns/fn_literal_type_test.v',
'vlib/clipboard/clipboard_test.v', 'vlib/clipboard/clipboard_test.v',
'vlib/vweb/tests/vweb_test.v', 'vlib/vweb/tests/vweb_test.v',
'vlib/vweb/csrf/csrf_test.v', 'vlib/vweb/csrf/csrf_test.v',
'vlib/net/http/request_test.v',
'vlib/vweb/route_test.v', 'vlib/vweb/route_test.v',
'vlib/net/http/request_test.v',
'vlib/net/websocket/websocket_test.v', 'vlib/net/websocket/websocket_test.v',
'vlib/net/http/header_test.v', 'vlib/net/http/header_test.v',
'vlib/net/http/server_test.v', 'vlib/net/http/server_test.v',
'vlib/net/http/response_test.v', 'vlib/net/http/response_test.v',
'vlib/builtin/js/array_test.js.v',
'vlib/net/smtp/smtp_test.v', 'vlib/net/smtp/smtp_test.v',
'vlib/v/tests/websocket_logger_interface_should_compile_test.v', 'vlib/net/http/cookie_test.v',
'vlib/v/tests/fns/fn_literal_type_test.v', 'vlib/net/http/status_test.v',
'vlib/x/sessions/tests/db_store_test.v', 'vlib/x/sessions/tests/db_store_test.v',
'vlib/veb/tests/veb_app_test.v', 'vlib/veb/tests/veb_app_test.v',
] ]
const skip_on_linux = [
'do_not_remove',
]
const skip_on_non_linux = [
'do_not_remove',
]
const skip_on_windows_msvc = [
'do_not_remove',
'vlib/v/tests/consts/const_fixed_array_containing_references_to_itself_test.v', // error C2099: initializer is not a constant
'vlib/v/tests/consts/const_and_global_with_same_name_test.v', // error C2099: initializer is not a constant
'vlib/v/tests/sumtypes/sumtype_as_cast_1_test.v', // error: cannot support compound statement expression ({expr; expr; expr;})
'vlib/v/tests/sumtypes/sumtype_as_cast_2_test.v', // error: cannot support compound statement expression ({expr; expr; expr;})
'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v', // TODO
]
const skip_on_windows = [
'do_not_remove',
'vlib/orm/orm_test.v',
'vlib/v/tests/orm_sub_struct_test.v',
'vlib/v/tests/orm_joined_tables_select_test.v',
'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v',
'vlib/net/websocket/websocket_test.v',
'vlib/net/openssl/openssl_compiles_test.c.v',
'vlib/net/http/request_test.v',
'vlib/net/smtp/smtp_test.v',
'vlib/net/ssl/ssl_compiles_test.v',
'vlib/net/mbedtls/mbedtls_compiles_test.v',
'vlib/vweb/tests/vweb_test.v',
'vlib/vweb/route_test.v',
'vlib/sync/many_times_test.v',
'vlib/sync/once_test.v',
'vlib/v/tests/websocket_logger_interface_should_compile_test.v',
'vlib/v/tests/fns/fn_literal_type_test.v',
]
const skip_on_non_windows = [
'do_not_remove',
]
const skip_on_macos = [
'do_not_remove',
]
const skip_on_non_macos = [
'do_not_remove',
]
const skip_on_amd64 = [
'do_not_remove',
]
const skip_on_arm64 = [
'do_not_remove',
]
const skip_on_non_amd64_or_arm64 = [
'do_not_remove',
// closures aren't implemented yet:
'vlib/v/tests/fns/closure_test.v',
// native aren't implemented:
'vlib/v/gen/native/tests/native_test.v',
'vlib/context/cancel_test.v',
'vlib/context/deadline_test.v',
'vlib/context/empty_test.v',
'vlib/context/value_test.v',
'vlib/context/onecontext/onecontext_test.v',
'vlib/sync/once_test.v',
'vlib/sync/many_times_test.v',
'do_not_remove',
]
const skip_on_sandboxed_packaging = [
'do_not_remove',
'vlib/v/slow_tests/inout/compiler_test.v',
'vlib/v/gen/native/tests/native_test.v',
'vlib/v/compiler_errors_test.v',
'vlib/v/gen/c/coutput_test.v',
]
fn Config.init(vargs []string, targs []string) !Config { fn Config.init(vargs []string, targs []string) !Config {
mut cfg := Config{} mut cfg := Config{}
@ -455,90 +349,42 @@ fn main() {
mut tsession := testing.new_test_session(vargs.join(' '), true) mut tsession := testing.new_test_session(vargs.join(' '), true)
tsession.exec_mode = .compile_and_run tsession.exec_mode = .compile_and_run
tsession.files << all_test_files.filter(!it.contains('testdata' + os.path_separator)) tsession.files << all_test_files.filter(!it.contains('testdata' + os.path_separator))
tsession.skip_files << skip_test_files
if !testing.is_go_present {
tsession.skip_files << 'vlib/v/gen/golang/tests/golang_test.v'
}
testing.find_started_process('mysqld') or {
tsession.skip_files << 'vlib/db/mysql/mysql_orm_test.v'
tsession.skip_files << 'vlib/db/mysql/mysql_test.v'
}
testing.find_started_process('postgres') or {
tsession.skip_files << 'vlib/db/pg/pg_orm_test.v'
tsession.skip_files << 'vlib/db/pg/pg_double_test.v'
}
$if windows && tinyc {
tsession.skip_files << 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v'
}
if !cfg.run_slow_sanitize if !cfg.run_slow_sanitize
&& ((cfg.sanitize_undefined || cfg.sanitize_memory || cfg.sanitize_address) && ((cfg.sanitize_undefined || cfg.sanitize_memory || cfg.sanitize_address)
|| (cfg.is_msan_compiler || cfg.is_asan_compiler || cfg.is_ubsan_compiler)) { || (cfg.is_msan_compiler || cfg.is_asan_compiler || cfg.is_ubsan_compiler)) {
tsession.skip_files << skip_fsanitize_too_slow tsession.skip_files << skip_fsanitize_too_slow
tsession.custom_defines << 'self_sanitize_too_slow'
} }
if cfg.werror { if cfg.werror {
tsession.skip_files << skip_with_werror tsession.custom_defines << 'self_werror'
} }
if cfg.sanitize_memory { if cfg.sanitize_memory {
tsession.skip_files << skip_with_fsanitize_memory tsession.skip_files << skip_with_fsanitize_memory
tsession.custom_defines << 'self_sanitize_memory'
} }
if cfg.sanitize_address { if cfg.sanitize_address {
tsession.skip_files << skip_with_fsanitize_address tsession.skip_files << skip_with_fsanitize_address
tsession.custom_defines << 'self_sanitize_address'
} }
if cfg.sanitize_undefined { if cfg.sanitize_undefined {
tsession.skip_files << skip_with_fsanitize_undefined tsession.skip_files << skip_with_fsanitize_undefined
tsession.custom_defines << 'self_sanitize_undefined'
} }
if cfg.is_asan_compiler { if cfg.is_asan_compiler {
tsession.skip_files << skip_with_asan_compiler tsession.custom_defines << 'self_asan_compiler'
} }
if cfg.is_msan_compiler { if cfg.is_msan_compiler {
tsession.skip_files << skip_with_msan_compiler tsession.custom_defines << 'self_msan_compiler'
} }
if cfg.is_ubsan_compiler { if cfg.is_ubsan_compiler {
tsession.skip_files << skip_with_ubsan_compiler tsession.custom_defines << 'self_ubsan_compiler'
} }
if cfg.is_musl_ci { if cfg.is_sandboxed_packaging {
tsession.skip_files << skip_on_musl tsession.custom_defines << 'self_sandboxed_packaging'
} }
if cfg.is_ubuntu_musl_ci { if cfg.is_ubuntu_musl_ci {
tsession.skip_files << skip_on_ubuntu_musl tsession.skip_files << skip_on_ubuntu_musl
} tsession.custom_defines << 'self_ubuntu_musl_ci'
if cfg.is_sandboxed_packaging {
tsession.skip_files << skip_on_sandboxed_packaging
}
$if !amd64 && !arm64 {
tsession.skip_files << skip_on_non_amd64_or_arm64
}
$if amd64 {
tsession.skip_files << skip_on_amd64
}
$if arm64 {
tsession.skip_files << skip_on_arm64
}
$if !linux {
tsession.skip_files << skip_on_non_linux
}
$if linux {
tsession.skip_files << skip_on_linux
}
$if windows {
tsession.skip_files << skip_on_windows
$if msvc {
tsession.skip_files << skip_on_windows_msvc
}
}
$if !windows {
tsession.skip_files << skip_on_non_windows
}
$if macos {
$if arm64 {
if cfg.github_job.starts_with('clang-') {
tsession.skip_files << 'vlib/net/openssl/openssl_compiles_test.c.v'
}
}
tsession.skip_files << skip_on_macos
}
$if !macos {
tsession.skip_files << skip_on_non_macos
} }
// dump(tsession.skip_files) // dump(tsession.skip_files)
mut unavailable_files := tsession.files.filter(!os.exists(it)) mut unavailable_files := tsession.files.filter(!os.exists(it))

View File

@ -1,3 +1,4 @@
// vtest build: !windows // requires mmap
import flag import flag
import math import math
import os import os

View File

@ -1,3 +1,4 @@
// vtest build: !msvc
fn main() { fn main() {
a := 100 a := 100
b := 20 b := 20

View File

@ -1,3 +1,4 @@
// vtest build: false // Check the README.md for detailed information; this file needs special compilation options
module test_math module test_math
import math import math

View File

@ -1,3 +1,4 @@
// vtest build: false // Check the README.md for detailed information; this file needs special compilation options
module test_print module test_print
@[export: 'foo'] @[export: 'foo']

View File

@ -1,3 +1,4 @@
// vtest build: present_python? // the example only makes sense to be compiled, when python is installed
module test module test
// Note: compile this with `v -d no_backtrace -shared test.v` // Note: compile this with `v -d no_backtrace -shared test.v`

View File

@ -1,3 +1,4 @@
// vtest build: present_ruby? // the example only makes sense to be compiled, when ruby is installed
module test module test
import math import math

View File

@ -1,6 +1,5 @@
// Build with (-gc none, until GC bug is fixed) // vtest build: false // This should be build with: `v -use-coroutines coroutine_benchs.v`
// v -gc none -use-coroutines coroutine_benchs.v // Note: the Photon wrapper is not yet trivial enough to build/install on the CI.
//
import coroutines import coroutines
import time import time
import net.http import net.http

View File

@ -1,6 +1,5 @@
// Build with // vtest build: false // This should be build with: v -use-coroutines simple_coroutines.v
// v -use-coroutines simple_coroutines.v // Note: the Photon wrapper is not yet trivial enough to build/install on the CI.
//
import coroutines import coroutines
import time import time
import os import os

View File

@ -1,3 +1,4 @@
// vtest build: !(macos || windows)
import db.mysql import db.mysql
fn main() { fn main() {

View File

@ -1,3 +1,4 @@
// vtest build: !(macos || windows)
import os import os
import db.sqlite import db.sqlite
import db.mysql import db.mysql

View File

@ -1,10 +1,7 @@
// vtest build: linux
module main module main
/*
import db.pg import db.pg
*/
const dash = '----------------------------------------------------------------'
struct Customer { struct Customer {
id int id int
@ -13,53 +10,62 @@ struct Customer {
country string country string
} }
const dash = '----------------------------------------------------------------'
fn main() { fn main() {
/* db := pg.connect(
db := pg.connect(pg.Config{ host: 'localhost' // or '127.0.0.1'
host: 'localhost' //'127.0.0.1' user: 'postgres'
user: 'postgres'
dbname: 'customerdb' dbname: 'customerdb'
}) or { ) or {
println('failed to connect') eprintln('failed to connect, error: ${err}')
println(err)
return return
} }
nr_customers := db.select count from Customer nr_customers := sql db {
println('Total customers: $nr_customers') select count from Customer
}!
println('Total customers: ${nr_customers}')
// V syntax can be used to build queries
println(dash) println(dash)
bg_country := 'Bulgaria' bg_country := 'Bulgaria'
bg_customers := db.select from Customer where country == bg_country && id != 2 // V syntax can be used to build queries
bg_customers := sql db {
select from Customer where country == bg_country && id != 2
}!
for customer in bg_customers { for customer in bg_customers {
println('$customer.country | $customer.id - $customer.name') println('${customer.country} | ${customer.id} - ${customer.name}')
} }
println(dash) println(dash)
ru_customers := db.select from Customer where country == 'Russia' ru_customers := sql db {
select from Customer where country == 'Russia'
}!
for customer in ru_customers { for customer in ru_customers {
println('$customer.country | $customer.id - $customer.name') println('${customer.country} | ${customer.id} - ${customer.name}')
} }
// by adding `limit 1` we tell V that there will be only one object // by adding `limit 1` we tell V that there will be only one object
println(dash) println(dash)
existing := db.select from Customer where id == 1 limit 1 or { panic(err) } existing := sql db {
println('Existing customer name: $existing.name') select from Customer where id == 1 limit 1
}!
println('Existing customer name: ${existing}[0].name')
println('Existing customer full information:') println('Existing customer full information:')
println(existing) println(existing)
println(dash) println(dash)
q := Customer{} q := Customer{}
// It's easy to handle queries that don't return any data // It's easy to handle queries that don't return any data
if anon := db.select from Customer where id == 12345 && name == q.name && _ := sql db {
nr_orders > q.nr_orders limit 1 { select from Customer where id == 12345 && name == q.name && nr_orders > q.nr_orders limit 1
println('Non existing customer name: $anon.name') }!
}
// Insert a new customer // Insert a new customer
nc := Customer{ nc := Customer{
name: 'John Doe' name: 'John Doe'
nr_orders: 10 nr_orders: 10
} }
db.insert(nc)*/ sql db {
insert nc into Customer
}!
} }

View File

@ -1,6 +1,5 @@
// Simple windows-less application that shows a icon button // vtest build: macos
// on Mac OS tray. // Simple windows-less application that shows a icon button on Mac OS tray.
//
// Tested on Mac OS Monterey (12.3). // Tested on Mac OS Monterey (12.3).
module main module main

View File

@ -1,3 +1,4 @@
// vtest build: !(windows && gcc) // it declares its own `main` function, but on windows && gcc, it needs to be `wWinMain`
module no_main module no_main
// Compile with: // Compile with:

View File

@ -1,3 +1,4 @@
// vtest build: !solaris
import json import json
import picoev import picoev
import picohttpparser import picohttpparser

View File

@ -1,3 +1,4 @@
// vtest build: !solaris
module main module main
import net import net

View File

@ -1,3 +1,4 @@
// vtest build: present_openssl?
// Creator: nedimf (07/2020) // Creator: nedimf (07/2020)
import os import os
import net.smtp import net.smtp

View File

@ -1,3 +1,4 @@
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
/********************************************************************** /**********************************************************************
* *
* Sokol 3d cube demo * Sokol 3d cube demo

View File

@ -1,3 +1,4 @@
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
/********************************************************************** /**********************************************************************
* *
* Sokol 3d cube demo * Sokol 3d cube demo

View File

@ -1,3 +1,4 @@
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
/********************************************************************** /**********************************************************************
* Sokol 3d cube multishader demo * Sokol 3d cube multishader demo
* Copyright (c) 2024 Dario Deledda. All rights reserved. * Copyright (c) 2024 Dario Deledda. All rights reserved.

View File

@ -1,3 +1,4 @@
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
/********************************************************************** /**********************************************************************
* *
* Sokol 3d cube multishader demo * Sokol 3d cube multishader demo

View File

@ -1,3 +1,4 @@
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
/********************************************************************** /**********************************************************************
* *
* .obj viewer * .obj viewer

View File

@ -1,5 +1,6 @@
// Copyright(C) 2022 Lars Pontoppidan. All rights reserved. // Copyright(C) 2022 Lars Pontoppidan. All rights reserved.
// Use of this source code is governed by an MIT license file distributed with this software package // Use of this source code is governed by an MIT license file distributed with this software package
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
module main module main
// Example shader triangle adapted to V from https://github.com/floooh/sokol-samples/blob/1f2ad36/sapp/triangle-sapp.c // Example shader triangle adapted to V from https://github.com/floooh/sokol-samples/blob/1f2ad36/sapp/triangle-sapp.c

View File

@ -1,5 +1,6 @@
// A Signed Distance Field rendering demo, ported from https://github.com/floooh/sokol-samples/blob/master/sapp/sdf-sapp.c // A Signed Distance Field rendering demo, ported from https://github.com/floooh/sokol-samples/blob/master/sapp/sdf-sapp.c
// which in turn is based on https://iquilezles.org/articles/mandelbulb/ and https://www.shadertoy.com/view/ltfSWn // which in turn is based on https://iquilezles.org/articles/mandelbulb/ and https://www.shadertoy.com/view/ltfSWn
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
import sokol.sapp import sokol.sapp
import sokol.gfx import sokol.gfx

View File

@ -1,3 +1,4 @@
// vtest build: !solaris
import sokol.sapp import sokol.sapp
import sokol.gfx import sokol.gfx
import sokol.sgl import sokol.sgl

View File

@ -1,3 +1,4 @@
// vtest build: !solaris
import sokol.sapp import sokol.sapp
import sokol.gfx import sokol.gfx
import sokol.sgl import sokol.sgl

View File

@ -1,3 +1,4 @@
// vtest build: !sanitize-memory-clang // Fails compilation with: `ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line`
// import log // import log
import math import math
import time import time

View File

@ -1,3 +1,4 @@
// vtest build: !sanitize-memory-clang // Fails compilation with: `ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line`
import time import time
import math import math
import sokol.audio import sokol.audio

View File

@ -1,3 +1,4 @@
// vtest build: false // requires special compilation flags: `-b wasm -os browser`
fn JS.change_color_by_id(ptr u8, len int, color_ptr u8, color_len int) fn JS.change_color_by_id(ptr u8, len int, color_ptr u8, color_len int)
// `main` must be public! // `main` must be public!

View File

@ -1,3 +1,4 @@
// vtest build: false // requires special compilation flags: `-b wasm -os browser`
fn JS.canvas_x() int fn JS.canvas_x() int
fn JS.canvas_y() int fn JS.canvas_y() int
fn JS.setpixel(x int, y int, c f64) fn JS.setpixel(x int, y int, c f64)

View File

@ -1,3 +1,4 @@
// vtest build: present_openssl?
module main module main
import os import os

View File

@ -1,3 +1,4 @@
// vtest build: present_openssl?
module main module main
import net.websocket import net.websocket

View File

@ -1,3 +1,4 @@
// vtest build: present_openssl?
module main module main
import time import time

View File

@ -1,3 +1,4 @@
// vtest build: !musl?
import arrays.parallel import arrays.parallel
import rand import rand
import time import time

View File

@ -1,5 +1,6 @@
// vtest flaky: true // vtest flaky: true
// vtest retry: 3 // vtest retry: 3
// vtest build: present_node?
fn test_js() { fn test_js() {
$if js_node { $if js_node {

View File

@ -1,5 +1,6 @@
// vtest flaky: true // vtest flaky: true
// vtest retry: 3 // vtest retry: 3
// vtest build: present_node?
const a = 3 const a = 3
const u = u64(1) const u = u64(1)

View File

@ -1,5 +1,6 @@
// vtest flaky: true // vtest flaky: true
// vtest retry: 3 // vtest retry: 3
// vtest build: present_node?
import rand import rand
const strings = unique_strings(200, 10) const strings = unique_strings(200, 10)

View File

@ -1,5 +1,6 @@
// vtest flaky: true // vtest flaky: true
// vtest retry: 3 // vtest retry: 3
// vtest build: present_node?
// import strings // import strings

View File

@ -1,5 +1,6 @@
// vtest flaky: true // vtest flaky: true
// vtest retry: 3 // vtest retry: 3
// vtest build: amd64 || arm64
import context import context
// This example demonstrates the use of a cancelable context to prevent a // This example demonstrates the use of a cancelable context to prevent a

View File

@ -1,3 +1,4 @@
// vtest build: false // TODO: it sometimes blocks, investigate why
import context import context
import time import time

View File

@ -1,3 +1,4 @@
// vtest build: amd64 || arm64
module context module context
fn test_background() { fn test_background() {

View File

@ -1,3 +1,4 @@
// vtest build: false // backtrace_symbols is missing
module onecontext module onecontext
import context import context

View File

@ -1,3 +1,4 @@
// vtest build: amd64 || arm64
import context import context
const not_found_value = &Value{ const not_found_value = &Value{

View File

@ -1,3 +1,4 @@
// vtest build: present_openssl? && !(sanitize-memory-clang? || docker-ubuntu-musl?)
module ecdsa module ecdsa
fn test_ecdsa() { fn test_ecdsa() {

View File

@ -1,3 +1,4 @@
// vtest build: present_openssl? && !(sanitize-memory-clang? || docker-ubuntu-musl?)
import rand import rand
import crypto.ecdsa import crypto.ecdsa
import encoding.hex import encoding.hex

View File

@ -1,3 +1,4 @@
// vtest build: present_openssl? && !(sanitize-memory-clang? || docker-ubuntu-musl?)
import net.openssl import net.openssl
import crypto.ecdsa import crypto.ecdsa

View File

@ -1,3 +1,4 @@
// vtest build: present_openssl? && !(sanitize-memory-clang? || docker-ubuntu-musl?)
module ecdsa module ecdsa
import encoding.hex import encoding.hex

View File

@ -1,3 +1,4 @@
// vtest build: started_mysqld?
import orm import orm
import db.mysql import db.mysql
import time import time

View File

@ -1,3 +1,4 @@
// vtest build: started_mysqld?
import db.mysql import db.mysql
fn test_mysql() { fn test_mysql() {

View File

@ -1,3 +1,4 @@
// vtest build: started_mysqld?
import db.mysql import db.mysql
fn test_prep() { fn test_prep() {

View File

@ -1,3 +1,4 @@
// vtest build: started_postgres?
module main module main
import db.pg import db.pg

View File

@ -1,3 +1,4 @@
// vtest build: started_postgres?
module main module main
import orm import orm

View File

@ -1,3 +1,4 @@
// vtest build: started_postgres?
module main module main
import db.pg import db.pg

View File

@ -1,3 +1,4 @@
// vtest build: present_sqlite3?
import db.sqlite import db.sqlite
struct Parent { struct Parent {

View File

@ -1,3 +1,4 @@
// vtest build: present_sqlite3?
module main module main
import db.sqlite import db.sqlite

View File

@ -1,3 +1,4 @@
// vtest build: present_sqlite3?
import orm import orm
import db.sqlite import db.sqlite
import time import time

View File

@ -1,3 +1,4 @@
// vtest build: present_sqlite3?
import db.sqlite import db.sqlite
type Connection = sqlite.DB type Connection = sqlite.DB

View File

@ -1,3 +1,4 @@
// vtest build: present_sqlite3?
import db.sqlite import db.sqlite
import rand import rand

View File

@ -1,3 +1,4 @@
// vtest build: !docker-ubuntu-musl // needs libiconv to be installed
import encoding.iconv import encoding.iconv
import os import os

View File

@ -1,3 +1,4 @@
// vtest build: !musl?
import os import os
fn test_all_samples_can_be_compiled() { fn test_all_samples_can_be_compiled() {

View File

@ -1,3 +1,4 @@
// vtest build: false // TODO: see if the interface notice can be fixed and the test made to pass with latest V
import net.ftp import net.ftp
fn test_ftp_client() { fn test_ftp_client() {

View File

@ -1,3 +1,4 @@
// vtest build: !windows
module http module http
import io import io

View File

@ -1,3 +1,4 @@
// vtest build: !(windows && tinyc) // TODO: fix these by adding declarations for the missing functions in the prebuilt tcc
import net.mbedtls as _ import net.mbedtls as _
fn test_mbedtls_compiles() { fn test_mbedtls_compiles() {

View File

@ -1,3 +1,4 @@
// vtest build: present_openssl?
import net.openssl as _ import net.openssl as _
struct Abc { struct Abc {

View File

@ -1,3 +1,4 @@
// vtest build: !windows
import os import os
import net.smtp import net.smtp
import time import time

View File

@ -1,3 +1,4 @@
// vtest build: present_openssl? && !(windows && tinyc) // TODO: fix these by adding declarations for the missing functions in the prebuilt tcc
import net.ssl import net.ssl
fn test_ssl_compiles() { fn test_ssl_compiles() {

View File

@ -1,3 +1,4 @@
// vtest build: !windows
import os import os
import net import net
import net.websocket import net.websocket

View File

@ -1,5 +1,6 @@
// vtest flaky: true // vtest flaky: true
// vtest retry: 3 // vtest retry: 3
// vtest build: !windows
// import db.mysql // import db.mysql
// import db.pg // import db.pg
import time import time

View File

@ -1,3 +1,4 @@
// vtest build: present_node?
import os import os
fn test_read_from_file() { fn test_read_from_file() {

View File

@ -1,3 +1,4 @@
// vtest build: present_node?
import rand import rand
fn test_string() { fn test_string() {

View File

@ -1,3 +1,4 @@
// vtest build: present_node?
import strings import strings
type MyInt = int type MyInt = int

View File

@ -1,3 +1,4 @@
// vtest build: present_node?
import strings import strings
fn test_levenshtein_distance() { fn test_levenshtein_distance() {

View File

@ -1,3 +1,4 @@
// vtest build: present_node?
import strings import strings
fn test_repeat() { fn test_repeat() {

View File

@ -1,3 +1,4 @@
// vtest build: present_node?
import strings.textscanner import strings.textscanner
fn test_remaining() { fn test_remaining() {

View File

@ -1,3 +1,4 @@
// vtest build: !windows && (amd64 || arm64)
import sync import sync
struct Counter { struct Counter {

View File

@ -1,3 +1,4 @@
// vtest build: !windows && (amd64 || arm64)
import sync import sync
struct One { struct One {

View File

@ -1,3 +1,4 @@
// vtest build: !self_sandboxed_packaging?
import os import os
import term import term
import v.util.diff import v.util.diff

View File

@ -1,4 +1,5 @@
const const_file = $embed_file('v.png') const const_file = $embed_file('v.png')
// vtest build: !self_werror?
const src = $embed_file('embed_file_test.v').to_string() const src = $embed_file('embed_file_test.v').to_string()

View File

@ -1,3 +1,4 @@
// vtest build: !self_sandboxed_packaging?
import os import os
import time import time
import term import term

View File

@ -1,3 +1,4 @@
// vtest build: present_go?
import os import os
import benchmark import benchmark
import term import term

View File

@ -1,3 +1,4 @@
// vtest build: (amd64 || arm64) && !self_sandboxed_packaging?
import os import os
import time import time
import benchmark import benchmark

View File

@ -1,3 +1,4 @@
// vtest build: !msvc
import v.slow_tests.assembly.util import v.slow_tests.assembly.util
fn test_inline_asm() { fn test_inline_asm() {

View File

@ -1,3 +1,4 @@
// vtest build: !msvc
import v.tests.assembly.util import v.tests.assembly.util
fn test_inline_asm() { fn test_inline_asm() {

View File

@ -1,3 +1,4 @@
// vtest build: !self_sandboxed_packaging?
// .out file: // .out file:
// To test a panic, remove everything after the long `===` line // To test a panic, remove everything after the long `===` line
// You can also remove the line with 'line:' e.g. for a builtin fn // You can also remove the line with 'line:' e.g. for a builtin fn

View File

@ -1,3 +1,4 @@
// vtest build: !musl?
import os import os
import time import time

View File

@ -1,3 +1,4 @@
// vtest build: !musl?
import gg import gg
import gx import gx

View File

@ -1,3 +1,4 @@
// vtest build: present_node?
fn JS.Math.pow(JS.Number, JS.Number) JS.Number fn JS.Math.pow(JS.Number, JS.Number) JS.Number
fn test_js_prim_cast() { fn test_js_prim_cast() {

View File

@ -1,3 +1,4 @@
// vtest build: !msvc // error C2099: initializer is not a constant
@[has_globals] @[has_globals]
module main module main

View File

@ -1,3 +1,4 @@
// vtest build: !msvc // _constructor used
// Note: the names are deliberately prefixed with zzz_, so that searching // Note: the names are deliberately prefixed with zzz_, so that searching
// for that in the generated C code is easier. Do not rename the consts. // for that in the generated C code is easier. Do not rename the consts.
const zzz_an_i8_const = i8(0x28) const zzz_an_i8_const = i8(0x28)

View File

@ -1,3 +1,4 @@
// vtest build: !msvc // error C2099: initializer is not a constant
struct Abc { struct Abc {
prev &Abc = unsafe { nil } prev &Abc = unsafe { nil }
} }

View File

@ -1,3 +1,4 @@
// vtest build: amd64 || arm64 // closures aren't implemented yet
fn test_decl_assignment() { fn test_decl_assignment() {
my_var := 12 my_var := 12
c1 := fn [my_var] () int { c1 := fn [my_var] () int {

View File

@ -1,3 +1,4 @@
// vtest build: !windows
import db.sqlite import db.sqlite
@[table: 'Users'] @[table: 'Users']

View File

@ -1,3 +1,4 @@
// vtest build: present_node?
// Not real external functions, so we won't call them // Not real external functions, so we won't call them
// We just want to make sure they compile // We just want to make sure they compile

View File

@ -1,3 +1,4 @@
// vtest build: present_sqlite3?
import db.sqlite import db.sqlite
struct User { struct User {

View File

@ -1,3 +1,4 @@
// vtest build: present_sqlite3?
import db.sqlite import db.sqlite
struct VieterDb { struct VieterDb {

View File

@ -1,3 +1,4 @@
// vtest build: present_sqlite3?
import db.sqlite import db.sqlite
struct Upper { struct Upper {

View File

@ -1,3 +1,4 @@
// vtest build: !(windows && tinyc|| msvc) // TODO
module main module main
#flag @VMODROOT/implementation.o #flag @VMODROOT/implementation.o

Some files were not shown because too many files have changed in this diff Show More