Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
jar: add parallel Parse test
Browse files Browse the repository at this point in the history
  • Loading branch information
mknyszek authored and ericchiang committed Jan 6, 2022
1 parent 32c2a16 commit 96b3273
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions jar/jar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ func BenchmarkParse(b *testing.B) {
}
}

func BenchmarkParseParallel(b *testing.B) {
filename := "safe1.jar"
p := testdataPath(filename)
b.ReportAllocs()
b.RunParallel(func(pb *testing.PB) {
zr, _, err := OpenReader(p)
if err != nil {
b.Fatalf("zip.OpenReader failed: %v", err)
}
defer zr.Close()
for pb.Next() {
_, err := Parse(&zr.Reader)
if err != nil {
b.Errorf("Scan() returned an unexpected error, got %v, want nil", err)
}
}
})
}

func TestYARARule(t *testing.T) {
data := []byte{
0x3c, 0x69, 0x6e, 0x69, 0x74, 0x3e,
Expand Down

0 comments on commit 96b3273

Please sign in to comment.