Skip to content

Commit

Permalink
Make test specific to disassembleFilter function
Browse files Browse the repository at this point in the history
TestPatchHugeSeccompFilterDoesNotBlock is only testing the
disassembleFilter function. There is no need to invoke PatchAndLoad
which has the side effect of loading a seccomp profile.

Co-authored-by: Danail Branekov <danailster@gmail.com>
Co-authored-by: Kieron Browne <kbrowne@vmware.com>
Signed-off-by: Kieron Browne <kbrowne@vmware.com>
Signed-off-by: Danail Branekov <danailster@gmail.com>
  • Loading branch information
Kieron Browne and danail-branekov committed Mar 30, 2021
1 parent 7b3e0bc commit 08b5279
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libcontainer/seccomp/patchbpf/enosys_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func TestEnosysStub_MultiArch(t *testing.T) {
}
}

func TestPatchHugeSeccompFilterDoesNotBlock(t *testing.T) {
func TestDisassembleHugeFilterDoesNotHang(t *testing.T) {
hugeFilter, err := libseccomp.NewFilter(libseccomp.ActAllow)
if err != nil {
t.Fatalf("failed to create seccomp filter: %v", err)
Expand All @@ -294,8 +294,10 @@ func TestPatchHugeSeccompFilterDoesNotBlock(t *testing.T) {
}
}

config := fakeConfig(configs.Kill, []string{}, []string{"amd64"})
PatchAndLoad(config, hugeFilter)
_, err = disassembleFilter(hugeFilter)
if err != nil {
t.Fatalf("failed to disassembleFilter: %v", err)
}

// if we exit, we did not block
// if we exit, we did not hang
}

0 comments on commit 08b5279

Please sign in to comment.