fmt: remove the prefixed module name of const names, that are in the same module (related #22183) (#22185)

This commit is contained in:
yuyi 2024-09-10 16:25:56 +08:00 committed by GitHub
parent 234fb8e2b0
commit 008aaad999
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
284 changed files with 2539 additions and 2572 deletions

View file

@ -258,13 +258,13 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
skip_files << 'examples/pendulum-simulation/parallel.v'
skip_files << 'examples/pendulum-simulation/parallel_with_iw.v'
skip_files << 'examples/pendulum-simulation/sequential.v'
if testing.github_job == 'tcc' {
if github_job == 'tcc' {
// TODO: fix these by adding declarations for the missing functions in the prebuilt tcc
skip_files << 'vlib/net/mbedtls/mbedtls_compiles_test.v'
skip_files << 'vlib/net/ssl/ssl_compiles_test.v'
}
}
if testing.runner_os != 'Linux' || testing.github_job != 'tcc' {
if runner_os != 'Linux' || github_job != 'tcc' {
if !os.exists('/usr/local/include/wkhtmltox/pdf.h') {
skip_files << 'examples/c_interop_wkhtmltopdf.v' // needs installation of wkhtmltopdf from https://github.com/wkhtmltopdf/packaging/releases
}
@ -275,16 +275,16 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
$if !macos {
skip_files << 'examples/macos_tray/tray.v'
}
if testing.github_job == 'ubuntu-docker-musl' {
if github_job == 'ubuntu-docker-musl' {
skip_files << 'vlib/net/openssl/openssl_compiles_test.c.v'
skip_files << 'vlib/x/ttf/ttf_test.v'
}
if testing.github_job == 'tests-sanitize-memory-clang' {
if github_job == 'tests-sanitize-memory-clang' {
skip_files << 'vlib/net/openssl/openssl_compiles_test.c.v'
// Fails compilation with: `/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line`
skip_files << 'examples/sokol/sounds/simple_sin_tones.v'
}
if testing.github_job != 'misc-tooling' {
if github_job != 'misc-tooling' {
// These examples need .h files that are produced from the supplied .glsl files,
// using by the shader compiler tools in https://github.com/floooh/sokol-tools-bin/archive/pre-feb2021-api-changes.tar.gz
skip_files << 'examples/sokol/02_cubes_glsl/cube_glsl.v'
@ -313,7 +313,7 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
vexe: vexe
vroot: vroot
skip_files: skip_files
fail_fast: testing.fail_fast
fail_fast: fail_fast
show_stats: '-stats' in vargs.split(' ')
show_asserts: '-show-asserts' in vargs.split(' ')
vargs: vargs
@ -396,14 +396,14 @@ pub fn (mut ts TestSession) test() {
// Special case for android_outside_termux because of its
// underscores
if file.ends_with('_android_outside_termux_test.v') {
if !testing.host_os.is_target_of('android_outside_termux') {
if !host_os.is_target_of('android_outside_termux') {
remaining_files << dot_relative_file
ts.skip_files << file
continue
}
}
os_target := file.all_before_last('_test.v').all_after_last('_')
if !testing.host_os.is_target_of(os_target) {
if !host_os.is_target_of(os_target) {
remaining_files << dot_relative_file
ts.skip_files << file
continue
@ -553,7 +553,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
if !ts.build_tools && abs_path in ts.skip_files {
ts.benchmark.skip()
tls_bench.skip()
if !testing.hide_skips {
if !hide_skips {
ts.append_message(.skip, tls_bench.step_message_with_label_and_duration(benchmark.b_skip,
normalised_relative_file, 0,
preparation: 1 * time.microsecond
@ -597,9 +597,9 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
goto test_passed_system
}
}
time.sleep(testing.fail_retry_delay_ms)
time.sleep(fail_retry_delay_ms)
}
if details.flaky && !testing.fail_flaky {
if details.flaky && !fail_flaky {
ts.append_message(.info, ' *FAILURE* of the known flaky test file ${relative_file} is ignored, since VTEST_FAIL_FLAKY is 0 . Retry count: ${details.retry} .\ncmd: ${cmd}',
mtc)
unsafe {
@ -616,14 +616,14 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
return pool.no_result
}
} else {
if testing.show_start {
if show_start {
ts.append_message(.info, ' starting ${relative_file} ...',
mtc)
}
ts.append_message(.compile_begin, cmd, mtc)
compile_d_cmd := time.new_stopwatch()
mut compile_r := os.Result{}
for cretry in 0 .. testing.max_compilation_retries {
for cretry in 0 .. max_compilation_retries {
compile_r = os.execute(cmd)
compile_cmd_duration = compile_d_cmd.elapsed()
// eprintln('>>>> cretry: $cretry | compile_r.exit_code: $compile_r.exit_code | compile_cmd_duration: ${compile_cmd_duration:8} | file: $normalised_relative_file')
@ -670,7 +670,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
// retry running at least 1 more time, to avoid CI false positives as much as possible
details.retry++
}
failure_output.write_string(testing.separator)
failure_output.write_string(separator)
failure_output.writeln(' retry: 0 ; max_retry: ${details.retry} ; r.exit_code: ${r.exit_code} ; trimmed_output.len: ${trimmed_output.len}')
failure_output.writeln(trimmed_output)
os.setenv('VTEST_RETRY_MAX', '${details.retry}', true)
@ -691,13 +691,13 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
}
trimmed_output = r.output.trim_space()
failure_output.write_string(testing.separator)
failure_output.write_string(separator)
failure_output.writeln(' retry: ${retry} ; max_retry: ${details.retry} ; r.exit_code: ${r.exit_code} ; trimmed_output.len: ${trimmed_output.len}')
failure_output.writeln(trimmed_output)
time.sleep(testing.fail_retry_delay_ms)
time.sleep(fail_retry_delay_ms)
}
full_failure_output := failure_output.str().trim_space()
if details.flaky && !testing.fail_flaky {
if details.flaky && !fail_flaky {
ts.append_message(.info, ' *FAILURE* of the known flaky test file ${relative_file} is ignored, since VTEST_FAIL_FLAKY is 0 . Retry count: ${details.retry} .\n comp_cmd: ${cmd}\n run_cmd: ${run_cmd}',
mtc)
unsafe {
@ -706,7 +706,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
ts.benchmark.fail()
tls_bench.fail()
cmd_duration = d_cmd.elapsed() - (testing.fail_retry_delay_ms * details.retry)
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,
'${normalised_relative_file}\n retry: ${retry}\n comp_cmd: ${cmd}\n run_cmd: ${run_cmd}\nfailure code: ${r.exit_code}; foutput.len: ${full_failure_output.len}; failure output:\n${full_failure_output}',
cmd_duration,
@ -720,7 +720,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
test_passed_execute:
ts.benchmark.ok()
tls_bench.ok()
if !testing.hide_oks {
if !hide_oks {
ts.append_message_with_duration(.ok, tls_bench.step_message_with_label_and_duration(benchmark.b_ok,
normalised_relative_file, cmd_duration,
preparation: compile_cmd_duration
@ -769,7 +769,7 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
}
}
c := os.read_file(fnormalised) or { panic(err) }
start := c#[0..testing.header_bytes_to_search_for_module_main]
start := c#[0..header_bytes_to_search_for_module_main]
if start.contains('module ') && !start.contains('module main') {
skipped << fnormalised.replace(nparent_dir + '/', '')
continue next_file
@ -834,7 +834,7 @@ pub fn building_any_v_binaries_failed() bool {
continue
}
bmark.ok()
if !testing.hide_oks {
if !hide_oks {
eprintln(bmark.step_message_ok('command: ${cmd}'))
}
}
@ -875,7 +875,7 @@ pub fn get_test_details(file string) TestDetails {
}
pub fn find_started_process(pname string) !string {
for line in testing.all_processes {
for line in all_processes {
if line.contains(pname) {
return line
}