From e603b688ca6d023b783e58f3876430ea73dd21a6 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 6 Sep 2025 12:59:33 +0900 Subject: [PATCH] system/dispatcher: expose test reporting to builder This is currently unused but useful for builders with errors. Signed-off-by: Ophestra --- system/acl_test.go | 12 ++++++------ system/dispatcher_test.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/system/acl_test.go b/system/acl_test.go index 897ea33..a92e38b 100644 --- a/system/acl_test.go +++ b/system/acl_test.go @@ -57,7 +57,7 @@ func TestACLUpdateOp(t *testing.T) { checkOpsBuilder(t, "UpdatePerm", []opsBuilderTestCase{ {"simple", 0xdeadbeef, - func(sys *I) { + func(_ *testing.T, sys *I) { sys. UpdatePerm("/run/user/1971/hakurei", acl.Execute). UpdatePerm("/tmp/hakurei.0/tmpdir/150", acl.Read, acl.Write, acl.Execute) @@ -67,25 +67,25 @@ func TestACLUpdateOp(t *testing.T) { }, stub.Expect{}}, }) checkOpsBuilder(t, "UpdatePermType", []opsBuilderTestCase{ - {"tmpdirp", 0xdeadbeef, func(sys *I) { + {"tmpdirp", 0xdeadbeef, func(_ *testing.T, sys *I) { sys.UpdatePermType(User, "/tmp/hakurei.0/tmpdir", acl.Execute) }, []Op{ &ACLUpdateOp{User, "/tmp/hakurei.0/tmpdir", []acl.Perm{acl.Execute}}, }, stub.Expect{}}, - {"tmpdir", 0xdeadbeef, func(sys *I) { + {"tmpdir", 0xdeadbeef, func(_ *testing.T, sys *I) { sys.UpdatePermType(User, "/tmp/hakurei.0/tmpdir/150", acl.Read, acl.Write, acl.Execute) }, []Op{ &ACLUpdateOp{User, "/tmp/hakurei.0/tmpdir/150", []acl.Perm{acl.Read, acl.Write, acl.Execute}}, }, stub.Expect{}}, - {"share", 0xdeadbeef, func(sys *I) { + {"share", 0xdeadbeef, func(_ *testing.T, sys *I) { sys.UpdatePermType(Process, "/run/user/1971/hakurei/fcb8a12f7c482d183ade8288c3de78b5", acl.Execute) }, []Op{ &ACLUpdateOp{Process, "/run/user/1971/hakurei/fcb8a12f7c482d183ade8288c3de78b5", []acl.Perm{acl.Execute}}, }, stub.Expect{}}, - {"passwd", 0xdeadbeef, func(sys *I) { + {"passwd", 0xdeadbeef, func(_ *testing.T, sys *I) { sys. UpdatePermType(Process, "/tmp/hakurei.0/fcb8a12f7c482d183ade8288c3de78b5/passwd", acl.Read). UpdatePermType(Process, "/tmp/hakurei.0/fcb8a12f7c482d183ade8288c3de78b5/group", acl.Read) @@ -94,7 +94,7 @@ func TestACLUpdateOp(t *testing.T) { &ACLUpdateOp{Process, "/tmp/hakurei.0/fcb8a12f7c482d183ade8288c3de78b5/group", []acl.Perm{acl.Read}}, }, stub.Expect{}}, - {"wayland", 0xdeadbeef, func(sys *I) { + {"wayland", 0xdeadbeef, func(_ *testing.T, sys *I) { sys.UpdatePermType(EWayland, "/run/user/1971/wayland-0", acl.Read, acl.Write, acl.Execute) }, []Op{ &ACLUpdateOp{EWayland, "/run/user/1971/wayland-0", []acl.Perm{acl.Read, acl.Write, acl.Execute}}, diff --git a/system/dispatcher_test.go b/system/dispatcher_test.go index 53d2b66..7c7c10c 100644 --- a/system/dispatcher_test.go +++ b/system/dispatcher_test.go @@ -75,7 +75,7 @@ func checkOpBehaviour(t *testing.T, testCases []opBehaviourTestCase) { type opsBuilderTestCase struct { name string uid int - f func(sys *I) + f func(t *testing.T, sys *I) want []Op exp stub.Expect } @@ -92,7 +92,7 @@ func checkOpsBuilder(t *testing.T, fname string, testCases []opsBuilderTestCase) sys, s := InternalNew(t, tc.exp, tc.uid) defer stub.HandleExit(t) - tc.f(sys) + tc.f(t, sys) s.VisitIncomplete(func(s *stub.Stub[syscallDispatcher]) { t.Helper()