From f0b8927e9e1b72076158b18881f388accf1de680 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 9 May 2026 00:07:31 +0300 Subject: [PATCH] os: fix process_args_test.v on macos --- vlib/os/process_args_test.v | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/vlib/os/process_args_test.v b/vlib/os/process_args_test.v index 290f7a38b..c4ff160ab 100644 --- a/vlib/os/process_args_test.v +++ b/vlib/os/process_args_test.v @@ -3,12 +3,25 @@ import os const vexe = os.getenv('VEXE') const vroot = os.dir(vexe) +// strip_tcc_fallback_warning removes the noisy macOS-only `warning: tcc compilation +// failed, falling back to cc` line that v emits to stderr and that os.execute folds +// into the captured output. The CI path-with-spaces+comma jobs trigger this fallback, +// which would otherwise prefix the program output and break starts_with assertions. +fn strip_tcc_fallback_warning(output string) string { + mut s := output + for s.contains('tcc compilation failed') { + nl := s.index('\n') or { return s } + s = s[nl + 1..] + } + return s +} + fn test_v_run_simple() { echo_os_args := os.join_path(vroot, 'cmd/tools/test_os_args.v') res123 := os.execute('${os.quoted_path(vexe)} run ${os.quoted_path(echo_os_args)} 1 2 3') println(res123) assert res123.exit_code == 0 - assert res123.output.starts_with("['1', '2', '3']") + assert strip_tcc_fallback_warning(res123.output).starts_with("['1', '2', '3']") } fn test_v_run_quoted_args_with_spaces() { @@ -16,7 +29,7 @@ fn test_v_run_quoted_args_with_spaces() { res := os.execute('${os.quoted_path(vexe)} run ${os.quoted_path(echo_os_args)} 1 "Learn V" 3') println(res) assert res.exit_code == 0 - assert res.output.starts_with("['1', 'Learn V', '3']") + assert strip_tcc_fallback_warning(res.output).starts_with("['1', 'Learn V', '3']") } fn test_v_run_quoted_args_with_spaces__use_os_system_to_run() { @@ -25,7 +38,7 @@ fn test_v_run_quoted_args_with_spaces__use_os_system_to_run() { os.execute('${os.quoted_path(vexe)} -use-os-system-to-run run ${os.quoted_path(echo_os_args)} 1 "Learn V" 3') println(res) assert res.exit_code == 0 - assert res.output.starts_with("['1', 'Learn V', '3']") + assert strip_tcc_fallback_warning(res.output).starts_with("['1', 'Learn V', '3']") } fn test_v_run_file_from_path_with_spaces() { @@ -42,5 +55,5 @@ fn test_v_run_file_from_path_with_spaces() { os.execute('${os.quoted_path(vexe)} run ${os.quoted_path(spaced_echo_os_args)} 1 "Learn V" 3') println(res) assert res.exit_code == 0 - assert res.output.starts_with("['1', 'Learn V', '3']") + assert strip_tcc_fallback_warning(res.output).starts_with("['1', 'Learn V', '3']") } -- 2.39.5