From 0e6628e0d76d6fd6ccb2f4966e144f13fdc68c5c Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 23 Feb 2023 19:30:35 +0100 Subject: tools/syz-query-subsystems: add filtering functionality Two more flags: - filter: allows to choose only a subset of the possible subsystems. - emails: allows to force empty Lists and Maintainers. --- pkg/subsystem/entities_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'pkg/subsystem/entities_test.go') diff --git a/pkg/subsystem/entities_test.go b/pkg/subsystem/entities_test.go index 58166b91b..81c970b65 100644 --- a/pkg/subsystem/entities_test.go +++ b/pkg/subsystem/entities_test.go @@ -39,3 +39,18 @@ func TestSubsystemEmails(t *testing.T) { "a@list.com", "b@list.com", "c@list.com", "d@list.com", "d@person.com", }) } + +func TestFilterList(t *testing.T) { + parentParent := &Subsystem{} + parentA := &Subsystem{Parents: []*Subsystem{parentParent}} + parentB := &Subsystem{Parents: []*Subsystem{parentParent}} + entity := &Subsystem{Parents: []*Subsystem{parentA, parentB}} + + newList := FilterList([]*Subsystem{parentA, parentB, parentParent, entity}, + func(s *Subsystem) bool { + return s != parentB + }, + ) + assert.Len(t, newList, 3) + assert.ElementsMatch(t, entity.Parents, []*Subsystem{parentA}) +} -- cgit mrf-deployment