Skip to content

Commit

Permalink
tools: use the same same skipping logic for the platform specific _te…
Browse files Browse the repository at this point in the history
…st.v files in `v test-self` too (#20815)
  • Loading branch information
spytheman committed Feb 13, 2024
1 parent 8215f21 commit f43b528
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
19 changes: 19 additions & 0 deletions cmd/tools/modules/testing/common.v
Expand Up @@ -13,6 +13,8 @@ import runtime
import rand
import strings

pub const host_os = pref.get_host_os()

pub const github_job = os.getenv('GITHUB_JOB')

pub const runner_os = os.getenv('RUNNER_OS') // GitHub runner OS
Expand Down Expand Up @@ -386,6 +388,23 @@ pub fn (mut ts TestSession) test() {
if ts.build_tools && dot_relative_file.ends_with('_test.v') {
continue
}

// Skip OS-specific tests if we are not running that OS
// Special case for android_outside_termux because of its
// underscores
if file.ends_with('_android_outside_termux_test.v') {
if !testing.host_os.is_target_of('android_outside_termux') {
remaining_files << dot_relative_file
ts.skip_files << file
continue
}
}
os_target := file.all_before_last('_test.v').all_after_last('_')
if !testing.host_os.is_target_of(os_target) {
remaining_files << dot_relative_file
ts.skip_files << file
continue
}
remaining_files << dot_relative_file
}
remaining_files = vtest.filter_vtest_only(remaining_files, fix_slashes: false)
Expand Down
4 changes: 0 additions & 4 deletions cmd/tools/vtest-self.v
Expand Up @@ -94,10 +94,6 @@ const skip_test_files = [
'vlib/db/pg/pg_orm_test.v', // pg not installed
'vlib/db/pg/pg_test.v', // pg not installed
'vlib/db/pg/pg_double_test.v', // pg not installed
'vlib/v/tests/filtering_android_outside_termux_test.v', // platform filtering not baked into v test-self
'vlib/v/tests/filtering_macos_test.v', // platform filtering not baked into v test-self
'vlib/v/tests/filtering_nix_test.v', // platform filtering not baked into v test-self
'vlib/v/tests/filtering_windows_test.v', // platform filtering not baked into v test-self
]
// These tests are too slow to be run in the CI on each PR/commit
// in the sanitized modes:
Expand Down
14 changes: 0 additions & 14 deletions cmd/tools/vtest.v
Expand Up @@ -5,8 +5,6 @@ import os.cmdline
import testing
import v.pref

const host_os = pref.get_host_os()

struct Context {
mut:
verbose bool
Expand Down Expand Up @@ -132,18 +130,6 @@ enum ShouldTestStatus {
}

fn (mut ctx Context) should_test(path string, backend string) ShouldTestStatus {
// Skip OS-specific tests if we are not running that OS
// Special case for android_outside_termux because of its
// underscores
if path.ends_with('_android_outside_termux_test.v') {
if !host_os.is_target_of('android_outside_termux') {
return .skip
}
}
os_target := path.all_before_last('_test.v').all_after_last('_')
if !host_os.is_target_of(os_target) {
return .skip
}
if path.ends_with('mysql_orm_test.v') {
testing.find_started_process('mysqld') or { return .skip }
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f43b528

Please sign in to comment.