diff --git a/cmd/tools/check_os_api_parity.v b/cmd/tools/check_os_api_parity.v index 9eb73a08f9..4980dde63e 100644 --- a/cmd/tools/check_os_api_parity.v +++ b/cmd/tools/check_os_api_parity.v @@ -5,6 +5,7 @@ import v.util import v.pref import v.builder import v.ast +import rand import term const ( @@ -116,7 +117,7 @@ fn (app App) gen_api_for_module_in_os(mod_name string, os_name string) string { } fn (mut app App) compare_api(api_base string, api_os string, mod_name string, os_base string, os_target string) { - res := util.color_compare_strings(app.diff_cmd, api_base, api_os) + res := util.color_compare_strings(app.diff_cmd, rand.ulid(), api_base, api_os) if res.len > 0 { summary := 'Different APIs found for module: `$mod_name`, between OS base: `$os_base` and OS: `$os_target`' eprintln(term.header(summary, '-')) diff --git a/cmd/tools/vvet/vet_test.v b/cmd/tools/vvet/vet_test.v index b4e292fa33..9bb6443950 100644 --- a/cmd/tools/vvet/vet_test.v +++ b/cmd/tools/vvet/vet_test.v @@ -1,4 +1,5 @@ import os +import rand import term import v.util.vtest import v.util @@ -51,7 +52,7 @@ fn check_path(vexe string, dir string, tests []string) int { println(found) println('============\n') println('diff:') - println(util.color_compare_strings(diff_cmd, found, expected)) + println(util.color_compare_strings(diff_cmd, rand.ulid(), found, expected)) println('============\n') nb_fail++ } else { diff --git a/vlib/os/os_c.v b/vlib/os/os_c.v index 5c4e2cc77c..7fe3503d0d 100644 --- a/vlib/os/os_c.v +++ b/vlib/os/os_c.v @@ -536,7 +536,7 @@ pub fn on_segfault(f voidptr) { return } $if macos { - C.printf('TODO') + C.printf(c'TODO') /* mut sa := C.sigaction{} C.memset(&sa, 0, sizeof(C.sigaction_size)) diff --git a/vlib/v/compiler_errors_test.v b/vlib/v/compiler_errors_test.v index 7e9bd3665a..16f42d83b9 100644 --- a/vlib/v/compiler_errors_test.v +++ b/vlib/v/compiler_errors_test.v @@ -1,4 +1,5 @@ import os +import rand import term import v.util import v.util.vtest @@ -315,7 +316,7 @@ fn clean_line_endings(s string) string { fn diff_content(s1 string, s2 string) { diff_cmd := util.find_working_diff_command() or { return } println(term.bold(term.yellow('diff: '))) - println(util.color_compare_strings(diff_cmd, s1, s2)) + println(util.color_compare_strings(diff_cmd, rand.ulid(), s1, s2)) println('============\n') } diff --git a/vlib/v/tests/inout/compiler_test.v b/vlib/v/tests/inout/compiler_test.v index 7545db39ea..1cd0f5f4a1 100644 --- a/vlib/v/tests/inout/compiler_test.v +++ b/vlib/v/tests/inout/compiler_test.v @@ -2,6 +2,7 @@ // To test a panic, remove everything after the long `===` line // You can also remove the line with 'line:' e.g. for a builtin fn import os +import rand import term import v.util import v.util.vtest @@ -77,7 +78,7 @@ fn test_all() { println(found) if diff_cmd != '' { println(term.header('difference:', '-')) - println(util.color_compare_strings(diff_cmd, expected, found)) + println(util.color_compare_strings(diff_cmd, rand.ulid(), expected, found)) } else { println(term.h_divider('-')) } diff --git a/vlib/v/util/diff.v b/vlib/v/util/diff.v index 167f3c2c1f..b3e2c6f509 100644 --- a/vlib/v/util/diff.v +++ b/vlib/v/util/diff.v @@ -68,11 +68,11 @@ pub fn color_compare_files(diff_cmd string, file1 string, file2 string) string { return '' } -pub fn color_compare_strings(diff_cmd string, expected string, found string) string { +pub fn color_compare_strings(diff_cmd string, unique_prefix string, expected string, found string) string { cdir := os.cache_dir() ctime := time.sys_mono_now() - e_file := os.join_path(cdir, '${ctime}.expected.txt') - f_file := os.join_path(cdir, '${ctime}.found.txt') + e_file := os.join_path(cdir, '${unique_prefix}_${ctime}.expected.txt') + f_file := os.join_path(cdir, '${unique_prefix}_${ctime}.found.txt') os.write_file(e_file, expected) or { panic(err) } os.write_file(f_file, found) or { panic(err) } res := color_compare_files(diff_cmd, e_file, f_file)