diff options
author | Zach Koopmans <zkoopmans@google.com> | 2020-07-17 16:13:44 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-07-17 16:23:10 -0700 |
commit | e3c2bd51a1a970991cce71d6994bb053c546e538 (patch) | |
tree | 0363d1825f3959c63959f6baa2d085c6c17b4095 /test/benchmarks/network | |
parent | 03c30ec634e529eb0f0051b0de03d4811706fe72 (diff) |
Move main methods for benchmark packages main package file.
PiperOrigin-RevId: 321875119
Diffstat (limited to 'test/benchmarks/network')
-rw-r--r-- | test/benchmarks/network/BUILD | 1 | ||||
-rw-r--r-- | test/benchmarks/network/iperf_test.go | 9 | ||||
-rw-r--r-- | test/benchmarks/network/network.go | 15 |
3 files changed, 16 insertions, 9 deletions
diff --git a/test/benchmarks/network/BUILD b/test/benchmarks/network/BUILD index ea78416cf..16d267bc8 100644 --- a/test/benchmarks/network/BUILD +++ b/test/benchmarks/network/BUILD @@ -6,6 +6,7 @@ go_library( name = "network", testonly = 1, srcs = ["network.go"], + deps = ["//test/benchmarks/harness"], ) go_test( diff --git a/test/benchmarks/network/iperf_test.go b/test/benchmarks/network/iperf_test.go index 48cc9dd8f..664e0797e 100644 --- a/test/benchmarks/network/iperf_test.go +++ b/test/benchmarks/network/iperf_test.go @@ -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()) } diff --git a/test/benchmarks/network/network.go b/test/benchmarks/network/network.go index f480b5bcd..ce17ddb94 100644 --- a/test/benchmarks/network/network.go +++ b/test/benchmarks/network/network.go @@ -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()) +} |