Skip to content

Commit 50db431

Browse files
authored
ci: add -prealloc self compilation checks on more platforms (#24891)
1 parent e2434a8 commit 50db431

4 files changed

Lines changed: 41 additions & 14 deletions

File tree

‎.github/workflows/macos_ci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
run: v run ci/macos_ci.vsh test_symlink
3939
- name: v doctor
4040
run: v run ci/macos_ci.vsh v_doctor
41+
- name: Build v with -prealloc
42+
run: v run ci/macos_ci.vsh build_v_with_prealloc
4143
- name: Test cross compilation to Linux
4244
run: v run ci/macos_ci.vsh test_cross_compilation
4345
- name: Build V with -cstrict

‎ci/freebsd_ci.vsh‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ fn v_doctor() {
1818
}
1919
}
2020

21+
fn build_v_with_prealloc() {
22+
exec('v -cg -cstrict -o vstrict1 cmd/v')
23+
exec('./vstrict1 -o vprealloc -prealloc cmd/v')
24+
exec('./vprealloc run examples/hello_world.v')
25+
exec('./vprealloc -o v3 cmd/v')
26+
exec('./v3 -o v4 cmd/v')
27+
exec('./v4 -d debug_malloc -d debug_realloc -o vdebug1 cmd/v')
28+
}
29+
2130
fn verify_v_test_works() {
2231
exec('echo \$VFLAGS')
2332
exec('v cmd/tools/test_if_v_test_system_works.v')
@@ -48,12 +57,13 @@ fn run_essential_tests() {
4857
}
4958
5059
const all_tasks = {
51-
'v_doctor': Task{v_doctor, 'Run v doctor'}
52-
'verify_v_test_works': Task{verify_v_test_works, 'Verify that v test works'}
53-
'build_fast_script': Task{build_fast_script, 'Check that building fast.v works'}
54-
'check_math': Task{check_math, 'Check the `math` module works'}
55-
'check_compress': Task{check_compress, 'Check the `compress` module works'}
56-
'run_essential_tests': Task{run_essential_tests, 'Run only the essential tests'}
60+
'v_doctor': Task{v_doctor, 'Run v doctor'}
61+
'build_v_with_prealloc': Task{build_v_with_prealloc, 'Build V with prealloc'}
62+
'verify_v_test_works': Task{verify_v_test_works, 'Verify that v test works'}
63+
'build_fast_script': Task{build_fast_script, 'Check that building fast.v works'}
64+
'check_math': Task{check_math, 'Check the `math` module works'}
65+
'check_compress': Task{check_compress, 'Check the `compress` module works'}
66+
'run_essential_tests': Task{run_essential_tests, 'Run only the essential tests'}
5767
}
5868
5969
common.run(all_tasks)

‎ci/linux_ci.vsh‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,19 @@ fn v_doctor() {
4141
exec('v doctor')
4242
}
4343
44-
//
45-
// TCC job tasks
46-
//
47-
4844
fn build_v_with_prealloc() {
49-
exec('v -d debug_malloc -d debug_realloc -o vdebug1 cmd/v')
5045
exec('v -cg -cstrict -o vstrict1 cmd/v')
51-
exec('v -o vrealloc -prealloc cmd/v && ./vrealloc -o v3 cmd/v && ./v3 -o v4 cmd/v')
46+
exec('./vstrict1 -o vprealloc -prealloc cmd/v')
47+
exec('./vprealloc run examples/hello_world.v')
48+
exec('./vprealloc -o v3 cmd/v')
49+
exec('./v3 -o v4 cmd/v')
50+
exec('./v4 -d debug_malloc -d debug_realloc -o vdebug1 cmd/v')
5251
}
5352
53+
//
54+
// TCC job tasks
55+
//
56+
5457
fn install_dependencies_for_examples_and_tools_tcc() {
5558
exec('v retry -- sudo apt update')
5659
exec('v retry -- sudo apt install --quiet -y libssl-dev sqlite3 libsqlite3-dev valgrind')
@@ -373,8 +376,8 @@ fn native_cross_compilation_to_macos() {
373376
// Collect all tasks
374377
//
375378
const all_tasks = {
376-
// tcc tasks
377379
'build_v_with_prealloc': Task{build_v_with_prealloc, 'Build V with prealloc'}
380+
// tcc tasks
378381
'all_code_is_formatted_tcc': Task{all_code_is_formatted, 'All code is formatted (tcc)'}
379382
'install_dependencies_for_examples_and_tools_tcc': Task{install_dependencies_for_examples_and_tools_tcc, 'Install deps for examples/tools (tcc)'}
380383
'test_v_to_c_tcc': Task{test_v_to_c_tcc, 'Test v->c with tcc'}

‎ci/macos_ci.vsh‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,20 @@ fn v_doctor() {
8787
exec('v doctor')
8888
}
8989
90+
fn build_v_with_prealloc() {
91+
exec('v -cg -cstrict -o vstrict1 cmd/v')
92+
exec('./vstrict1 -d debug_malloc -d debug_realloc -o vdebug1 cmd/v')
93+
exec('./vstrict1 -o vprealloc -prealloc cmd/v')
94+
// 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)
95+
// exec('./vprealloc run examples/hello_world.v')
96+
// exec('./vprealloc -o v3 cmd/v')
97+
// exec('./v3 -o v4 cmd/v')
98+
}
99+
90100
fn v_self_compilation_usecache() {
91101
exec('unset VFLAGS')
92-
exec('v -usecache examples/hello_world.v && examples/hello_world')
102+
exec('v -usecache examples/hello_world.v')
103+
exec('./examples/hello_world')
93104
exec('v -o v2 -usecache cmd/v')
94105
exec('./v2 -o v3 -usecache cmd/v')
95106
exec('./v3 version')
@@ -128,6 +139,7 @@ const all_tasks = {
128139
'build_examples_prod': Task{build_examples_prod, 'Build examples with -prod'}
129140
'build_examples_v_compiled_with_tcc': Task{build_examples_v_compiled_with_tcc, 'Build examples with V build with tcc'}
130141
'v_doctor': Task{v_doctor, 'v doctor'}
142+
'build_v_with_prealloc': Task{build_v_with_prealloc, 'Build V with prealloc'}
131143
'v_self_compilation_usecache': Task{v_self_compilation_usecache, 'V self compilation with -usecache'}
132144
'v_self_compilation_parallel_cc': Task{v_self_compilation_parallel_cc, 'V self compilation with -parallel-cc'}
133145
'test_password_input': Task{test_password_input, 'Test password input'}

0 commit comments

Comments
 (0)