meson: ::1 generates DEPRECATION: ":" is not allowed in test name, 它已被替换为 "_"

meson: ::1 generates DEPRECATION: ":" is not allowed in test name, it has been replaced with "_"

我有一个介子测试,测试 ping ::1

args = ['-c 1', '::1']
name = 'ping ' + ' '.join(args) # 'ping -c1 ::1'
test(name, ping, args : args)

meson test 生成:

meson.build:94: DEPRECATION: ":" is not allowed in test name "ping -c::1", it has been replaced with "_"
...
1/1 ping -c1 __1            OK             0.02s

但我真的很想打印正在发出的命令,因为即使 meson test -v 也不会打印命令。

看起来您的介子版本 >= 0.56,因为此 check/deprecation 是 this commit that adds support of running subproject tests 使用带有“:”的语法的结果,该语法将子项目的名称与测试名称分隔开来,例如:

meson test subprojectname:testname

因此,显然,它必须被替换以避免将名称的一部分误解为不存在的子项目(因此您只看到关于此的警告,它被替换为“_”)。

该提交也有关于“:”的具体推理

Also forbid ':' in test names. We already forbid this elsewhere, so
should not be a big deal.

所以,你的选择是始终将介子保持在 0.56 以下(我在我的 0.49 上检查了你的代码并且它有效)这显然不好,或者调整你的测试名称:

test('test_ping_loopback', ping, args : args)