Skip to content

Commit f43b528

Browse files
authored
tools: use the same same skipping logic for the platform specific _test.v files in v test-self too (#20815)
1 parent 8215f21 commit f43b528

File tree

7 files changed

+19
-18
lines changed

7 files changed

+19
-18
lines changed

cmd/tools/modules/testing/common.v

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import runtime
1313
import rand
1414
import strings
1515

16+
pub const host_os = pref.get_host_os()
17+
1618
pub const github_job = os.getenv('GITHUB_JOB')
1719

1820
pub const runner_os = os.getenv('RUNNER_OS') // GitHub runner OS
@@ -386,6 +388,23 @@ pub fn (mut ts TestSession) test() {
386388
if ts.build_tools && dot_relative_file.ends_with('_test.v') {
387389
continue
388390
}
391+
392+
// Skip OS-specific tests if we are not running that OS
393+
// Special case for android_outside_termux because of its
394+
// underscores
395+
if file.ends_with('_android_outside_termux_test.v') {
396+
if !testing.host_os.is_target_of('android_outside_termux') {
397+
remaining_files << dot_relative_file
398+
ts.skip_files << file
399+
continue
400+
}
401+
}
402+
os_target := file.all_before_last('_test.v').all_after_last('_')
403+
if !testing.host_os.is_target_of(os_target) {
404+
remaining_files << dot_relative_file
405+
ts.skip_files << file
406+
continue
407+
}
389408
remaining_files << dot_relative_file
390409
}
391410
remaining_files = vtest.filter_vtest_only(remaining_files, fix_slashes: false)

cmd/tools/vtest-self.v

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ const skip_test_files = [
9494
'vlib/db/pg/pg_orm_test.v', // pg not installed
9595
'vlib/db/pg/pg_test.v', // pg not installed
9696
'vlib/db/pg/pg_double_test.v', // pg not installed
97-
'vlib/v/tests/filtering_android_outside_termux_test.v', // platform filtering not baked into v test-self
98-
'vlib/v/tests/filtering_macos_test.v', // platform filtering not baked into v test-self
99-
'vlib/v/tests/filtering_nix_test.v', // platform filtering not baked into v test-self
100-
'vlib/v/tests/filtering_windows_test.v', // platform filtering not baked into v test-self
10197
]
10298
// These tests are too slow to be run in the CI on each PR/commit
10399
// in the sanitized modes:

cmd/tools/vtest.v

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import os.cmdline
55
import testing
66
import v.pref
77

8-
const host_os = pref.get_host_os()
9-
108
struct Context {
119
mut:
1210
verbose bool
@@ -132,18 +130,6 @@ enum ShouldTestStatus {
132130
}
133131

134132
fn (mut ctx Context) should_test(path string, backend string) ShouldTestStatus {
135-
// Skip OS-specific tests if we are not running that OS
136-
// Special case for android_outside_termux because of its
137-
// underscores
138-
if path.ends_with('_android_outside_termux_test.v') {
139-
if !host_os.is_target_of('android_outside_termux') {
140-
return .skip
141-
}
142-
}
143-
os_target := path.all_before_last('_test.v').all_after_last('_')
144-
if !host_os.is_target_of(os_target) {
145-
return .skip
146-
}
147133
if path.ends_with('mysql_orm_test.v') {
148134
testing.find_started_process('mysqld') or { return .skip }
149135
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)