From d61fbe874cf6995c981b3182f120c0de55a91f61 Mon Sep 17 00:00:00 2001 From: Kim Shrier Date: Tue, 28 Apr 2026 15:56:59 -0600 Subject: [PATCH] vdoc: fix flaky location of output path in vdoc_file_test.v (#27020) --- cmd/tools/vdoc/vdoc_file_test.v | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/tools/vdoc/vdoc_file_test.v b/cmd/tools/vdoc/vdoc_file_test.v index a6861f65c..af12d1966 100644 --- a/cmd/tools/vdoc/vdoc_file_test.v +++ b/cmd/tools/vdoc/vdoc_file_test.v @@ -72,6 +72,9 @@ fn test_out_path() { test_path := os.join_path(os.vtmp_dir(), 'vdoc_test_${rand.ulid()}') test_mod_path := os.join_path(test_path, small_pure_v_vlib_module) os.mkdir_all(test_path)! + // Sentinel v.mod so that vdoc's get_parent_mod() stops climbing here instead of + // picking up stray .v files in ancestor tmp dirs (e.g. /private/tmp on macOS). + os.write_file(os.join_path(test_path, 'v.mod'), "Module { name: 'vdoc_test' }\n")! defer { os.chdir(vroot) or {} os.rmdir_all(test_path) or {} @@ -82,7 +85,7 @@ fn test_out_path() { // Relative input with default output path. os.execute_opt('${vexe} doc -f html -m ${small_pure_v_vlib_module}')! - output_path := os.join_path(mod_path, '_docs', '${small_pure_v_vlib_module}.html') + output_path := os.join_path(test_mod_path, '_docs', '${small_pure_v_vlib_module}.html') assert os.exists(output_path), output_path // Custom out path (no `_docs` subdir). -- 2.39.5