v / ci / openbsd_ci.vsh
145 lines · 134 sloc · 3.75 KB · 80fd66f7f832317310c8a770eed2cad73265bda7
Raw
1import os
2import common { Task, exec }
3
4fn v_doctor() {
5 if common.is_github_job {
6 println('::group::vdoctor')
7 } else {
8 println('### vdoctor')
9 }
10 dump(os.getenv('PATH'))
11 exec('v doctor')
12 if common.is_github_job {
13 exec('uname -mrs')
14 exec('sysctl hw.model')
15 exec('sysctl hw.ncpu')
16 exec('sysctl hw.physmem')
17 exec('sysctl hw.usermem')
18 exec('whoami')
19 exec('pwd')
20 exec('ls -la')
21 exec('git log -n1')
22 exec('cc --version')
23 println('::endgroup::')
24 }
25}
26
27fn build_v_with_prealloc() {
28 if common.is_github_job {
29 println('::group::Build v with prealloc')
30 } else {
31 println('### Build v with prealloc')
32 }
33 exec('v -cg -cstrict -o vstrict1 cmd/v')
34 // -prealloc uses _Thread_local for g_memory_block; bundled tcc does not support it.
35 prealloc_cc_flag := if os.getenv('VFLAGS').contains('-cc tcc') { ' -cc cc' } else { '' }
36 exec('./vstrict1${prealloc_cc_flag} -o vprealloc -prealloc cmd/v')
37 exec('./vprealloc run examples/hello_world.v')
38 exec('./vprealloc -o v3 cmd/v')
39 exec('./v3 -o v4 cmd/v')
40 exec('./v4 -d debug_malloc -d debug_realloc -o vdebug1 cmd/v')
41 if common.is_github_job {
42 println('::endgroup::')
43 }
44}
45
46fn verify_v_test_works() {
47 if common.is_github_job {
48 println('::group::Verify v test')
49 } else {
50 println('### Verify v test')
51 }
52 exec('echo \$VFLAGS')
53 exec('v cmd/tools/test_if_v_test_system_works.v')
54 exec('./cmd/tools/test_if_v_test_system_works')
55 if common.is_github_job {
56 println('::endgroup::')
57 }
58}
59
60fn build_fast_script() {
61 if common.is_github_job {
62 println('::group::Build fast script')
63 } else {
64 println('### Build fast script')
65 }
66 exec('cd cmd/tools/fast && v fast.v')
67 if common.is_github_job {
68 println('::endgroup::')
69 }
70}
71
72fn check_math() {
73 if common.is_github_job {
74 println('::group::Test vlib/math')
75 } else {
76 println('### Test vlib/math')
77 }
78 exec('v -silent test vlib/math')
79 println('Test the math module, using only the pure V versions,')
80 println(' without the .c.v overrides.')
81 exec('v -silent -exclude @vlib/math/*.c.v test vlib/math')
82 if common.is_github_job {
83 println('::endgroup::')
84 }
85}
86
87fn check_compress() {
88 if common.is_github_job {
89 println('::group::Test vlib/compress')
90 } else {
91 println('### Test vlib/compress')
92 }
93 exec('v -silent test vlib/compress')
94 if common.is_github_job {
95 println('::endgroup::')
96 }
97}
98
99fn test_inline_assembly() {
100 if common.is_github_job {
101 println('::group::Test inline Assembly')
102 } else {
103 println('### Test inline Assembly')
104 }
105 exec('v test vlib/v/slow_tests/assembly')
106 if common.is_github_job {
107 println('::endgroup::')
108 }
109}
110
111fn run_essential_tests() {
112 if common.is_github_job {
113 println('::group::Run essential tests')
114 exec('VTEST_JUST_ESSENTIAL=1 v -silent test-self')
115 println('::endgroup::')
116 } else {
117 println('### Run essential tests')
118 exec('VTEST_JUST_ESSENTIAL=1 v -progress test-self')
119 }
120}
121
122fn build_examples() {
123 if common.is_github_job {
124 println('::group::Build examples')
125 exec('v -W build-examples')
126 println('::endgroup::')
127 } else {
128 println('### Build examples')
129 exec('v -progress build-examples')
130 }
131}
132
133const all_tasks = {
134 'v_doctor': Task{v_doctor, 'Run v doctor'}
135 'build_v_with_prealloc': Task{build_v_with_prealloc, 'Build V with prealloc'}
136 'verify_v_test_works': Task{verify_v_test_works, 'Verify that v test works'}
137 'build_fast_script': Task{build_fast_script, 'Check that building fast.v works'}
138 'check_math': Task{check_math, 'Check the `math` module works'}
139 'check_compress': Task{check_compress, 'Check the `compress` module works'}
140 'test_inline_assembly': Task{test_inline_assembly, 'Test inline Assembly'}
141 'run_essential_tests': Task{run_essential_tests, 'Run only the essential tests'}
142 'build_examples': Task{build_examples, 'Build examples'}
143}
144
145common.run(all_tasks)
146