Move main methods for benchmark packages main package file.

PiperOrigin-RevId: 321875119
This commit is contained in:
Zach Koopmans
2020-07-17 16:23:10 -07:00
committed by gVisor bot
parent 03c30ec634
commit e3c2bd51a1
6 changed files with 34 additions and 22 deletions
+3 -4
View File
@@ -4,7 +4,9 @@ package(licenses = ["notice"])
go_library(
name = "fs",
testonly = 1,
srcs = ["fs.go"],
deps = ["//test/benchmarks/harness"],
)
go_test(
@@ -17,8 +19,5 @@ go_test(
"local",
"manual",
],
deps = [
"//pkg/test/dockerutil",
"//test/benchmarks/harness",
],
deps = ["//pkg/test/dockerutil"],
)
-9
View File
@@ -15,16 +15,12 @@ package fs
import (
"context"
"os"
"strings"
"testing"
"gvisor.dev/gvisor/pkg/test/dockerutil"
"gvisor.dev/gvisor/test/benchmarks/harness"
)
var h harness.Harness
// Note: CleanCache versions of this test require running with root permissions.
func BenchmarkABSL(b *testing.B) {
// Get a machine from the Harness on which to run.
@@ -97,8 +93,3 @@ func BenchmarkABSL(b *testing.B) {
})
}
}
func TestMain(m *testing.M) {
h.Init()
os.Exit(m.Run())
}
+15
View File
@@ -14,3 +14,18 @@
// Package fs holds benchmarks around filesystem performance.
package fs
import (
"os"
"testing"
"gvisor.dev/gvisor/test/benchmarks/harness"
)
var h harness.Harness
// TestMain is the main method for package fs.
func TestMain(m *testing.M) {
h.Init()
os.Exit(m.Run())
}
+1
View File
@@ -6,6 +6,7 @@ go_library(
name = "network",
testonly = 1,
srcs = ["network.go"],
deps = ["//test/benchmarks/harness"],
)
go_test(
-9
View File
@@ -16,7 +16,6 @@ package network
import (
"context"
"fmt"
"os"
"regexp"
"strconv"
"strings"
@@ -26,8 +25,6 @@ import (
"gvisor.dev/gvisor/test/benchmarks/harness"
)
var h harness.Harness
func BenchmarkIperf(b *testing.B) {
// Get two machines
@@ -144,10 +141,4 @@ TCP window size: 45.0 KByte (default)
if err != nil || bandwidth != 45900 {
t.Fatalf("failed with: %v and %f", err, bandwidth)
}
}
func TestMain(m *testing.M) {
h.Init()
os.Exit(m.Run())
}
+15
View File
@@ -14,3 +14,18 @@
// Package network holds benchmarks around raw network performance.
package network
import (
"os"
"testing"
"gvisor.dev/gvisor/test/benchmarks/harness"
)
var h harness.Harness
// TestMain is the main method for package network.
func TestMain(m *testing.M) {
h.Init()
os.Exit(m.Run())
}