Skip to content

Commit 5d3d748

Browse files
committed
ci: fix macOS V3 rollout failures
1 parent d26a863 commit 5d3d748

10 files changed

Lines changed: 44 additions & 23 deletions

File tree

ci/freebsd_ci.vsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn build_fast_script() {
6363
} else {
6464
println('### Build fast script')
6565
}
66-
exec('cd cmd/tools/fast && v fast.v')
66+
exec('cd cmd/tools/fast && v -o fast .')
6767
if common.is_github_job {
6868
println('::endgroup::')
6969
}

ci/linux_ci.vsh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ fn test_v_tutorials_tcc() {
128128
}
129129
130130
fn build_fast_tcc() {
131-
exec('cd cmd/tools/fast && v fast.v')
132-
exec('cd cmd/tools/fast && ./fast')
131+
exec('cd cmd/tools/fast && v -o fast .')
132+
exec('cd cmd/tools/fast && ./fast help')
133133
}
134134
135135
fn v_self_compilation_usecache_tcc() {

ci/openbsd_ci.vsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn build_fast_script() {
6363
} else {
6464
println('### Build fast script')
6565
}
66-
exec('cd cmd/tools/fast && v fast.v')
66+
exec('cd cmd/tools/fast && v -o fast .')
6767
if common.is_github_job {
6868
println('::endgroup::')
6969
}

cmd/tools/vbuild-tools.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import v.util
1111
// should be compiled (v folder).
1212
// To implement that, these folders are initially skipped, then added
1313
// as a whole *after the testing.prepare_test_session call*.
14-
const tools_in_subfolders = ['vast', 'vcreate', 'vdoc', 'vpm', 'vsqlite', 'vsymlink', 'vvet',
14+
const tools_in_subfolders = ['fast', 'vast', 'vcreate', 'vdoc', 'vpm', 'vsqlite', 'vsymlink', 'vvet',
1515
'vwhere', 'vcover']
1616

1717
// v2 is temporarily disabled, so tools that depend on it are skipped too.

cmd/v/macos_v3_darwin.c.v

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,14 @@ fn is_macos_v3_relevant_command(command string, prefs &pref.Preferences) bool {
5656
}
5757
normalized_path := prefs.path.replace('\\', '/').trim_right('/')
5858
is_directory := os.is_dir(prefs.path)
59-
is_direct_vsh := normalized_path.ends_with('.vsh') && command != 'crun'
6059
if command in external_tools
6160
|| command in ['help', 'version', 'new', 'init', 'install', 'link', 'list', 'outdated', 'remove', 'search', 'show', 'unlink', 'update', 'upgrade', 'vlib-docs', 'interpret', 'get', 'translate'] {
6261
return false
6362
}
64-
if (prefs.is_crun && !is_direct_vsh) || prefs.is_test || prefs.is_prod
65-
|| prefs.autofree || prefs.build_mode == .build_module || prefs.is_cstrict
66-
|| prefs.use_cache || prefs.parallel_cc || prefs.out_name_is_dir
67-
|| prefs.exclude.len > 0 || prefs.coverage_dir != '' || prefs.is_o
68-
|| prefs.is_vlines || prefs.is_shared {
63+
if prefs.is_crun || prefs.is_test || prefs.is_prod || prefs.autofree
64+
|| prefs.build_mode == .build_module || prefs.is_cstrict || prefs.use_cache
65+
|| prefs.parallel_cc || prefs.out_name_is_dir || prefs.exclude.len > 0
66+
|| prefs.coverage_dir != '' || prefs.is_o || prefs.is_vlines || prefs.is_shared {
6967
return false
7068
}
7169
// The established preference defaults select Boehm before dispatch runs,
@@ -291,9 +289,11 @@ fn retry_macos_v3_with_old_compiler(caller_environment map[string]string, fallba
291289
return
292290
}
293291
os.setenv(macos_v3_c_error_dir_env, c_error_dir, true)
294-
eprintln('V3 C compilation failed; retrying with `-old-compiler`.')
295-
if report.c_output != '' {
296-
eprintln(report.c_output.trim_right('\r\n'))
292+
if is_verbose {
293+
eprintln('V3 C compilation failed; retrying with `-old-compiler`.')
294+
if report.c_output != '' {
295+
eprintln(report.c_output.trim_right('\r\n'))
296+
}
297297
}
298298
} else {
299299
os.rmdir_all(c_error_dir) or {}
@@ -302,7 +302,9 @@ fn retry_macos_v3_with_old_compiler(caller_environment map[string]string, fallba
302302
println('V3 requested the compatibility compiler for inline assembly')
303303
}
304304
} else {
305-
eprintln('V3 compilation failed; retrying with `-old-compiler`.')
305+
if is_verbose {
306+
eprintln('V3 compilation failed; retrying with `-old-compiler`.')
307+
}
306308
}
307309
}
308310
os.setenv(macos_v3_retry_env, '1', true)

cmd/v/macos_v3_test.v

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn test_macos_v3_relevant_command_only_selects_supported_native_c_builds() {
8181
assert !is_macos_v3_relevant_command('build', prefs)
8282
prefs.path = 'script.vsh'
8383
prefs.is_crun = true
84-
assert is_macos_v3_relevant_command('script.vsh', prefs)
84+
assert !is_macos_v3_relevant_command('script.vsh', prefs)
8585
assert !is_macos_v3_relevant_command('crun', prefs)
8686
prefs.is_crun = false
8787
prefs.path = 'main.v'
@@ -324,7 +324,8 @@ fn main() {}
324324
failing_exit_code := failing_process.code
325325
failing_process.close()
326326
assert failing_exit_code != 0, failing_output_text
327-
assert failing_output_text.contains('V3 C compilation failed; retrying with `-old-compiler`.')
327+
assert !failing_output_text.contains('V3 C compilation failed; retrying with `-old-compiler`.')
328+
assert failing_output_text.contains('macos_v3_missing_library_')
328329
failing_report_dir := os.join_path(os.vtmp_dir(),
329330
'macos_v3_fallback_${failing_compiler_pid}.c_error')
330331
assert !os.exists(failing_report_dir), 'failed compatibility build left staged report directory: ${failing_report_dir}'

vlib/v/pref/pref_test.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn test_version_flag() {
3131
v_verbose_cmd_res := os.execute_opt('${vexe} -v run ${example_path}')!.output
3232
assert v_verbose_cmd_res != v_ver_cmd_res
3333
assert v_verbose_cmd_res.contains('v.pref.lookup_path:')
34-
|| v_verbose_cmd_res.contains('Launching macOS V3 compiler:')
34+
|| v_verbose_cmd_res.contains('Running macOS V3 compiler in process:')
3535

3636
v_verbose_cmd_with_additional_args_res := os.execute_opt('${vexe} -g -v run ${example_path}')!.output
3737
assert v_verbose_cmd_with_additional_args_res != v_ver_cmd_res

vlib/v3/driver/driver.v

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,8 @@ fn input_is_cmd_v(input_file string) bool {
16051605

16061606
fn default_bin_file_for_input(input_file string) string {
16071607
if os.is_dir(input_file) {
1608-
return os.base(os.real_path(input_file))
1608+
real_input := os.real_path(input_file)
1609+
return os.join_path_single(real_input, os.base(real_input))
16091610
}
16101611
if input_file.ends_with('.vv') {
16111612
return input_file.all_before_last('.vv')
@@ -4434,6 +4435,9 @@ pub fn run(args []string) {
44344435
if request_macos_v3_compatibility_fallback(p.diagnostics, macos_v3_fallback_file) {
44354436
exit(1)
44364437
}
4438+
if macos_v3_fallback_file != '' {
4439+
exit(1)
4440+
}
44374441
for diagnostic in p.diagnostics {
44384442
if file := a.source_files[diagnostic.pos.id] {
44394443
_ = file
@@ -4754,7 +4758,9 @@ pub fn run(args []string) {
47544758
cvsw.restart()
47554759
}
47564760
if pre_tc.check_interface_embedding_limits() {
4757-
print_type_diagnostics(a, pre_tc.notices, pre_tc.errors, is_checker_fixture)
4761+
if macos_v3_fallback_file == '' {
4762+
print_type_diagnostics(a, pre_tc.notices, pre_tc.errors, is_checker_fixture)
4763+
}
47584764
exit(1)
47594765
}
47604766
if verbose {
@@ -4848,7 +4854,9 @@ pub fn run(args []string) {
48484854
fixture_used_fns, false)
48494855
}
48504856
}
4851-
print_type_diagnostics(a, pre_tc.notices, pre_tc.errors, is_checker_fixture)
4857+
if macos_v3_fallback_file == '' {
4858+
print_type_diagnostics(a, pre_tc.notices, pre_tc.errors, is_checker_fixture)
4859+
}
48524860
pre_tc.notices.clear()
48534861
}
48544862
if pre_tc.errors.len > 0 {
@@ -5265,6 +5273,9 @@ pub fn run(args []string) {
52655273
b.step('annotate types (cached)')
52665274
}
52675275
if pre_tc.errors.len > 0 {
5276+
if macos_v3_fallback_file != '' {
5277+
exit(1)
5278+
}
52685279
print_type_diagnostics(a, pre_tc.notices, pre_tc.errors, is_checker_fixture)
52695280
exit(1)
52705281
}
@@ -5411,7 +5422,9 @@ pub fn run(args []string) {
54115422
used_fns = monomorph_used_fns.move()
54125423
}
54135424
if pre_tc.notices.len > 0 || pre_tc.errors.len > 0 {
5414-
print_type_diagnostics(a, pre_tc.notices, pre_tc.errors, is_checker_fixture)
5425+
if pre_tc.errors.len == 0 || macos_v3_fallback_file == '' {
5426+
print_type_diagnostics(a, pre_tc.notices, pre_tc.errors, is_checker_fixture)
5427+
}
54155428
pre_tc.notices.clear()
54165429
}
54175430
if pre_tc.errors.len > 0 {

vlib/v3/pthread_helper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
* declaration used only by the helper available after includes are flattened. */
1010
extern int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stack_size);
1111

12+
static inline pthread_t v3_pthread_zero(void) {
13+
return (pthread_t)0;
14+
}
15+
1216
static inline int v3_pthread_create(pthread_t *thread, size_t stack_size,
1317
void *(*start_routine)(void *), void *arg) {
1418
pthread_attr_t attr;

vlib/v3/workers/worker_pool_nix.c.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ struct Completion {
7171
struct C.pthread_t {}
7272

7373
fn C.pthread_join(thread C.pthread_t, retval voidptr) int
74+
fn C.v3_pthread_zero() C.pthread_t
7475
fn C.v3_pthread_create(thread &C.pthread_t, stack_size usize, start_routine fn (voidptr) voidptr, arg voidptr) int
7576

7677
// Pool owns a bounded set of persistent compiler workers. Phase payloads stay
@@ -133,7 +134,7 @@ pub fn new(size int) &Pool {
133134
fail := os.getenv('V3_TEST_PTHREAD_CREATE_FAIL')
134135
stack_size := worker_stack_size()
135136
for idx in 0 .. wanted {
136-
mut thread_id := C.pthread_t{}
137+
mut thread_id := C.v3_pthread_zero()
137138
result := if fail == 'pool:all' || fail == 'pool:${idx}' {
138139
11
139140
} else {

0 commit comments

Comments
 (0)