Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #397 from mozilla-services/347-omnija-benchmark
347 omnija benchmark
- Loading branch information
Showing
5 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
signer/xpi/test/fixtures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package xpi | ||
|
||
import ( | ||
"io/ioutil" | ||
"testing" | ||
"time" | ||
|
||
"go.mozilla.org/autograph/signer" | ||
) | ||
|
||
func BenchmarkResignOmnija(b *testing.B) { | ||
var ( | ||
err error = nil | ||
omnijaBytes, browserOmnijaBytes []byte | ||
) | ||
|
||
omnijaBytes, err = ioutil.ReadFile("test/fixtures/firefox-70.0.1/omni.ja") | ||
if err != nil { | ||
b.Fatalf("failed to read omni.ja test file with: %s", err) | ||
} | ||
browserOmnijaBytes, err = ioutil.ReadFile("test/fixtures/firefox-70.0.1/browser/omni.ja") | ||
if err != nil { | ||
b.Fatalf("failed to read omni.ja test file with: %s", err) | ||
} | ||
|
||
// initialize a system addon signer with an RSA key | ||
testcase := PASSINGTESTCASES[1] | ||
|
||
// don't use an RSA key cache | ||
testcase.RSACacheConfig = signer.RSACacheConfig{ | ||
NumKeys: 0, | ||
NumGenerators: 0, | ||
GeneratorSleepDuration: 10 * time.Minute, | ||
FetchTimeout: 0, | ||
StatsSampleRate: 10 * time.Minute, | ||
} | ||
|
||
s, err := New(testcase, nil) | ||
if err != nil { | ||
b.Fatalf("signer initialization failed with: %v", err) | ||
} | ||
signOptions := Options{ | ||
ID: "omnija+benchmark@mozilla.com", | ||
COSEAlgorithms: []string{"ES256"}, | ||
PKCS7Digest: "SHA256", | ||
} | ||
|
||
for n := 0; n < b.N; n++ { | ||
// sign both omni.ja files once | ||
_, err = s.SignFile(omnijaBytes, signOptions) | ||
if err != nil { | ||
b.Fatalf("failed to sign omni.ja: %v", err) | ||
} | ||
_, err = s.SignFile(browserOmnijaBytes, signOptions) | ||
if err != nil { | ||
b.Fatalf("failed to sign browser/omni.ja: %v", err) | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.