From f67b38c100fe027e65530ef702b7b4dc45b53ccd Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 10 Jan 2023 12:03:02 +0100 Subject: pkg/subsystem: add the MAINTAINERS file parsing code --- pkg/subsystem/linux/maintainers_test.go | 174 ++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 pkg/subsystem/linux/maintainers_test.go (limited to 'pkg/subsystem/linux/maintainers_test.go') diff --git a/pkg/subsystem/linux/maintainers_test.go b/pkg/subsystem/linux/maintainers_test.go new file mode 100644 index 000000000..874bdcaa7 --- /dev/null +++ b/pkg/subsystem/linux/maintainers_test.go @@ -0,0 +1,174 @@ +// Copyright 2023 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package linux + +import ( + "strings" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestLinuxMaintainers(t *testing.T) { + result, err := parseLinuxMaintainers( + strings.NewReader(maintainersSample), + ) + if err != nil { + t.Fatal(err) + } + targetResult := []*maintainersRecord{ + { + name: "3C59X NETWORK DRIVER", + includePatterns: []string{ + "Documentation/networking/device_drivers/ethernet/3com/vortex.rst", + "drivers/net/ethernet/3com/3c59x.c", + }, + lists: []string{"netdev@vger.kernel.org"}, + maintainers: []string{"email1@kernel.org"}, + }, + { + name: "ABI/API", + includePatterns: []string{ + "include/linux/syscalls.h", + "kernel/sys_ni.c", + }, + excludePatterns: []string{ + "include/uapi/", + "arch/*/include/uapi/", + }, + lists: []string{"linux-api@vger.kernel.org"}, + }, + { + name: "AD1889 ALSA SOUND DRIVER", + includePatterns: []string{"sound/pci/ad1889.*"}, + lists: []string{"linux-parisc@vger.kernel.org"}, + }, + { + name: "PVRUSB2 VIDEO4LINUX DRIVER", + includePatterns: []string{ + "Documentation/driver-api/media/drivers/pvrusb2*", + "drivers/media/usb/pvrusb2/", + }, + lists: []string{ + "pvrusb2@isely.net", + "linux-media@vger.kernel.org", + }, + maintainers: []string{"email2@kernel.org"}, + }, + { + name: "RISC-V ARCHITECTURE", + includePatterns: []string{"arch/riscv/"}, + regexps: []string{"riscv"}, + lists: []string{"linux-riscv@lists.infradead.org"}, + maintainers: []string{ + "email3@kernel.org", + "email4@kernel.org", + "email5@kernel.org", + }, + }, + { + name: "THE REST", + includePatterns: []string{"*", "*/"}, + lists: []string{"linux-kernel@vger.kernel.org"}, + maintainers: []string{"email6@kernel.org"}, + }, + } + if diff := cmp.Diff(targetResult, result, + cmp.AllowUnexported(maintainersRecord{})); diff != "" { + t.Fatal(diff) + } +} + +const maintainersSample = ` +List of maintainers and how to submit kernel changes +==================================================== + +Please try to follow the guidelines below. This will make things +easier on the maintainers. Not all of these guidelines matter for every +trivial patch so apply some common sense. + +Tips for patch submitters +------------------------- + +1. Always *test* your changes, however small, on at least 4 or + 5 people, preferably many more. + +< ... > + +8. Happy hacking. + +Descriptions of section entries and preferred order +--------------------------------------------------- + + M: *Mail* patches to: FullName + R: Designated *Reviewer*: FullName + These reviewers should be CCed on patches. +< ... > + K: *Content regex* (perl extended) pattern match in a patch or file. + For instance: + K: of_get_profile + matches patches or files that contain "of_get_profile" + K: \b(printk|pr_(info|err))\b + matches patches or files that contain one or more of the words + printk, pr_info or pr_err + One regex pattern per line. Multiple K: lines acceptable. + +Maintainers List +---------------- + +.. note:: When reading this list, please look for the most precise areas + first. When adding to this list, please keep the entries in + alphabetical order. + +3C59X NETWORK DRIVER +M: Name1 Surname +L: netdev@vger.kernel.org +S: Odd Fixes +F: Documentation/networking/device_drivers/ethernet/3com/vortex.rst +F: drivers/net/ethernet/3com/3c59x.c + +ABI/API +L: linux-api@vger.kernel.org +F: include/linux/syscalls.h +F: kernel/sys_ni.c +X: include/uapi/ +X: arch/*/include/uapi/ + +AD1889 ALSA SOUND DRIVER +L: linux-parisc@vger.kernel.org +S: Maintained +W: https://parisc.wiki.kernel.org/index.php/AD1889 +F: sound/pci/ad1889.* + +PVRUSB2 VIDEO4LINUX DRIVER +M: Name2 +L: pvrusb2@isely.net (subscribers-only) +L: linux-media@vger.kernel.org +S: Maintained +W: http://www.isely.net/pvrusb2/ +T: git git://linuxtv.org/media_tree.git +F: Documentation/driver-api/media/drivers/pvrusb2* +F: drivers/media/usb/pvrusb2/ + +RISC-V ARCHITECTURE +M: Name3 +M: Name4 +M: Name5 +L: linux-riscv@lists.infradead.org +S: Supported +Q: https://patchwork.kernel.org/project/linux-riscv/list/ +P: Documentation/riscv/patch-acceptance.rst +T: git git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git +F: arch/riscv/ +N: riscv +K: riscv + +THE REST +M: Name6 +L: linux-kernel@vger.kernel.org +S: Buried alive in reporters +T: git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git +F: * +F: */ +` -- cgit mrf-deployment