Skip to content

Commit 63603f4

Browse files
authored
tests: support using both pkg-config and pkgconf for checking the presence of development packages for the different sets of tests (#26150)
1 parent 3f9139b commit 63603f4

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

cmd/tools/modules/testing/common.v

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@ pub const test_only_fn = os.getenv('VTEST_ONLY_FN').split_any(',')
5050
// Note, it works with `-no-parallel`, and it works when that whole expr is inside a function, like below:
5151
pub const fail_retry_delay_ms = get_fail_retry_delay_ms()
5252

53+
pub const pkgcmd = get_pkgcmd()
54+
5355
pub const is_node_present = os.execute('node --version').exit_code == 0
5456

5557
pub const is_go_present = os.execute('go version').exit_code == 0
5658

5759
pub const is_ruby_present = os.execute('ruby --version').exit_code == 0
58-
&& os.execute('pkg-config ruby --libs').exit_code == 0
60+
&& os.execute('${pkgcmd} ruby --libs').exit_code == 0
5961

6062
pub const is_python_present = os.execute('python --version').exit_code == 0
61-
&& os.execute('pkg-config python3 --libs').exit_code == 0
63+
&& os.execute('${pkgcmd} python3 --libs').exit_code == 0
6264

6365
pub const is_sqlite3_present = get_present_sqlite()
6466

@@ -78,12 +80,21 @@ fn get_fail_retry_delay_ms() time.Duration {
7880
return os.getenv_opt('VTEST_FAIL_RETRY_DELAY_MS') or { '500' }.int() * time.millisecond
7981
}
8082

83+
fn get_pkgcmd() string {
84+
for cmd in ['pkgconf', 'pkg-config'] {
85+
if os.execute('${cmd} --version').exit_code == 0 {
86+
return cmd
87+
}
88+
}
89+
return 'false'
90+
}
91+
8192
fn get_present_sqlite() bool {
8293
if os.user_os() == 'windows' {
8394
return os.exists(@VEXEROOT + '/thirdparty/sqlite/sqlite3.c')
8495
}
8596
return os.execute('sqlite3 --version').exit_code == 0
86-
&& os.execute('pkg-config sqlite3 --libs').exit_code == 0
97+
&& os.execute('${pkgcmd} sqlite3 --libs').exit_code == 0
8798
}
8899

89100
fn get_all_processes() []string {
@@ -928,10 +939,10 @@ fn check_openssl_present() bool {
928939
}
929940
$if openbsd {
930941
return os.execute('eopenssl35 --version').exit_code == 0
931-
&& os.execute('pkg-config eopenssl35 --libs').exit_code == 0
942+
&& os.execute('${pkgcmd} eopenssl35 --libs').exit_code == 0
932943
} $else {
933944
return os.execute('openssl --version').exit_code == 0
934-
&& os.execute('pkg-config openssl --libs').exit_code == 0
945+
&& os.execute('${pkgcmd} openssl --libs').exit_code == 0
935946
}
936947
}
937948

0 commit comments

Comments
 (0)