Skip to content

Commit f2c281e

Browse files
authored
markused: only add .vtest_ functions, *when* compiling _test.v files (#23003)
1 parent c7ee45f commit f2c281e

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.github/workflows/c2v_ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ jobs:
3838
- uses: actions/checkout@v4
3939
- name: Build V
4040
run: make -j4 && ./v symlink
41+
42+
- name: Set 8.8.8.8 as dns server
43+
run: |
44+
sudo sed -i 's/#DNS=/DNS=8.8.8.8 8.8.4.4/g' /etc/systemd/resolved.conf
45+
sudo systemctl daemon-reload
46+
sudo systemctl restart systemd-networkd
47+
sudo systemctl restart systemd-resolved
48+
dig distro.ibiblio.org
49+
4150
- name: Install C2V
4251
run: |
4352
v retry -- v install --git https://github.com/vlang/c2v
@@ -73,6 +82,15 @@ jobs:
7382
- uses: actions/checkout@v4
7483
- name: Build V
7584
run: make -j4 && ./v symlink
85+
86+
- name: Set 8.8.8.8 as dns server
87+
run: |
88+
sudo sed -i 's/#DNS=/DNS=8.8.8.8 8.8.4.4/g' /etc/systemd/resolved.conf
89+
sudo systemctl daemon-reload
90+
sudo systemctl restart systemd-networkd
91+
sudo systemctl restart systemd-resolved
92+
dig distro.ibiblio.org
93+
7694
- name: Install C2V
7795
run: |
7896
v retry -- v install --git https://github.com/vlang/c2v

vlib/v/markused/markused.v

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,9 @@ pub fn mark_used(mut table ast.Table, mut pref_ pref.Preferences, ast_files []&a
4242
'error',
4343
'builtin_init',
4444
'fast_string_eq',
45-
// TODO: process the _vinit const initializations automatically too
46-
'main.vtest_init',
47-
'main.vtest_new_metainfo',
48-
'main.vtest_new_filemetainfo',
4945
'println',
5046
]
47+
5148
$if debug_used_features ? {
5249
dump(table.used_features)
5350
}
@@ -295,7 +292,7 @@ pub fn mark_used(mut table ast.Table, mut pref_ pref.Preferences, ast_files []&a
295292
}
296293
// testing framework:
297294
if pref_.is_test {
298-
if k.starts_with('test_') || k.contains('.test_') {
295+
if k.starts_with('test_') || k.contains('.test_') || k.contains('.vtest_') {
299296
all_fn_root_names << k
300297
continue
301298
}
@@ -400,6 +397,7 @@ pub fn mark_used(mut table ast.Table, mut pref_ pref.Preferences, ast_files []&a
400397
all_fn_root_names << 'time.unix' // used by json
401398
table.used_features.used_maps++ // json needs new_map etc
402399
}
400+
403401
mut walker := Walker.new(
404402
table: table
405403
files: ast_files

0 commit comments

Comments
 (0)