From 30b1e67271da9b16de476250d6c709ce824c11e3 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 19 Jun 2026 09:12:29 +0300 Subject: [PATCH] ci: fix master test failures --- cmd/tools/modules/testing/common.v | 68 ++++++++++++++++++++--- cmd/tools/vast/vast.v | 4 +- cmd/tools/vtest-self.v | 1 + vlib/context/onecontext/onecontext_test.v | 2 +- vlib/net/http/server_tls_test.v | 4 ++ vlib/net/mbedtls/mbedtls.c.v | 1 + vlib/net/mbedtls/mbedtls_threading.h | 3 + 7 files changed, 71 insertions(+), 12 deletions(-) diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index d084746ad..b909fcdf8 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -145,6 +145,8 @@ pub mut: 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 +mut: + benchmark_mu &sync.Mutex = sync.new_mutex() } pub fn (mut ts TestSession) add_failed_cmd(cmd string) { @@ -153,6 +155,54 @@ pub fn (mut ts TestSession) add_failed_cmd(cmd string) { } } +fn (mut ts TestSession) benchmark_step() { + ts.benchmark_mu.lock() + defer { + ts.benchmark_mu.unlock() + } + ts.benchmark.step() +} + +fn (mut ts TestSession) benchmark_step_restart() { + ts.benchmark_mu.lock() + defer { + ts.benchmark_mu.unlock() + } + ts.benchmark.step_restart() +} + +fn (mut ts TestSession) benchmark_fail() { + ts.benchmark_mu.lock() + defer { + ts.benchmark_mu.unlock() + } + ts.benchmark.fail() +} + +fn (mut ts TestSession) benchmark_ok() { + ts.benchmark_mu.lock() + defer { + ts.benchmark_mu.unlock() + } + ts.benchmark.ok() +} + +fn (mut ts TestSession) benchmark_skip() { + ts.benchmark_mu.lock() + defer { + ts.benchmark_mu.unlock() + } + ts.benchmark.skip() +} + +fn (mut ts TestSession) benchmark_stop() { + ts.benchmark_mu.lock() + defer { + ts.benchmark_mu.unlock() + } + ts.benchmark.stop() +} + pub fn (mut ts TestSession) show_list_of_failed_tests() { rlock ts.failed_cmds { ts.reporter.list_of_failed_commands(ts.failed_cmds) @@ -460,7 +510,7 @@ pub fn (mut ts TestSession) test() { // all the testing happens here: pool_of_test_runners.work_on_pointers(unsafe { remaining_files.pointers() }) - ts.benchmark.stop() + ts.benchmark_stop() ts.append_message(.sentinel, '', MessageThreadContext{ flow_id: '-1' }) // send the sentinel printing_thread.wait() ts.reporter.worker_threads_finish(mut ts) @@ -602,7 +652,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { if !os.is_executable(v2_bin) { ts.append_message(.info, 'SKIP ${relative_file}: v2 binary not built. Run: ${os.quoted_path(ts.vexe)} -o ${os.quoted_path(v2_bin)} ${os.quoted_path(os.join_path(ts.vroot, 'cmd', 'v2', 'v2.v'))}', mtc) - ts.benchmark.skip() + ts.benchmark_skip() tls_bench.skip() return pool.no_result } @@ -633,10 +683,10 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { } } - ts.benchmark.step() + ts.benchmark_step() tls_bench.step() if produces_file_output && !ts.build_tools && (!should_be_built || abs_path in ts.skip_files) { - ts.benchmark.skip() + ts.benchmark_skip() tls_bench.skip() if !hide_skips { ts.append_message(.skip, tls_bench.step_message_with_label_and_duration(benchmark.b_skip, @@ -700,7 +750,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { if res.output.contains(': error: ') { ts.append_message(.cannot_compile, 'Cannot compile file ${file}', mtc) } - ts.benchmark.fail() + ts.benchmark_fail() tls_bench.fail() ts.add_failed_cmd(reproduce_cmd) return pool.no_result @@ -723,7 +773,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { } ts.append_message_with_duration(.compile_end, compile_r.output, compile_cmd_duration, mtc) if compile_r.exit_code != 0 { - ts.benchmark.fail() + ts.benchmark_fail() tls_bench.fail() ts.append_message_with_duration(.fail, tls_bench.step_message_with_label_and_duration(benchmark.b_fail, '${normalised_relative_file}\n>> compilation failed:\n${compile_r.output}', @@ -734,7 +784,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { return pool.no_result } tls_bench.step_restart() - ts.benchmark.step_restart() + ts.benchmark_step_restart() if ts.exec_mode == .compile { unsafe { goto test_passed_execute @@ -800,7 +850,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { goto test_passed_execute } } - ts.benchmark.fail() + ts.benchmark_fail() tls_bench.fail() cmd_duration = d_cmd.elapsed() - (fail_retry_delay_ms * details.retry) ts.append_message_with_duration(.fail, tls_bench.step_message_with_label_and_duration(benchmark.b_fail, @@ -813,7 +863,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { } test_passed_system: test_passed_execute: - ts.benchmark.ok() + ts.benchmark_ok() tls_bench.ok() if !hide_oks { ts.append_message_with_duration(.ok, tls_bench.step_message_with_label_and_duration(benchmark.b_ok, diff --git a/cmd/tools/vast/vast.v b/cmd/tools/vast/vast.v index dedb941a4..abf4076fe 100644 --- a/cmd/tools/vast/vast.v +++ b/cmd/tools/vast/vast.v @@ -577,8 +577,8 @@ fn (t Tree) const_field(node ast.ConstField) &Node { fn (t Tree) comptime_expr_value(node ast.ComptTimeConstValue) &Node { match node { - ast.EmptyExpr { - return t.empty_expr(node) + ast.EmptyComptimeConstValue { + return t.empty_expr(ast.EmptyExpr{}) } string { return t.string_node(node) diff --git a/cmd/tools/vtest-self.v b/cmd/tools/vtest-self.v index 513aa2666..dde61d6be 100644 --- a/cmd/tools/vtest-self.v +++ b/cmd/tools/vtest-self.v @@ -107,6 +107,7 @@ const skip_with_fsanitize_memory = [ 'vlib/net/http/status_test.v', 'vlib/net/http/header_test.v', 'vlib/net/http/server_test.v', + 'vlib/net/http/transport_test.v', // mbedtls TLS 1.3 handshake trips MSan in thirdparty bignum code 'vlib/net/mbedtls/mbedtls_head_with_content_length_test.v', 'vlib/net/ssl/ssl_read_all_test.v', 'vlib/net/udp_test.v', diff --git a/vlib/context/onecontext/onecontext_test.v b/vlib/context/onecontext/onecontext_test.v index f7912a1f4..085de0345 100644 --- a/vlib/context/onecontext/onecontext_test.v +++ b/vlib/context/onecontext/onecontext_test.v @@ -125,7 +125,7 @@ fn test_merge_deadline_context_n() { for i in 0 .. 10 { ctxs << context.background() } - mut ctx_n, _ := context.with_timeout(mut background, time.second) + mut ctx_n, _ := context.with_timeout(mut background, 10 * time.second) ctxs << ctx_n for i in 0 .. 10 { diff --git a/vlib/net/http/server_tls_test.v b/vlib/net/http/server_tls_test.v index c40522f77..3e6fbd8db 100644 --- a/vlib/net/http/server_tls_test.v +++ b/vlib/net/http/server_tls_test.v @@ -32,6 +32,10 @@ struct BlockingHandler { release chan bool } +fn testsuite_end() { + http.close_idle_connections() +} + fn (mut h BlockingHandler) handle(req http.Request) http.Response { h.started <- true _ := <-h.release diff --git a/vlib/net/mbedtls/mbedtls.c.v b/vlib/net/mbedtls/mbedtls.c.v index 6647327a8..2aa15083d 100644 --- a/vlib/net/mbedtls/mbedtls.c.v +++ b/vlib/net/mbedtls/mbedtls.c.v @@ -2,6 +2,7 @@ module mbedtls #flag -I @VEXEROOT/thirdparty/mbedtls/library #flag -I @VEXEROOT/thirdparty/mbedtls/include +#flag windows -DWIN32_LEAN_AND_MEAN // #flag -D _FILE_OFFSET_BITS=64 #flag -I @VEXEROOT/thirdparty/mbedtls/3rdparty/everest/include #flag -I @VEXEROOT/thirdparty/mbedtls/3rdparty/everest/include/everest diff --git a/vlib/net/mbedtls/mbedtls_threading.h b/vlib/net/mbedtls/mbedtls_threading.h index a690842e2..3ed8ca390 100644 --- a/vlib/net/mbedtls/mbedtls_threading.h +++ b/vlib/net/mbedtls/mbedtls_threading.h @@ -16,6 +16,9 @@ #if defined(_WIN32) && defined(MBEDTLS_THREADING_ALT) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif #include #include #include -- 2.39.5