Testing 转到test`-parallel`vs`-test.parallel`哪个标志优先?

Testing 转到test`-parallel`vs`-test.parallel`哪个标志优先?,testing,go,Testing,Go,go test的两个标志-parallel和-test.parallel之间的差异以及哪个标志优先 -parallel n Allow parallel execution of test functions that call t.Parallel. The value of this flag is the maximum number of tests to run simultaneously; by default

go test
的两个标志
-parallel
-test.parallel
之间的差异以及哪个标志优先

-parallel n
            Allow parallel execution of test functions that call t.Parallel.
            The value of this flag is the maximum number of tests to run
            simultaneously; by default, it is set to the value of GOMAXPROCS.
            Note that -parallel only applies within a single test binary.
            The 'go test' command may run tests for different packages
            in parallel as well, according to the setting of the -p flag
            (see 'go help build').
上面的文档说明,如果没有提供任何内容,并行运行的测试数量等于
GOMAXPROCS
,但对我来说,行为与此不同。因为我在一台只有4核的机器上运行测试。但对我来说,8个测试是并行运行的,因此其行为更像如下所示:

-test.parallel int
        maximum test parallelism (default 8)
那么这两者的区别是什么呢?何时使用哪个标志

更多信息
我在一个包含9个测试的包上运行所有测试,所有测试都并行运行,所有这些测试都存在于单个测试函数中。

通过
go test
命令生成
标志。
go test
命令动态生成一个
pkg.test
二进制文件,并使用修改后的参数运行它。传递给
go test
的所有已识别参数都将被转换。因此,在您的例子中:
-parallel n
变成了
-test.parallel n

所以这个命令:

go test -parallel 6
创建:

pkg.test -test.parallel 6

您必须显示a)代码和b)如何执行测试(通过
go test
或通过运行编译的测试二进制文件),并显示GOMAXPROCS的值(在env中和执行期间)。我认为这是正确的行为,因此我正在对具有4个内核的VM中的集群运行端到端测试,但是我的主机有8个内核,所以功能看起来不错。很抱歉出现噪音。@Volker我认为代码根本不相关-这是一个关于
go test
命令中记录的标志的简单问题,并不特定于正在运行的代码。