From 27e6fefc5f1acbb936bee71d9abd2c1a007587a7 Mon Sep 17 00:00:00 2001 From: gym603 Date: Wed, 21 Feb 2024 18:50:46 +0800 Subject: [PATCH] tests: fix `init_global_test.v` failing occasionally (#20879) --- vlib/v/tests/init_global_test.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/tests/init_global_test.v b/vlib/v/tests/init_global_test.v index 4e623515e83365..bbdb0eb1d9a59d 100644 --- a/vlib/v/tests/init_global_test.v +++ b/vlib/v/tests/init_global_test.v @@ -154,6 +154,7 @@ fn test_global_shared_map() { fn switch2() u64 { mut cnt := u64(0) for { + cnt++ mtx.@lock() f1, f2 = f2, f1 if f1 == 17.0 || f2 == 17.0 { @@ -161,7 +162,6 @@ fn switch2() u64 { return cnt } mtx.unlock() - cnt++ } return 0 } @@ -185,6 +185,6 @@ fn test_global_mutex() { assert (f1 == 17.0 && f2 == 34.0625) || (f1 == 34.0625 && f2 == 17.0) mtx.runlock() n := t.wait() - eprintln('> n: ${n} | f1: ${f1} | ${f2}: ${f2}') + eprintln('> n: ${n} | f1: ${f1} | f2: ${f2}') assert n > 0 }