diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index a133baab29..c203a197e3 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -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_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 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` 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) { @@ -219,107 +228,14 @@ 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_* 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 { - skip_files << 'examples/vanilla_http_server' // requires epoll - 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' - } + skip_files << 'examples/vanilla_http_server' // requires epoll // TODO: find a way to support `// vtest build:` for project folders too... } if runner_os != 'Linux' || !github_job.starts_with('tcc-') { 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 << '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) vargs := _vargs.replace('-progress', '') @@ -394,25 +310,9 @@ pub fn (mut ts TestSession) test() { mut remaining_files := []string{} for dot_relative_file in ts.files { 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') { continue } - // Skip OS-specific tests if we are not running that OS // Special case for android_outside_termux because of its // underscores @@ -447,7 +347,7 @@ pub fn (mut ts TestSession) test() { pool_of_test_runners.set_shared_context(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: pool_of_test_runners.work_on_pointers(unsafe { remaining_files.pointers() }) @@ -974,8 +874,44 @@ fn get_max_header_len() int { 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(',') - defines := os.getenv('VBUILD_DEFINES').split_any(',') - return build_constraint.new_environment(facts, defines) + mut defines := os.getenv('VBUILD_DEFINES').split_any(',') + // 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) } diff --git a/cmd/tools/vdoc/utils.v b/cmd/tools/vdoc/utils.v index 7f1d8873cc..2a0493573a 100644 --- a/cmd/tools/vdoc/utils.v +++ b/cmd/tools/vdoc/utils.v @@ -73,7 +73,6 @@ fn set_output_type_from_str(format string) OutputType { 'md', 'markdown' { .markdown } 'json' { .json } 'text' { .plaintext } - 'ansi' { .ansi } else { .ansi } } } diff --git a/cmd/tools/vdoc/vdoc_test.v b/cmd/tools/vdoc/vdoc_test.v index 6097a811d7..9017892ede 100644 --- a/cmd/tools/vdoc/vdoc_test.v +++ b/cmd/tools/vdoc/vdoc_test.v @@ -1,3 +1,4 @@ +// vtest build: !windows module main import os diff --git a/cmd/tools/vtest-self.v b/cmd/tools/vtest-self.v index f04abce3a9..278be5d7d6 100644 --- a/cmd/tools/vtest-self.v +++ b/cmd/tools/vtest-self.v @@ -97,21 +97,7 @@ const essential_list = [ 'vlib/v/slow_tests/inout/compiler_test.v', 'vlib/x/json2/tests/json2_test.v', ] -const skip_test_files = [ - '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: +// These tests are too slow to be run in the CI on each PR/commit in the sanitized modes: const skip_fsanitize_too_slow = [ 'do_not_remove', '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/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 = [ 'do_not_remove', 'vlib/arrays/parallel/parallel_test.v', - //'vlib/v/gen/js/jsgen_test.v', - 'vlib/net/http/cookie_test.v', - 'vlib/net/http/status_test.v', + 'vlib/builtin/js/array_test.js.v', 'vlib/db/sqlite/sqlite_test.v', 'vlib/db/sqlite/sqlite_orm_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_update_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/vweb/tests/vweb_test.v', 'vlib/vweb/csrf/csrf_test.v', - 'vlib/net/http/request_test.v', 'vlib/vweb/route_test.v', + 'vlib/net/http/request_test.v', 'vlib/net/websocket/websocket_test.v', 'vlib/net/http/header_test.v', 'vlib/net/http/server_test.v', 'vlib/net/http/response_test.v', - 'vlib/builtin/js/array_test.js.v', 'vlib/net/smtp/smtp_test.v', - 'vlib/v/tests/websocket_logger_interface_should_compile_test.v', - 'vlib/v/tests/fns/fn_literal_type_test.v', + 'vlib/net/http/cookie_test.v', + 'vlib/net/http/status_test.v', 'vlib/x/sessions/tests/db_store_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 { mut cfg := Config{} @@ -455,90 +349,42 @@ fn main() { mut tsession := testing.new_test_session(vargs.join(' '), true) tsession.exec_mode = .compile_and_run 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 && ((cfg.sanitize_undefined || cfg.sanitize_memory || cfg.sanitize_address) || (cfg.is_msan_compiler || cfg.is_asan_compiler || cfg.is_ubsan_compiler)) { tsession.skip_files << skip_fsanitize_too_slow + tsession.custom_defines << 'self_sanitize_too_slow' } if cfg.werror { - tsession.skip_files << skip_with_werror + tsession.custom_defines << 'self_werror' } if cfg.sanitize_memory { tsession.skip_files << skip_with_fsanitize_memory + tsession.custom_defines << 'self_sanitize_memory' } if cfg.sanitize_address { tsession.skip_files << skip_with_fsanitize_address + tsession.custom_defines << 'self_sanitize_address' } if cfg.sanitize_undefined { tsession.skip_files << skip_with_fsanitize_undefined + tsession.custom_defines << 'self_sanitize_undefined' } if cfg.is_asan_compiler { - tsession.skip_files << skip_with_asan_compiler + tsession.custom_defines << 'self_asan_compiler' } if cfg.is_msan_compiler { - tsession.skip_files << skip_with_msan_compiler + tsession.custom_defines << 'self_msan_compiler' } if cfg.is_ubsan_compiler { - tsession.skip_files << skip_with_ubsan_compiler + tsession.custom_defines << 'self_ubsan_compiler' } - if cfg.is_musl_ci { - tsession.skip_files << skip_on_musl + if cfg.is_sandboxed_packaging { + tsession.custom_defines << 'self_sandboxed_packaging' } if cfg.is_ubuntu_musl_ci { tsession.skip_files << skip_on_ubuntu_musl - } - 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 + tsession.custom_defines << 'self_ubuntu_musl_ci' } // dump(tsession.skip_files) mut unavailable_files := tsession.files.filter(!os.exists(it)) diff --git a/examples/1brc/solution/main.v b/examples/1brc/solution/main.v index e5dc8e23b7..6b2a7352ce 100644 --- a/examples/1brc/solution/main.v +++ b/examples/1brc/solution/main.v @@ -1,3 +1,4 @@ +// vtest build: !windows // requires mmap import flag import math import os diff --git a/examples/asm.v b/examples/asm.v index 6a117358b4..2ba1c0e05b 100644 --- a/examples/asm.v +++ b/examples/asm.v @@ -1,3 +1,4 @@ +// vtest build: !msvc fn main() { a := 100 b := 20 diff --git a/examples/call_v_from_c/v_test_math.v b/examples/call_v_from_c/v_test_math.v index 264a50c77d..041bcd34f7 100644 --- a/examples/call_v_from_c/v_test_math.v +++ b/examples/call_v_from_c/v_test_math.v @@ -1,3 +1,4 @@ +// vtest build: false // Check the README.md for detailed information; this file needs special compilation options module test_math import math diff --git a/examples/call_v_from_c/v_test_print.v b/examples/call_v_from_c/v_test_print.v index 8e98d97b8c..8eb659780b 100644 --- a/examples/call_v_from_c/v_test_print.v +++ b/examples/call_v_from_c/v_test_print.v @@ -1,3 +1,4 @@ +// vtest build: false // Check the README.md for detailed information; this file needs special compilation options module test_print @[export: 'foo'] diff --git a/examples/call_v_from_python/test.v b/examples/call_v_from_python/test.v index adc0d30f1b..91f79622cd 100644 --- a/examples/call_v_from_python/test.v +++ b/examples/call_v_from_python/test.v @@ -1,3 +1,4 @@ +// vtest build: present_python? // the example only makes sense to be compiled, when python is installed module test // Note: compile this with `v -d no_backtrace -shared test.v` diff --git a/examples/call_v_from_ruby/test.v b/examples/call_v_from_ruby/test.v index 250791edac..f20007f2d0 100644 --- a/examples/call_v_from_ruby/test.v +++ b/examples/call_v_from_ruby/test.v @@ -1,3 +1,4 @@ +// vtest build: present_ruby? // the example only makes sense to be compiled, when ruby is installed module test import math diff --git a/examples/coroutines/coroutines_bench.v b/examples/coroutines/coroutines_bench.v index cb98d7f958..7b460510cc 100644 --- a/examples/coroutines/coroutines_bench.v +++ b/examples/coroutines/coroutines_bench.v @@ -1,6 +1,5 @@ -// Build with (-gc none, until GC bug is fixed) -// v -gc none -use-coroutines coroutine_benchs.v -// +// vtest build: false // This should be build with: `v -use-coroutines coroutine_benchs.v` +// Note: the Photon wrapper is not yet trivial enough to build/install on the CI. import coroutines import time import net.http diff --git a/examples/coroutines/simple_coroutines.v b/examples/coroutines/simple_coroutines.v index 2629a798a0..fe879cf0cc 100644 --- a/examples/coroutines/simple_coroutines.v +++ b/examples/coroutines/simple_coroutines.v @@ -1,6 +1,5 @@ -// Build with -// v -use-coroutines simple_coroutines.v -// +// vtest build: false // This should be build with: v -use-coroutines simple_coroutines.v +// Note: the Photon wrapper is not yet trivial enough to build/install on the CI. import coroutines import time import os diff --git a/examples/database/mysql.v b/examples/database/mysql.v index ccb9564002..8ba007ca6d 100644 --- a/examples/database/mysql.v +++ b/examples/database/mysql.v @@ -1,3 +1,4 @@ +// vtest build: !(macos || windows) import db.mysql fn main() { diff --git a/examples/database/orm.v b/examples/database/orm.v index 084267db1e..7b4b5c0a4a 100644 --- a/examples/database/orm.v +++ b/examples/database/orm.v @@ -1,3 +1,4 @@ +// vtest build: !(macos || windows) import os import db.sqlite import db.mysql diff --git a/examples/database/psql/customer.v b/examples/database/psql/customer.v index 517711bf75..c6d2ba74db 100644 --- a/examples/database/psql/customer.v +++ b/examples/database/psql/customer.v @@ -1,10 +1,7 @@ +// vtest build: linux module main -/* import db.pg -*/ - -const dash = '----------------------------------------------------------------' struct Customer { id int @@ -13,53 +10,62 @@ struct Customer { country string } +const dash = '----------------------------------------------------------------' + fn main() { - /* - db := pg.connect(pg.Config{ - host: 'localhost' //'127.0.0.1' - user: 'postgres' + db := pg.connect( + host: 'localhost' // or '127.0.0.1' + user: 'postgres' dbname: 'customerdb' - }) or { - println('failed to connect') - println(err) + ) or { + eprintln('failed to connect, error: ${err}') return } - nr_customers := db.select count from Customer - println('Total customers: $nr_customers') + nr_customers := sql db { + select count from Customer + }! + println('Total customers: ${nr_customers}') - // V syntax can be used to build queries println(dash) 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 { - println('$customer.country | $customer.id - $customer.name') + println('${customer.country} | ${customer.id} - ${customer.name}') } 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 { - 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 println(dash) - existing := db.select from Customer where id == 1 limit 1 or { panic(err) } - println('Existing customer name: $existing.name') + existing := sql db { + select from Customer where id == 1 limit 1 + }! + println('Existing customer name: ${existing}[0].name') println('Existing customer full information:') println(existing) println(dash) q := Customer{} // It's easy to handle queries that don't return any data - if anon := db.select from Customer where id == 12345 && name == q.name && - nr_orders > q.nr_orders limit 1 { - println('Non existing customer name: $anon.name') - } + _ := sql db { + select from Customer where id == 12345 && name == q.name && nr_orders > q.nr_orders limit 1 + }! // Insert a new customer nc := Customer{ - name: 'John Doe' + name: 'John Doe' nr_orders: 10 } - db.insert(nc)*/ + sql db { + insert nc into Customer + }! } diff --git a/examples/macos_tray/tray.v b/examples/macos_tray/tray.v index 44e5809f8a..a2becd0f82 100644 --- a/examples/macos_tray/tray.v +++ b/examples/macos_tray/tray.v @@ -1,6 +1,5 @@ -// Simple windows-less application that shows a icon button -// on Mac OS tray. -// +// vtest build: macos +// Simple windows-less application that shows a icon button on Mac OS tray. // Tested on Mac OS Monterey (12.3). module main diff --git a/examples/minimal_c_like_program_using_puts.v b/examples/minimal_c_like_program_using_puts.v index 6a4cb2b02a..aa1712162d 100644 --- a/examples/minimal_c_like_program_using_puts.v +++ b/examples/minimal_c_like_program_using_puts.v @@ -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 // Compile with: diff --git a/examples/pico/pico.v b/examples/pico/pico.v index 2dc64cb360..a921a4490a 100644 --- a/examples/pico/pico.v +++ b/examples/pico/pico.v @@ -1,3 +1,4 @@ +// vtest build: !solaris import json import picoev import picohttpparser diff --git a/examples/pico/raw_callback.v b/examples/pico/raw_callback.v index 5bb4dc878d..da9101f243 100644 --- a/examples/pico/raw_callback.v +++ b/examples/pico/raw_callback.v @@ -1,3 +1,4 @@ +// vtest build: !solaris module main import net diff --git a/examples/smtp/mail.v b/examples/smtp/mail.v index 2adc8b3efa..118e1b2f3c 100644 --- a/examples/smtp/mail.v +++ b/examples/smtp/mail.v @@ -1,3 +1,4 @@ +// vtest build: present_openssl? // Creator: nedimf (07/2020) import os import net.smtp diff --git a/examples/sokol/02_cubes_glsl/cube_glsl.v b/examples/sokol/02_cubes_glsl/cube_glsl.v index 2602e4d9c7..968c46e907 100644 --- a/examples/sokol/02_cubes_glsl/cube_glsl.v +++ b/examples/sokol/02_cubes_glsl/cube_glsl.v @@ -1,3 +1,4 @@ +// vtest build: misc-tooling // needs .h files that are produced by `v shader` /********************************************************************** * * Sokol 3d cube demo diff --git a/examples/sokol/03_march_tracing_glsl/rt_glsl.v b/examples/sokol/03_march_tracing_glsl/rt_glsl.v index 3e1f5adf89..ec557caf1d 100644 --- a/examples/sokol/03_march_tracing_glsl/rt_glsl.v +++ b/examples/sokol/03_march_tracing_glsl/rt_glsl.v @@ -1,3 +1,4 @@ +// vtest build: misc-tooling // needs .h files that are produced by `v shader` /********************************************************************** * * Sokol 3d cube demo diff --git a/examples/sokol/04_multi_shader_glsl/rt_glsl.v b/examples/sokol/04_multi_shader_glsl/rt_glsl.v index 00674cdf83..9e04cf753f 100644 --- a/examples/sokol/04_multi_shader_glsl/rt_glsl.v +++ b/examples/sokol/04_multi_shader_glsl/rt_glsl.v @@ -1,3 +1,4 @@ +// vtest build: misc-tooling // needs .h files that are produced by `v shader` /********************************************************************** * Sokol 3d cube multishader demo * Copyright (c) 2024 Dario Deledda. All rights reserved. diff --git a/examples/sokol/05_instancing_glsl/rt_glsl.v b/examples/sokol/05_instancing_glsl/rt_glsl.v index 0ef53aaf6c..cd5488a420 100644 --- a/examples/sokol/05_instancing_glsl/rt_glsl.v +++ b/examples/sokol/05_instancing_glsl/rt_glsl.v @@ -1,3 +1,4 @@ +// vtest build: misc-tooling // needs .h files that are produced by `v shader` /********************************************************************** * * Sokol 3d cube multishader demo diff --git a/examples/sokol/06_obj_viewer/show_obj.v b/examples/sokol/06_obj_viewer/show_obj.v index 427b610499..d4fdb7d965 100644 --- a/examples/sokol/06_obj_viewer/show_obj.v +++ b/examples/sokol/06_obj_viewer/show_obj.v @@ -1,3 +1,4 @@ +// vtest build: misc-tooling // needs .h files that are produced by `v shader` /********************************************************************** * * .obj viewer diff --git a/examples/sokol/07_simple_shader_glsl/simple_shader.v b/examples/sokol/07_simple_shader_glsl/simple_shader.v index 5e1346a9f6..44e39f5ed3 100644 --- a/examples/sokol/07_simple_shader_glsl/simple_shader.v +++ b/examples/sokol/07_simple_shader_glsl/simple_shader.v @@ -1,5 +1,6 @@ // 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 +// vtest build: misc-tooling // needs .h files that are produced by `v shader` module main // Example shader triangle adapted to V from https://github.com/floooh/sokol-samples/blob/1f2ad36/sapp/triangle-sapp.c diff --git a/examples/sokol/08_sdf/sdf.v b/examples/sokol/08_sdf/sdf.v index bc6cbb4de3..ae74426795 100644 --- a/examples/sokol/08_sdf/sdf.v +++ b/examples/sokol/08_sdf/sdf.v @@ -1,5 +1,6 @@ // 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 +// vtest build: misc-tooling // needs .h files that are produced by `v shader` import sokol.sapp import sokol.gfx diff --git a/examples/sokol/drawing.v b/examples/sokol/drawing.v index 1b61dcd968..a31d2c41dc 100644 --- a/examples/sokol/drawing.v +++ b/examples/sokol/drawing.v @@ -1,3 +1,4 @@ +// vtest build: !solaris import sokol.sapp import sokol.gfx import sokol.sgl diff --git a/examples/sokol/fonts.v b/examples/sokol/fonts.v index ec484c2811..55474ffd57 100644 --- a/examples/sokol/fonts.v +++ b/examples/sokol/fonts.v @@ -1,3 +1,4 @@ +// vtest build: !solaris import sokol.sapp import sokol.gfx import sokol.sgl diff --git a/examples/sokol/sounds/simple_sin_tone_using_audio_push.v b/examples/sokol/sounds/simple_sin_tone_using_audio_push.v index 99b7fe5e31..e1ca357a5e 100644 --- a/examples/sokol/sounds/simple_sin_tone_using_audio_push.v +++ b/examples/sokol/sounds/simple_sin_tone_using_audio_push.v @@ -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 math import time diff --git a/examples/sokol/sounds/simple_sin_tones.v b/examples/sokol/sounds/simple_sin_tones.v index 671cb05e4b..a6754c0936 100644 --- a/examples/sokol/sounds/simple_sin_tones.v +++ b/examples/sokol/sounds/simple_sin_tones.v @@ -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 math import sokol.audio diff --git a/examples/wasm/change_color_by_id/change_color_by_id.wasm.v b/examples/wasm/change_color_by_id/change_color_by_id.wasm.v index 5dd109e9a7..702492ecc7 100644 --- a/examples/wasm/change_color_by_id/change_color_by_id.wasm.v +++ b/examples/wasm/change_color_by_id/change_color_by_id.wasm.v @@ -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) // `main` must be public! diff --git a/examples/wasm/mandelbrot/mandelbrot.wasm.v b/examples/wasm/mandelbrot/mandelbrot.wasm.v index 3390e2788e..bb04735c32 100644 --- a/examples/wasm/mandelbrot/mandelbrot.wasm.v +++ b/examples/wasm/mandelbrot/mandelbrot.wasm.v @@ -1,3 +1,4 @@ +// vtest build: false // requires special compilation flags: `-b wasm -os browser` fn JS.canvas_x() int fn JS.canvas_y() int fn JS.setpixel(x int, y int, c f64) diff --git a/examples/websocket/client-server/client.v b/examples/websocket/client-server/client.v index 5bedc05fad..49fdf37f7f 100644 --- a/examples/websocket/client-server/client.v +++ b/examples/websocket/client-server/client.v @@ -1,3 +1,4 @@ +// vtest build: present_openssl? module main import os diff --git a/examples/websocket/client-server/server.v b/examples/websocket/client-server/server.v index 4bf0fb2dbe..bb6de6c158 100644 --- a/examples/websocket/client-server/server.v +++ b/examples/websocket/client-server/server.v @@ -1,3 +1,4 @@ +// vtest build: present_openssl? module main import net.websocket diff --git a/examples/websocket/ping.v b/examples/websocket/ping.v index 138b3ee3a6..eca823f6e1 100644 --- a/examples/websocket/ping.v +++ b/examples/websocket/ping.v @@ -1,3 +1,4 @@ +// vtest build: present_openssl? module main import time diff --git a/vlib/arrays/parallel/parallel_test.v b/vlib/arrays/parallel/parallel_test.v index a06637a76c..4ac3c3ad99 100644 --- a/vlib/arrays/parallel/parallel_test.v +++ b/vlib/arrays/parallel/parallel_test.v @@ -1,3 +1,4 @@ +// vtest build: !musl? import arrays.parallel import rand import time diff --git a/vlib/builtin/js/array_test.js.v b/vlib/builtin/js/array_test.js.v index 19784ee39d..b7f6b0748f 100644 --- a/vlib/builtin/js/array_test.js.v +++ b/vlib/builtin/js/array_test.js.v @@ -1,5 +1,6 @@ // vtest flaky: true // vtest retry: 3 +// vtest build: present_node? fn test_js() { $if js_node { diff --git a/vlib/builtin/js/int_test.js.v b/vlib/builtin/js/int_test.js.v index 643e0c2c2b..f775228fad 100644 --- a/vlib/builtin/js/int_test.js.v +++ b/vlib/builtin/js/int_test.js.v @@ -1,5 +1,6 @@ // vtest flaky: true // vtest retry: 3 +// vtest build: present_node? const a = 3 const u = u64(1) diff --git a/vlib/builtin/js/map_test.js.v b/vlib/builtin/js/map_test.js.v index e5842be927..dcccfe3494 100644 --- a/vlib/builtin/js/map_test.js.v +++ b/vlib/builtin/js/map_test.js.v @@ -1,5 +1,6 @@ // vtest flaky: true // vtest retry: 3 +// vtest build: present_node? import rand const strings = unique_strings(200, 10) diff --git a/vlib/builtin/js/string_test.js.v b/vlib/builtin/js/string_test.js.v index 3cbe571d82..d4f32a1ab1 100644 --- a/vlib/builtin/js/string_test.js.v +++ b/vlib/builtin/js/string_test.js.v @@ -1,5 +1,6 @@ // vtest flaky: true // vtest retry: 3 +// vtest build: present_node? // import strings diff --git a/vlib/context/cancel_test.v b/vlib/context/cancel_test.v index e4fea68cf2..0c3d45f891 100644 --- a/vlib/context/cancel_test.v +++ b/vlib/context/cancel_test.v @@ -1,5 +1,6 @@ // vtest flaky: true // vtest retry: 3 +// vtest build: amd64 || arm64 import context // This example demonstrates the use of a cancelable context to prevent a diff --git a/vlib/context/deadline_test.v b/vlib/context/deadline_test.v index fd53243a23..4581c73410 100644 --- a/vlib/context/deadline_test.v +++ b/vlib/context/deadline_test.v @@ -1,3 +1,4 @@ +// vtest build: false // TODO: it sometimes blocks, investigate why import context import time diff --git a/vlib/context/empty_test.v b/vlib/context/empty_test.v index b752d66bba..e4a42fdd23 100644 --- a/vlib/context/empty_test.v +++ b/vlib/context/empty_test.v @@ -1,3 +1,4 @@ +// vtest build: amd64 || arm64 module context fn test_background() { diff --git a/vlib/context/onecontext/onecontext_test.v b/vlib/context/onecontext/onecontext_test.v index f7912a1f48..00ca5bd9c6 100644 --- a/vlib/context/onecontext/onecontext_test.v +++ b/vlib/context/onecontext/onecontext_test.v @@ -1,3 +1,4 @@ +// vtest build: false // backtrace_symbols is missing module onecontext import context diff --git a/vlib/context/value_test.v b/vlib/context/value_test.v index 687411a917..fc90fe494a 100644 --- a/vlib/context/value_test.v +++ b/vlib/context/value_test.v @@ -1,3 +1,4 @@ +// vtest build: amd64 || arm64 import context const not_found_value = &Value{ diff --git a/vlib/crypto/ecdsa/ecdsa_test.v b/vlib/crypto/ecdsa/ecdsa_test.v index 4e7e51a72a..227ebb5771 100644 --- a/vlib/crypto/ecdsa/ecdsa_test.v +++ b/vlib/crypto/ecdsa/ecdsa_test.v @@ -1,3 +1,4 @@ +// vtest build: present_openssl? && !(sanitize-memory-clang? || docker-ubuntu-musl?) module ecdsa fn test_ecdsa() { diff --git a/vlib/crypto/ecdsa/example/ecdsa_seed_test.v b/vlib/crypto/ecdsa/example/ecdsa_seed_test.v index 72333e04af..230fc7da75 100644 --- a/vlib/crypto/ecdsa/example/ecdsa_seed_test.v +++ b/vlib/crypto/ecdsa/example/ecdsa_seed_test.v @@ -1,3 +1,4 @@ +// vtest build: present_openssl? && !(sanitize-memory-clang? || docker-ubuntu-musl?) import rand import crypto.ecdsa import encoding.hex diff --git a/vlib/crypto/ecdsa/example/ensure_compatibility_with_net_openssl_test.v b/vlib/crypto/ecdsa/example/ensure_compatibility_with_net_openssl_test.v index 28ef0870b0..a9d16309b2 100644 --- a/vlib/crypto/ecdsa/example/ensure_compatibility_with_net_openssl_test.v +++ b/vlib/crypto/ecdsa/example/ensure_compatibility_with_net_openssl_test.v @@ -1,3 +1,4 @@ +// vtest build: present_openssl? && !(sanitize-memory-clang? || docker-ubuntu-musl?) import net.openssl import crypto.ecdsa diff --git a/vlib/crypto/ecdsa/util_test.v b/vlib/crypto/ecdsa/util_test.v index 5d67d39e6b..f93cd320a1 100644 --- a/vlib/crypto/ecdsa/util_test.v +++ b/vlib/crypto/ecdsa/util_test.v @@ -1,3 +1,4 @@ +// vtest build: present_openssl? && !(sanitize-memory-clang? || docker-ubuntu-musl?) module ecdsa import encoding.hex diff --git a/vlib/db/mysql/mysql_orm_test.v b/vlib/db/mysql/mysql_orm_test.v index 6ef11c0355..2bc199fca7 100644 --- a/vlib/db/mysql/mysql_orm_test.v +++ b/vlib/db/mysql/mysql_orm_test.v @@ -1,3 +1,4 @@ +// vtest build: started_mysqld? import orm import db.mysql import time diff --git a/vlib/db/mysql/mysql_test.v b/vlib/db/mysql/mysql_test.v index 831f9c56f6..b4415b0753 100644 --- a/vlib/db/mysql/mysql_test.v +++ b/vlib/db/mysql/mysql_test.v @@ -1,3 +1,4 @@ +// vtest build: started_mysqld? import db.mysql fn test_mysql() { diff --git a/vlib/db/mysql/prepared_stmt_test.v b/vlib/db/mysql/prepared_stmt_test.v index 24960b607f..4d99f5acbf 100644 --- a/vlib/db/mysql/prepared_stmt_test.v +++ b/vlib/db/mysql/prepared_stmt_test.v @@ -1,3 +1,4 @@ +// vtest build: started_mysqld? import db.mysql fn test_prep() { diff --git a/vlib/db/pg/pg_double_test.v b/vlib/db/pg/pg_double_test.v index 9bb49b90a9..dc2623859e 100644 --- a/vlib/db/pg/pg_double_test.v +++ b/vlib/db/pg/pg_double_test.v @@ -1,3 +1,4 @@ +// vtest build: started_postgres? module main import db.pg diff --git a/vlib/db/pg/pg_orm_test.v b/vlib/db/pg/pg_orm_test.v index eaac68b19c..370213a69f 100644 --- a/vlib/db/pg/pg_orm_test.v +++ b/vlib/db/pg/pg_orm_test.v @@ -1,3 +1,4 @@ +// vtest build: started_postgres? module main import orm diff --git a/vlib/db/pg/pg_test.v b/vlib/db/pg/pg_test.v index 7af4cdd5d3..081d47a4d7 100644 --- a/vlib/db/pg/pg_test.v +++ b/vlib/db/pg/pg_test.v @@ -1,3 +1,4 @@ +// vtest build: started_postgres? module main import db.pg diff --git a/vlib/db/sqlite/parent_child_test.v b/vlib/db/sqlite/parent_child_test.v index d164674704..a86ef7582b 100644 --- a/vlib/db/sqlite/parent_child_test.v +++ b/vlib/db/sqlite/parent_child_test.v @@ -1,3 +1,4 @@ +// vtest build: present_sqlite3? import db.sqlite struct Parent { diff --git a/vlib/db/sqlite/sqlite_comptime_field_test.v b/vlib/db/sqlite/sqlite_comptime_field_test.v index eeb191d07c..40ad635af2 100644 --- a/vlib/db/sqlite/sqlite_comptime_field_test.v +++ b/vlib/db/sqlite/sqlite_comptime_field_test.v @@ -1,3 +1,4 @@ +// vtest build: present_sqlite3? module main import db.sqlite diff --git a/vlib/db/sqlite/sqlite_orm_test.v b/vlib/db/sqlite/sqlite_orm_test.v index 9a063490bb..82e0ee0956 100644 --- a/vlib/db/sqlite/sqlite_orm_test.v +++ b/vlib/db/sqlite/sqlite_orm_test.v @@ -1,3 +1,4 @@ +// vtest build: present_sqlite3? import orm import db.sqlite import time diff --git a/vlib/db/sqlite/sqlite_test.v b/vlib/db/sqlite/sqlite_test.v index 436ce50330..827e3daa1d 100644 --- a/vlib/db/sqlite/sqlite_test.v +++ b/vlib/db/sqlite/sqlite_test.v @@ -1,3 +1,4 @@ +// vtest build: present_sqlite3? import db.sqlite type Connection = sqlite.DB diff --git a/vlib/db/sqlite/sqlite_vfs_lowlevel_test.v b/vlib/db/sqlite/sqlite_vfs_lowlevel_test.v index bb785b1b3b..4bb8988af2 100644 --- a/vlib/db/sqlite/sqlite_vfs_lowlevel_test.v +++ b/vlib/db/sqlite/sqlite_vfs_lowlevel_test.v @@ -1,3 +1,4 @@ +// vtest build: present_sqlite3? import db.sqlite import rand diff --git a/vlib/encoding/iconv/iconv_test.v b/vlib/encoding/iconv/iconv_test.v index f29294487b..ce6d917012 100644 --- a/vlib/encoding/iconv/iconv_test.v +++ b/vlib/encoding/iconv/iconv_test.v @@ -1,3 +1,4 @@ +// vtest build: !docker-ubuntu-musl // needs libiconv to be installed import encoding.iconv import os diff --git a/vlib/gg/draw_fns_api_test.v b/vlib/gg/draw_fns_api_test.v index 1ab2948614..da8d1e33df 100644 --- a/vlib/gg/draw_fns_api_test.v +++ b/vlib/gg/draw_fns_api_test.v @@ -1,3 +1,4 @@ +// vtest build: !musl? import os fn test_all_samples_can_be_compiled() { diff --git a/vlib/net/ftp/ftp_test.v b/vlib/net/ftp/ftp_test.v index bfea567bb3..968f8d991a 100644 --- a/vlib/net/ftp/ftp_test.v +++ b/vlib/net/ftp/ftp_test.v @@ -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 fn test_ftp_client() { diff --git a/vlib/net/http/request_test.v b/vlib/net/http/request_test.v index bfc188da74..77cd3a885f 100644 --- a/vlib/net/http/request_test.v +++ b/vlib/net/http/request_test.v @@ -1,3 +1,4 @@ +// vtest build: !windows module http import io diff --git a/vlib/net/mbedtls/mbedtls_compiles_test.v b/vlib/net/mbedtls/mbedtls_compiles_test.v index 3434ce42f8..3d45974b9e 100644 --- a/vlib/net/mbedtls/mbedtls_compiles_test.v +++ b/vlib/net/mbedtls/mbedtls_compiles_test.v @@ -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 _ fn test_mbedtls_compiles() { diff --git a/vlib/net/openssl/openssl_compiles_test.c.v b/vlib/net/openssl/openssl_compiles_test.c.v index 1284ec15c5..290329c771 100644 --- a/vlib/net/openssl/openssl_compiles_test.c.v +++ b/vlib/net/openssl/openssl_compiles_test.c.v @@ -1,3 +1,4 @@ +// vtest build: present_openssl? import net.openssl as _ struct Abc { diff --git a/vlib/net/smtp/smtp_test.v b/vlib/net/smtp/smtp_test.v index 7ce979a0ef..603a471f99 100644 --- a/vlib/net/smtp/smtp_test.v +++ b/vlib/net/smtp/smtp_test.v @@ -1,3 +1,4 @@ +// vtest build: !windows import os import net.smtp import time diff --git a/vlib/net/ssl/ssl_compiles_test.v b/vlib/net/ssl/ssl_compiles_test.v index c8bce84b6d..493f1d9901 100644 --- a/vlib/net/ssl/ssl_compiles_test.v +++ b/vlib/net/ssl/ssl_compiles_test.v @@ -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 fn test_ssl_compiles() { diff --git a/vlib/net/websocket/websocket_test.v b/vlib/net/websocket/websocket_test.v index bd8496a47f..8211648936 100644 --- a/vlib/net/websocket/websocket_test.v +++ b/vlib/net/websocket/websocket_test.v @@ -1,3 +1,4 @@ +// vtest build: !windows import os import net import net.websocket diff --git a/vlib/orm/orm_test.v b/vlib/orm/orm_test.v index 9c0aca2000..02b6da3046 100644 --- a/vlib/orm/orm_test.v +++ b/vlib/orm/orm_test.v @@ -1,5 +1,6 @@ // vtest flaky: true // vtest retry: 3 +// vtest build: !windows // import db.mysql // import db.pg import time diff --git a/vlib/os/open_and_read_from_file_test.js.v b/vlib/os/open_and_read_from_file_test.js.v index cb72a6bb4d..182b7d0a30 100644 --- a/vlib/os/open_and_read_from_file_test.js.v +++ b/vlib/os/open_and_read_from_file_test.js.v @@ -1,3 +1,4 @@ +// vtest build: present_node? import os fn test_read_from_file() { diff --git a/vlib/rand/rand_test.js.v b/vlib/rand/rand_test.js.v index 8603bbd4a5..675ad8e3b3 100644 --- a/vlib/rand/rand_test.js.v +++ b/vlib/rand/rand_test.js.v @@ -1,3 +1,4 @@ +// vtest build: present_node? import rand fn test_string() { diff --git a/vlib/strings/builder_test.js.v b/vlib/strings/builder_test.js.v index 92fca34acd..7ea01edad8 100644 --- a/vlib/strings/builder_test.js.v +++ b/vlib/strings/builder_test.js.v @@ -1,3 +1,4 @@ +// vtest build: present_node? import strings type MyInt = int diff --git a/vlib/strings/similarity_test.js.v b/vlib/strings/similarity_test.js.v index 965da450cd..cd2046fdf1 100644 --- a/vlib/strings/similarity_test.js.v +++ b/vlib/strings/similarity_test.js.v @@ -1,3 +1,4 @@ +// vtest build: present_node? import strings fn test_levenshtein_distance() { diff --git a/vlib/strings/strings_test.js.v b/vlib/strings/strings_test.js.v index ff5ddf504a..72cf6a98e6 100644 --- a/vlib/strings/strings_test.js.v +++ b/vlib/strings/strings_test.js.v @@ -1,3 +1,4 @@ +// vtest build: present_node? import strings fn test_repeat() { diff --git a/vlib/strings/textscanner/textscanner_test.js.v b/vlib/strings/textscanner/textscanner_test.js.v index ef91b42a44..0ebce6f7b5 100644 --- a/vlib/strings/textscanner/textscanner_test.js.v +++ b/vlib/strings/textscanner/textscanner_test.js.v @@ -1,3 +1,4 @@ +// vtest build: present_node? import strings.textscanner fn test_remaining() { diff --git a/vlib/sync/many_times_test.v b/vlib/sync/many_times_test.v index 7853b551d9..05c39d2560 100644 --- a/vlib/sync/many_times_test.v +++ b/vlib/sync/many_times_test.v @@ -1,3 +1,4 @@ +// vtest build: !windows && (amd64 || arm64) import sync struct Counter { diff --git a/vlib/sync/once_test.v b/vlib/sync/once_test.v index 62bf3aa30e..6299ed50d3 100644 --- a/vlib/sync/once_test.v +++ b/vlib/sync/once_test.v @@ -1,3 +1,4 @@ +// vtest build: !windows && (amd64 || arm64) import sync struct One { diff --git a/vlib/v/compiler_errors_test.v b/vlib/v/compiler_errors_test.v index ef0d7d4918..8614564413 100644 --- a/vlib/v/compiler_errors_test.v +++ b/vlib/v/compiler_errors_test.v @@ -1,3 +1,4 @@ +// vtest build: !self_sandboxed_packaging? import os import term import v.util.diff diff --git a/vlib/v/embed_file/tests/embed_file_test.v b/vlib/v/embed_file/tests/embed_file_test.v index 5dc121dfef..dd4c8e5fcf 100644 --- a/vlib/v/embed_file/tests/embed_file_test.v +++ b/vlib/v/embed_file/tests/embed_file_test.v @@ -1,4 +1,5 @@ const const_file = $embed_file('v.png') +// vtest build: !self_werror? const src = $embed_file('embed_file_test.v').to_string() diff --git a/vlib/v/gen/c/coutput_test.v b/vlib/v/gen/c/coutput_test.v index ed9907a3a1..5136ad01b9 100644 --- a/vlib/v/gen/c/coutput_test.v +++ b/vlib/v/gen/c/coutput_test.v @@ -1,3 +1,4 @@ +// vtest build: !self_sandboxed_packaging? import os import time import term diff --git a/vlib/v/gen/golang/tests/golang_test.v b/vlib/v/gen/golang/tests/golang_test.v index 9a8a1dcac9..c3964bb513 100644 --- a/vlib/v/gen/golang/tests/golang_test.v +++ b/vlib/v/gen/golang/tests/golang_test.v @@ -1,3 +1,4 @@ +// vtest build: present_go? import os import benchmark import term diff --git a/vlib/v/gen/native/tests/native_test.v b/vlib/v/gen/native/tests/native_test.v index f10ff80701..41905bf66f 100644 --- a/vlib/v/gen/native/tests/native_test.v +++ b/vlib/v/gen/native/tests/native_test.v @@ -1,3 +1,4 @@ +// vtest build: (amd64 || arm64) && !self_sandboxed_packaging? import os import time import benchmark diff --git a/vlib/v/slow_tests/assembly/asm_test.amd64.v b/vlib/v/slow_tests/assembly/asm_test.amd64.v index 02520e68bb..748984ef70 100644 --- a/vlib/v/slow_tests/assembly/asm_test.amd64.v +++ b/vlib/v/slow_tests/assembly/asm_test.amd64.v @@ -1,3 +1,4 @@ +// vtest build: !msvc import v.slow_tests.assembly.util fn test_inline_asm() { diff --git a/vlib/v/slow_tests/assembly/asm_test.i386.v b/vlib/v/slow_tests/assembly/asm_test.i386.v index 61f93bfc31..a715bb801b 100644 --- a/vlib/v/slow_tests/assembly/asm_test.i386.v +++ b/vlib/v/slow_tests/assembly/asm_test.i386.v @@ -1,3 +1,4 @@ +// vtest build: !msvc import v.tests.assembly.util fn test_inline_asm() { diff --git a/vlib/v/slow_tests/inout/compiler_test.v b/vlib/v/slow_tests/inout/compiler_test.v index d96b588ee2..aece072a35 100644 --- a/vlib/v/slow_tests/inout/compiler_test.v +++ b/vlib/v/slow_tests/inout/compiler_test.v @@ -1,3 +1,4 @@ +// vtest build: !self_sandboxed_packaging? // .out file: // To test a panic, remove everything after the long `===` line // You can also remove the line with 'line:' e.g. for a builtin fn diff --git a/vlib/v/slow_tests/profile/profile_test.v b/vlib/v/slow_tests/profile/profile_test.v index d327e6fb7f..3b9c228f80 100644 --- a/vlib/v/slow_tests/profile/profile_test.v +++ b/vlib/v/slow_tests/profile/profile_test.v @@ -1,3 +1,4 @@ +// vtest build: !musl? import os import time diff --git a/vlib/v/tests/c_struct_with_reserved_field_name_test.v b/vlib/v/tests/c_struct_with_reserved_field_name_test.v index 814a786292..9c3facea15 100644 --- a/vlib/v/tests/c_struct_with_reserved_field_name_test.v +++ b/vlib/v/tests/c_struct_with_reserved_field_name_test.v @@ -1,3 +1,4 @@ +// vtest build: !musl? import gg import gx diff --git a/vlib/v/tests/casts/cast_test.js.v b/vlib/v/tests/casts/cast_test.js.v index 3a0e2a5607..fcb0ad88ee 100644 --- a/vlib/v/tests/casts/cast_test.js.v +++ b/vlib/v/tests/casts/cast_test.js.v @@ -1,3 +1,4 @@ +// vtest build: present_node? fn JS.Math.pow(JS.Number, JS.Number) JS.Number fn test_js_prim_cast() { diff --git a/vlib/v/tests/consts/const_and_global_with_same_name_test.v b/vlib/v/tests/consts/const_and_global_with_same_name_test.v index ccade3f4b5..3dda631d4d 100644 --- a/vlib/v/tests/consts/const_and_global_with_same_name_test.v +++ b/vlib/v/tests/consts/const_and_global_with_same_name_test.v @@ -1,3 +1,4 @@ +// vtest build: !msvc // error C2099: initializer is not a constant @[has_globals] module main diff --git a/vlib/v/tests/consts/const_comptime_eval_before_vinit_test.v b/vlib/v/tests/consts/const_comptime_eval_before_vinit_test.v index 780e145944..6f17b50e90 100644 --- a/vlib/v/tests/consts/const_comptime_eval_before_vinit_test.v +++ b/vlib/v/tests/consts/const_comptime_eval_before_vinit_test.v @@ -1,3 +1,4 @@ +// vtest build: !msvc // _constructor used // 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. const zzz_an_i8_const = i8(0x28) diff --git a/vlib/v/tests/consts/const_fixed_array_containing_references_to_itself_test.v b/vlib/v/tests/consts/const_fixed_array_containing_references_to_itself_test.v index 18d7566572..12692692ef 100644 --- a/vlib/v/tests/consts/const_fixed_array_containing_references_to_itself_test.v +++ b/vlib/v/tests/consts/const_fixed_array_containing_references_to_itself_test.v @@ -1,3 +1,4 @@ +// vtest build: !msvc // error C2099: initializer is not a constant struct Abc { prev &Abc = unsafe { nil } } diff --git a/vlib/v/tests/fns/closure_test.v b/vlib/v/tests/fns/closure_test.v index d5d75b0c09..2278c0eb35 100644 --- a/vlib/v/tests/fns/closure_test.v +++ b/vlib/v/tests/fns/closure_test.v @@ -1,3 +1,4 @@ +// vtest build: amd64 || arm64 // closures aren't implemented yet fn test_decl_assignment() { my_var := 12 c1 := fn [my_var] () int { diff --git a/vlib/v/tests/fns/fn_literal_type_test.v b/vlib/v/tests/fns/fn_literal_type_test.v index 10a9c09347..55cec49d3e 100644 --- a/vlib/v/tests/fns/fn_literal_type_test.v +++ b/vlib/v/tests/fns/fn_literal_type_test.v @@ -1,3 +1,4 @@ +// vtest build: !windows import db.sqlite @[table: 'Users'] diff --git a/vlib/v/tests/interop_test.js.v b/vlib/v/tests/interop_test.js.v index 6530b361cd..7372c27583 100644 --- a/vlib/v/tests/interop_test.js.v +++ b/vlib/v/tests/interop_test.js.v @@ -1,3 +1,4 @@ +// vtest build: present_node? // Not real external functions, so we won't call them // We just want to make sure they compile diff --git a/vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v b/vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v index 036f756a1a..72f0aa6b6b 100644 --- a/vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v +++ b/vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v @@ -1,3 +1,4 @@ +// vtest build: present_sqlite3? import db.sqlite struct User { diff --git a/vlib/v/tests/orm_joined_tables_select_test.v b/vlib/v/tests/orm_joined_tables_select_test.v index 0ab446178f..0c3612c4f5 100644 --- a/vlib/v/tests/orm_joined_tables_select_test.v +++ b/vlib/v/tests/orm_joined_tables_select_test.v @@ -1,3 +1,4 @@ +// vtest build: present_sqlite3? import db.sqlite struct VieterDb { diff --git a/vlib/v/tests/orm_sub_struct_test.v b/vlib/v/tests/orm_sub_struct_test.v index 0b0769e0c8..2847e64f2e 100644 --- a/vlib/v/tests/orm_sub_struct_test.v +++ b/vlib/v/tests/orm_sub_struct_test.v @@ -1,3 +1,4 @@ +// vtest build: present_sqlite3? import db.sqlite struct Upper { diff --git a/vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v b/vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v index 13a341f8e2..69b8469089 100644 --- a/vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v +++ b/vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v @@ -1,3 +1,4 @@ +// vtest build: !(windows && tinyc|| msvc) // TODO module main #flag @VMODROOT/implementation.o diff --git a/vlib/v/tests/skip_unused/gg_code.vv b/vlib/v/tests/skip_unused/gg_code.vv index 6d32bc0214..89e93e7827 100644 --- a/vlib/v/tests/skip_unused/gg_code.vv +++ b/vlib/v/tests/skip_unused/gg_code.vv @@ -1,3 +1,4 @@ +// vtest build: !musl? module main import gg diff --git a/vlib/v/tests/sumtypes/sumtype_as_cast_1_test.v b/vlib/v/tests/sumtypes/sumtype_as_cast_1_test.v index a0a7569111..ed6c20f64d 100644 --- a/vlib/v/tests/sumtypes/sumtype_as_cast_1_test.v +++ b/vlib/v/tests/sumtypes/sumtype_as_cast_1_test.v @@ -1,3 +1,4 @@ +// vtest build: !msvc // error: cannot support compound statement expression ({expr; expr; expr;}) type Sum = int | string struct Count { diff --git a/vlib/v/tests/sumtypes/sumtype_as_cast_2_test.v b/vlib/v/tests/sumtypes/sumtype_as_cast_2_test.v index de002006d6..374eff9240 100644 --- a/vlib/v/tests/sumtypes/sumtype_as_cast_2_test.v +++ b/vlib/v/tests/sumtypes/sumtype_as_cast_2_test.v @@ -1,3 +1,4 @@ +// vtest build: !msvc // error: cannot support compound statement expression ({expr; expr; expr;}) type Numbers = int | string struct Values { diff --git a/vlib/v/tests/websocket_logger_interface_should_compile_test.v b/vlib/v/tests/websocket_logger_interface_should_compile_test.v index 8ae90654eb..5658e45086 100644 --- a/vlib/v/tests/websocket_logger_interface_should_compile_test.v +++ b/vlib/v/tests/websocket_logger_interface_should_compile_test.v @@ -1,3 +1,4 @@ +// vtest build: !windows && present_openssl? import net.websocket as ws pub type RawMessage = ws.Message diff --git a/vlib/veb/tests/veb_app_test.v b/vlib/veb/tests/veb_app_test.v index ca9b76c04b..12d265c424 100644 --- a/vlib/veb/tests/veb_app_test.v +++ b/vlib/veb/tests/veb_app_test.v @@ -1,3 +1,4 @@ +// vtest build: present_sqlite3? // imports db.sqlite import veb import time import db.sqlite diff --git a/vlib/vweb/route_test.v b/vlib/vweb/route_test.v index 00b68988d4..1ad4fc3db6 100644 --- a/vlib/vweb/route_test.v +++ b/vlib/vweb/route_test.v @@ -1,3 +1,4 @@ +// vtest build: !windows module vweb struct RoutePair { diff --git a/vlib/vweb/tests/vweb_test.v b/vlib/vweb/tests/vweb_test.v index bdb05d9a36..fc40cebbfb 100644 --- a/vlib/vweb/tests/vweb_test.v +++ b/vlib/vweb/tests/vweb_test.v @@ -1,3 +1,4 @@ +// vtest build: !windows import io import json import time diff --git a/vlib/vweb/vweb_app_test.v b/vlib/vweb/vweb_app_test.v index 41e7c0da68..432dabf4fb 100644 --- a/vlib/vweb/vweb_app_test.v +++ b/vlib/vweb/vweb_app_test.v @@ -1,3 +1,4 @@ +// vtest build: present_sqlite3? // imports db.sqlite module main import vweb diff --git a/vlib/x/ttf/ttf_test.v b/vlib/x/ttf/ttf_test.v index 4f5c4f36f9..bc330f4d74 100644 --- a/vlib/x/ttf/ttf_test.v +++ b/vlib/x/ttf/ttf_test.v @@ -1,3 +1,4 @@ +// vtest build: !docker-ubuntu-musl import x.ttf import os import strings