tools: use the same same skipping logic for the platform specific _test.v files in v test-self too (#20815)

This commit is contained in:
Delyan Angelov 2024-02-13 18:36:51 +02:00 committed by GitHub
parent 8215f21585
commit f43b52860d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 19 additions and 18 deletions

View file

@ -13,6 +13,8 @@ import runtime
import rand import rand
import strings import strings
pub const host_os = pref.get_host_os()
pub const github_job = os.getenv('GITHUB_JOB') pub const github_job = os.getenv('GITHUB_JOB')
pub const runner_os = os.getenv('RUNNER_OS') // GitHub runner OS pub const runner_os = os.getenv('RUNNER_OS') // GitHub runner OS
@ -386,6 +388,23 @@ pub fn (mut ts TestSession) test() {
if ts.build_tools && dot_relative_file.ends_with('_test.v') { if ts.build_tools && dot_relative_file.ends_with('_test.v') {
continue 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 << dot_relative_file
} }
remaining_files = vtest.filter_vtest_only(remaining_files, fix_slashes: false) remaining_files = vtest.filter_vtest_only(remaining_files, fix_slashes: false)

View file

@ -94,10 +94,6 @@ const skip_test_files = [
'vlib/db/pg/pg_orm_test.v', // pg not installed 'vlib/db/pg/pg_orm_test.v', // pg not installed
'vlib/db/pg/pg_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/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 // These tests are too slow to be run in the CI on each PR/commit
// in the sanitized modes: // in the sanitized modes:

View file

@ -5,8 +5,6 @@ import os.cmdline
import testing import testing
import v.pref import v.pref
const host_os = pref.get_host_os()
struct Context { struct Context {
mut: mut:
verbose bool verbose bool
@ -132,18 +130,6 @@ enum ShouldTestStatus {
} }
fn (mut ctx Context) should_test(path string, backend string) 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') { if path.ends_with('mysql_orm_test.v') {
testing.find_started_process('mysqld') or { return .skip } testing.find_started_process('mysqld') or { return .skip }
} }