-
Notifications
You must be signed in to change notification settings - Fork 162
Expand file tree
/
Copy pathmain.go
More file actions
47 lines (37 loc) · 984 Bytes
/
main.go
File metadata and controls
47 lines (37 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"flag"
"fmt"
"os"
"regexp"
"testing"
)
var (
validate = flag.Bool("validate", false, "to validate the correctness of the serializers")
genReport = flag.Bool("genreport", false, "to re-generate the report")
nameFlag = flag.String("name", "", "restrict benchmarks to run only if they match this regexp")
)
func main() {
flag.Parse()
fmt.Printf(`A test suite for benchmarking various Go serialization methods.
See README.md for details on running the benchmarks.
Validating = %t
Re-Generating Report = %t
`, *validate, *genReport)
var nameRe *regexp.Regexp
if *nameFlag != "" {
var err error
nameRe, err = regexp.Compile(*nameFlag)
if err != nil {
fmt.Printf("Error compiling -name regexp: %v\n", err)
os.Exit(1)
}
}
// Manually call testing.Init(), otherwise validation errors may cause
// internal panics.
testing.Init()
err := BenchAndReportSerializers(*genReport, *validate, nameRe)
if err != nil {
panic(err)
}
}