Skip to content

Commit 385ae6c

Browse files
committed
tools: add support for // vtest build: !os_id_ubuntu? tags in the _test.v files, detected by v test
1 parent eee32e5 commit 385ae6c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎cmd/tools/modules/testing/common.v‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,23 @@ pub fn (mut ts TestSession) setup_build_environment() {
908908
if is_openssl_present {
909909
defines << 'present_openssl'
910910
}
911+
912+
// detect the linux distribution as well when possible:
913+
if os.is_file('/etc/os-release') {
914+
mut distro_kind := ''
915+
if lines := os.read_lines('/etc/os-release') {
916+
for line in lines {
917+
if line.starts_with('ID=') {
918+
distro_kind = line.all_after('ID=')
919+
break
920+
}
921+
}
922+
}
923+
if distro_kind != '' {
924+
defines << 'os_id_${distro_kind}' // os_id_alpine, os_id_freebsd, os_id_ubuntu, os_id_debian etc
925+
}
926+
}
927+
911928
defines << ts.custom_defines
912929
$if trace_vbuild ? {
913930
eprintln('>>> testing.get_build_environment facts: ${facts}')

0 commit comments

Comments
 (0)