internal/system: optional op check parallelism
All checks were successful
Test / Create distribution (push) Successful in 40s
Test / Sandbox (push) Successful in 2m46s
Test / Sandbox (race detector) (push) Successful in 4m46s
Test / Hpkg (push) Successful in 5m17s
Test / Hakurei (push) Successful in 5m32s
Test / Hakurei (race detector) (push) Successful in 6m47s
Test / Flake checks (push) Successful in 1m33s
All checks were successful
Test / Create distribution (push) Successful in 40s
Test / Sandbox (push) Successful in 2m46s
Test / Sandbox (race detector) (push) Successful in 4m46s
Test / Hpkg (push) Successful in 5m17s
Test / Hakurei (push) Successful in 5m32s
Test / Hakurei (race detector) (push) Successful in 6m47s
Test / Flake checks (push) Successful in 1m33s
The PipeWire Op check cannot be made parallel due to the OS interaction. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
7c6fc1128b
commit
1b17ccda91
@ -13,7 +13,7 @@ import (
|
|||||||
func TestACLUpdateOp(t *testing.T) {
|
func TestACLUpdateOp(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
checkOpBehaviour(t, []opBehaviourTestCase{
|
checkOpBehaviour(t, 0, []opBehaviourTestCase{
|
||||||
{"apply aclUpdate", 0xbeef, 0xff,
|
{"apply aclUpdate", 0xbeef, 0xff,
|
||||||
&aclUpdateOp{Process, "/proc/nonexistent", []acl.Perm{acl.Read, acl.Write, acl.Execute}}, []stub.Call{
|
&aclUpdateOp{Process, "/proc/nonexistent", []acl.Perm{acl.Read, acl.Write, acl.Execute}}, []stub.Call{
|
||||||
call("verbose", stub.ExpectArgs{[]any{"applying ACL", &aclUpdateOp{Process, "/proc/nonexistent", []acl.Perm{acl.Read, acl.Write, acl.Execute}}}}, nil, nil),
|
call("verbose", stub.ExpectArgs{[]any{"applying ACL", &aclUpdateOp{Process, "/proc/nonexistent", []acl.Perm{acl.Read, acl.Write, acl.Execute}}}}, nil, nil),
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import (
|
|||||||
func TestDBusProxyOp(t *testing.T) {
|
func TestDBusProxyOp(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
checkOpBehaviour(t, []opBehaviourTestCase{
|
checkOpBehaviour(t, 0, []opBehaviourTestCase{
|
||||||
{"dbusProxyStart", 0xdead, 0xff, &dbusProxyOp{
|
{"dbusProxyStart", 0xdead, 0xff, &dbusProxyOp{
|
||||||
final: dbusNewFinalSample(4),
|
final: dbusNewFinalSample(4),
|
||||||
out: new(linePrefixWriter), // panics on write
|
out: new(linePrefixWriter), // panics on write
|
||||||
|
|||||||
@ -36,17 +36,26 @@ type opBehaviourTestCase struct {
|
|||||||
wantErrRevert error
|
wantErrRevert error
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkOpBehaviour(t *testing.T, testCases []opBehaviourTestCase) {
|
const (
|
||||||
|
// checkNoParallel causes checkOpBehaviour to skip setting tests as parallel.
|
||||||
|
checkNoParallel = 1 << iota
|
||||||
|
)
|
||||||
|
|
||||||
|
func checkOpBehaviour(t *testing.T, flags int, testCases []opBehaviourTestCase) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
t.Run("behaviour", func(t *testing.T) {
|
t.Run("behaviour", func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
t.Parallel()
|
if flags&checkNoParallel == 0 {
|
||||||
|
t.Parallel()
|
||||||
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
t.Parallel()
|
if flags&checkNoParallel == 0 {
|
||||||
|
t.Parallel()
|
||||||
|
}
|
||||||
|
|
||||||
var ec *Criteria
|
var ec *Criteria
|
||||||
if tc.ec != 0xff {
|
if tc.ec != 0xff {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import (
|
|||||||
func TestHardlinkOp(t *testing.T) {
|
func TestHardlinkOp(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
checkOpBehaviour(t, []opBehaviourTestCase{
|
checkOpBehaviour(t, 0, []opBehaviourTestCase{
|
||||||
{"link", 0xbeef, 0xff, &hardlinkOp{hst.EPulse, "/run/user/1000/hakurei/9663730666a44cfc2a81610379e02ed6/pulse", "/run/user/1000/pulse/native"}, []stub.Call{
|
{"link", 0xbeef, 0xff, &hardlinkOp{hst.EPulse, "/run/user/1000/hakurei/9663730666a44cfc2a81610379e02ed6/pulse", "/run/user/1000/pulse/native"}, []stub.Call{
|
||||||
call("verbose", stub.ExpectArgs{[]any{"linking", &hardlinkOp{hst.EPulse, "/run/user/1000/hakurei/9663730666a44cfc2a81610379e02ed6/pulse", "/run/user/1000/pulse/native"}}}, nil, nil),
|
call("verbose", stub.ExpectArgs{[]any{"linking", &hardlinkOp{hst.EPulse, "/run/user/1000/hakurei/9663730666a44cfc2a81610379e02ed6/pulse", "/run/user/1000/pulse/native"}}}, nil, nil),
|
||||||
call("link", stub.ExpectArgs{"/run/user/1000/pulse/native", "/run/user/1000/hakurei/9663730666a44cfc2a81610379e02ed6/pulse"}, nil, stub.UniqueError(1)),
|
call("link", stub.ExpectArgs{"/run/user/1000/pulse/native", "/run/user/1000/hakurei/9663730666a44cfc2a81610379e02ed6/pulse"}, nil, stub.UniqueError(1)),
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import (
|
|||||||
func TestMkdirOp(t *testing.T) {
|
func TestMkdirOp(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
checkOpBehaviour(t, []opBehaviourTestCase{
|
checkOpBehaviour(t, 0, []opBehaviourTestCase{
|
||||||
{"mkdir", 0xbeef, 0xff, &mkdirOp{User, "/tmp/hakurei.0/f2f3bcd492d0266438fa9bf164fe90d9", 0711, false}, []stub.Call{
|
{"mkdir", 0xbeef, 0xff, &mkdirOp{User, "/tmp/hakurei.0/f2f3bcd492d0266438fa9bf164fe90d9", 0711, false}, []stub.Call{
|
||||||
call("verbose", stub.ExpectArgs{[]any{"ensuring directory", &mkdirOp{User, "/tmp/hakurei.0/f2f3bcd492d0266438fa9bf164fe90d9", 0711, false}}}, nil, nil),
|
call("verbose", stub.ExpectArgs{[]any{"ensuring directory", &mkdirOp{User, "/tmp/hakurei.0/f2f3bcd492d0266438fa9bf164fe90d9", 0711, false}}}, nil, nil),
|
||||||
call("mkdir", stub.ExpectArgs{"/tmp/hakurei.0/f2f3bcd492d0266438fa9bf164fe90d9", os.FileMode(0711)}, nil, stub.UniqueError(2)),
|
call("mkdir", stub.ExpectArgs{"/tmp/hakurei.0/f2f3bcd492d0266438fa9bf164fe90d9", os.FileMode(0711)}, nil, stub.UniqueError(2)),
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import (
|
|||||||
func TestWaylandOp(t *testing.T) {
|
func TestWaylandOp(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
checkOpBehaviour(t, []opBehaviourTestCase{
|
checkOpBehaviour(t, 0, []opBehaviourTestCase{
|
||||||
{"chmod", 0xbeef, 0xff, &waylandOp{nil,
|
{"chmod", 0xbeef, 0xff, &waylandOp{nil,
|
||||||
m("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/wayland"),
|
m("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/wayland"),
|
||||||
m("/run/user/1971/wayland-0"),
|
m("/run/user/1971/wayland-0"),
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import (
|
|||||||
func TestXHostOp(t *testing.T) {
|
func TestXHostOp(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
checkOpBehaviour(t, []opBehaviourTestCase{
|
checkOpBehaviour(t, 0, []opBehaviourTestCase{
|
||||||
{"xcbChangeHosts revert", 0xbeef, hst.EX11, xhostOp("chronos"), []stub.Call{
|
{"xcbChangeHosts revert", 0xbeef, hst.EX11, xhostOp("chronos"), []stub.Call{
|
||||||
call("verbosef", stub.ExpectArgs{"inserting entry %s to X11", []any{xhostOp("chronos")}}, nil, nil),
|
call("verbosef", stub.ExpectArgs{"inserting entry %s to X11", []any{xhostOp("chronos")}}, nil, nil),
|
||||||
call("xcbChangeHosts", stub.ExpectArgs{xcb.HostMode(xcb.HostModeInsert), xcb.Family(xcb.FamilyServerInterpreted), "localuser\x00chronos"}, nil, stub.UniqueError(1)),
|
call("xcbChangeHosts", stub.ExpectArgs{xcb.HostMode(xcb.HostModeInsert), xcb.Family(xcb.FamilyServerInterpreted), "localuser\x00chronos"}, nil, stub.UniqueError(1)),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user