aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/subsystem/raw_extractor_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-02-10 12:14:36 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-02-10 14:34:44 +0100
commit95871dcc45f6531b4c692ff892aad56bdd95e16f (patch)
tree95c8ffe8b8a36b1dc9473cc3a07e7286595e0b2f /pkg/subsystem/raw_extractor_test.go
parent0ee9f5fa4e372b5a2da4ac27418e6c5bccbcaf7a (diff)
pkg/subsystem: restructure the package
Remove the entity and match subpackages. Regenerate the linux.go file.
Diffstat (limited to 'pkg/subsystem/raw_extractor_test.go')
-rw-r--r--pkg/subsystem/raw_extractor_test.go27
1 files changed, 13 insertions, 14 deletions
diff --git a/pkg/subsystem/raw_extractor_test.go b/pkg/subsystem/raw_extractor_test.go
index 9d221af86..44273be2e 100644
--- a/pkg/subsystem/raw_extractor_test.go
+++ b/pkg/subsystem/raw_extractor_test.go
@@ -6,23 +6,22 @@ package subsystem
import (
"testing"
- "github.com/google/syzkaller/pkg/subsystem/entity"
"github.com/stretchr/testify/assert"
)
func TestSubsystemExtractor(t *testing.T) {
- ioUring := &entity.Subsystem{
+ ioUring := &Subsystem{
Name: "io_uring",
- PathRules: []entity.PathRule{
+ PathRules: []PathRule{
{
IncludeRegexp: `io_uring/.*`,
},
},
Syscalls: []string{"syz_io_uring_setup"},
}
- security := &entity.Subsystem{
+ security := &Subsystem{
Name: "security",
- PathRules: []entity.PathRule{
+ PathRules: []PathRule{
{
IncludeRegexp: `security/.*`,
ExcludeRegexp: `security/selinux/.*`,
@@ -32,21 +31,21 @@ func TestSubsystemExtractor(t *testing.T) {
},
},
}
- net := &entity.Subsystem{
+ net := &Subsystem{
Name: "net",
- PathRules: []entity.PathRule{
+ PathRules: []PathRule{
{
IncludeRegexp: `net/.*`,
},
},
}
- obj := makeRawExtractor([]*entity.Subsystem{ioUring, security, net})
+ obj := makeRawExtractor([]*Subsystem{ioUring, security, net})
// Verify path matching.
- assert.ElementsMatch(t, obj.FromPath(`io_uring/file.c`), []*entity.Subsystem{ioUring})
- assert.ElementsMatch(t, obj.FromPath(`security/file.c`), []*entity.Subsystem{security})
- assert.ElementsMatch(t, obj.FromPath(`security/selinux/file.c`), []*entity.Subsystem{})
- assert.ElementsMatch(t, obj.FromPath(`net/ipv6/calipso.c`), []*entity.Subsystem{net, security})
+ assert.ElementsMatch(t, obj.FromPath(`io_uring/file.c`), []*Subsystem{ioUring})
+ assert.ElementsMatch(t, obj.FromPath(`security/file.c`), []*Subsystem{security})
+ assert.ElementsMatch(t, obj.FromPath(`security/selinux/file.c`), []*Subsystem{})
+ assert.ElementsMatch(t, obj.FromPath(`net/ipv6/calipso.c`), []*Subsystem{net, security})
// Verify prog matching.
// nolint: lll
@@ -60,10 +59,10 @@ r3 = openat$ptmx(0xffffffffffffff9c, &(0x7f0000000040), 0x8a04, 0x0)
syz_io_uring_submit(r1, r2, &(0x7f0000000000)=@IORING_OP_READ=@pass_buffer={0x16, 0x0, 0x0, @fd_index=0x5, 0x0, 0x0}, 0x0)
ioctl$TIOCSETD(r3, 0x5423, &(0x7f0000000580)=0x3)
io_uring_enter(r0, 0x2ff, 0x0, 0x0, 0x0, 0x0)`)),
- []*entity.Subsystem{ioUring})
+ []*Subsystem{ioUring})
// nolint: lll
assert.ElementsMatch(t, obj.FromProg([]byte(
`syz_mount_image$nilfs2(&(0x7f0000000000), &(0x7f0000000100)='./file0\x00', 0x100000, 0x3b, &(0x7f0000000200)=[{&(0x7f0000011240)="02", 0x1}, {&(0x7f0000012a40)="03000000", 0x4, 0x1}], 0x0, &(0x7f00000131c0), 0x1)
openat$incfs(0xffffffffffffff9c, &(0x7f0000000000)='.pending_reads\x00', 0x4040, 0x0)`)),
- []*entity.Subsystem{})
+ []*Subsystem{})
}