ci: add -prealloc self compilation checks on more platforms (#24891)

This commit is contained in:
Delyan Angelov 2025-07-14 11:03:56 +03:00 committed by GitHub
parent e2434a8256
commit 50db431cfd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 41 additions and 14 deletions

View file

@ -38,6 +38,8 @@ jobs:
run: v run ci/macos_ci.vsh test_symlink
- name: v doctor
run: v run ci/macos_ci.vsh v_doctor
- name: Build v with -prealloc
run: v run ci/macos_ci.vsh build_v_with_prealloc
- name: Test cross compilation to Linux
run: v run ci/macos_ci.vsh test_cross_compilation
- name: Build V with -cstrict

View file

@ -18,6 +18,15 @@ fn v_doctor() {
}
}
fn build_v_with_prealloc() {
exec('v -cg -cstrict -o vstrict1 cmd/v')
exec('./vstrict1 -o vprealloc -prealloc cmd/v')
exec('./vprealloc run examples/hello_world.v')
exec('./vprealloc -o v3 cmd/v')
exec('./v3 -o v4 cmd/v')
exec('./v4 -d debug_malloc -d debug_realloc -o vdebug1 cmd/v')
}
fn verify_v_test_works() {
exec('echo \$VFLAGS')
exec('v cmd/tools/test_if_v_test_system_works.v')
@ -49,6 +58,7 @@ fn run_essential_tests() {
const all_tasks = {
'v_doctor': Task{v_doctor, 'Run v doctor'}
'build_v_with_prealloc': Task{build_v_with_prealloc, 'Build V with prealloc'}
'verify_v_test_works': Task{verify_v_test_works, 'Verify that v test works'}
'build_fast_script': Task{build_fast_script, 'Check that building fast.v works'}
'check_math': Task{check_math, 'Check the `math` module works'}

View file

@ -41,16 +41,19 @@ fn v_doctor() {
exec('v doctor')
}
fn build_v_with_prealloc() {
exec('v -cg -cstrict -o vstrict1 cmd/v')
exec('./vstrict1 -o vprealloc -prealloc cmd/v')
exec('./vprealloc run examples/hello_world.v')
exec('./vprealloc -o v3 cmd/v')
exec('./v3 -o v4 cmd/v')
exec('./v4 -d debug_malloc -d debug_realloc -o vdebug1 cmd/v')
}
//
// TCC job tasks
//
fn build_v_with_prealloc() {
exec('v -d debug_malloc -d debug_realloc -o vdebug1 cmd/v')
exec('v -cg -cstrict -o vstrict1 cmd/v')
exec('v -o vrealloc -prealloc cmd/v && ./vrealloc -o v3 cmd/v && ./v3 -o v4 cmd/v')
}
fn install_dependencies_for_examples_and_tools_tcc() {
exec('v retry -- sudo apt update')
exec('v retry -- sudo apt install --quiet -y libssl-dev sqlite3 libsqlite3-dev valgrind')
@ -373,8 +376,8 @@ fn native_cross_compilation_to_macos() {
// Collect all tasks
//
const all_tasks = {
// tcc tasks
'build_v_with_prealloc': Task{build_v_with_prealloc, 'Build V with prealloc'}
// tcc tasks
'all_code_is_formatted_tcc': Task{all_code_is_formatted, 'All code is formatted (tcc)'}
'install_dependencies_for_examples_and_tools_tcc': Task{install_dependencies_for_examples_and_tools_tcc, 'Install deps for examples/tools (tcc)'}
'test_v_to_c_tcc': Task{test_v_to_c_tcc, 'Test v->c with tcc'}

View file

@ -87,9 +87,20 @@ fn v_doctor() {
exec('v doctor')
}
fn build_v_with_prealloc() {
exec('v -cg -cstrict -o vstrict1 cmd/v')
exec('./vstrict1 -d debug_malloc -d debug_realloc -o vdebug1 cmd/v')
exec('./vstrict1 -o vprealloc -prealloc cmd/v')
// TODO: fix prealloc on macos (the rwmutex implementation for shared maps there seems to require that mutexes are allocated by C.malloc directly, and segfaults for arbitrary memory addresses)
// exec('./vprealloc run examples/hello_world.v')
// exec('./vprealloc -o v3 cmd/v')
// exec('./v3 -o v4 cmd/v')
}
fn v_self_compilation_usecache() {
exec('unset VFLAGS')
exec('v -usecache examples/hello_world.v && examples/hello_world')
exec('v -usecache examples/hello_world.v')
exec('./examples/hello_world')
exec('v -o v2 -usecache cmd/v')
exec('./v2 -o v3 -usecache cmd/v')
exec('./v3 version')
@ -128,6 +139,7 @@ const all_tasks = {
'build_examples_prod': Task{build_examples_prod, 'Build examples with -prod'}
'build_examples_v_compiled_with_tcc': Task{build_examples_v_compiled_with_tcc, 'Build examples with V build with tcc'}
'v_doctor': Task{v_doctor, 'v doctor'}
'build_v_with_prealloc': Task{build_v_with_prealloc, 'Build V with prealloc'}
'v_self_compilation_usecache': Task{v_self_compilation_usecache, 'V self compilation with -usecache'}
'v_self_compilation_parallel_cc': Task{v_self_compilation_parallel_cc, 'V self compilation with -parallel-cc'}
'test_password_input': Task{test_password_input, 'Test password input'}