summaryrefslogtreecommitdiffhomepage
path: root/test/benchmarks/media
diff options
context:
space:
mode:
Diffstat (limited to 'test/benchmarks/media')
-rw-r--r--test/benchmarks/media/BUILD5
-rw-r--r--test/benchmarks/media/ffmpeg_test.go12
-rw-r--r--test/benchmarks/media/media.go15
3 files changed, 12 insertions, 20 deletions
diff --git a/test/benchmarks/media/BUILD b/test/benchmarks/media/BUILD
index 46e8dc8b5..380783f0b 100644
--- a/test/benchmarks/media/BUILD
+++ b/test/benchmarks/media/BUILD
@@ -7,12 +7,11 @@ go_library(
name = "media",
testonly = 1,
srcs = ["media.go"],
- deps = ["//test/benchmarks/harness"],
)
benchmark_test(
- name = "media_test",
- size = "large",
+ name = "ffmpeg_test",
+ size = "enormous",
srcs = ["ffmpeg_test.go"],
library = ":media",
visibility = ["//:sandbox"],
diff --git a/test/benchmarks/media/ffmpeg_test.go b/test/benchmarks/media/ffmpeg_test.go
index 7822dfad7..a462ec2a6 100644
--- a/test/benchmarks/media/ffmpeg_test.go
+++ b/test/benchmarks/media/ffmpeg_test.go
@@ -15,6 +15,7 @@ package media
import (
"context"
+ "os"
"strings"
"testing"
@@ -22,6 +23,8 @@ import (
"gvisor.dev/gvisor/test/benchmarks/harness"
)
+var h harness.Harness
+
// BenchmarkFfmpeg runs ffmpeg in a container and records runtime.
// BenchmarkFfmpeg should run as root to drop caches.
func BenchmarkFfmpeg(b *testing.B) {
@@ -32,13 +35,13 @@ func BenchmarkFfmpeg(b *testing.B) {
defer machine.CleanUp()
ctx := context.Background()
- container := machine.GetContainer(ctx, b)
- defer container.CleanUp(ctx)
cmd := strings.Split("ffmpeg -i video.mp4 -c:v libx264 -preset veryslow output.mp4", " ")
b.ResetTimer()
for i := 0; i < b.N; i++ {
b.StopTimer()
+ container := machine.GetContainer(ctx, b)
+ defer container.CleanUp(ctx)
if err := harness.DropCaches(machine); err != nil {
b.Skipf("failed to drop caches: %v. You probably need root.", err)
}
@@ -51,3 +54,8 @@ func BenchmarkFfmpeg(b *testing.B) {
}
}
}
+
+func TestMain(m *testing.M) {
+ h.Init()
+ os.Exit(m.Run())
+}
diff --git a/test/benchmarks/media/media.go b/test/benchmarks/media/media.go
index c7b35b758..ed7b24651 100644
--- a/test/benchmarks/media/media.go
+++ b/test/benchmarks/media/media.go
@@ -14,18 +14,3 @@
// Package media holds benchmarks around media processing applications.
package media
-
-import (
- "os"
- "testing"
-
- "gvisor.dev/gvisor/test/benchmarks/harness"
-)
-
-var h harness.Harness
-
-// TestMain is the main method for package media.
-func TestMain(m *testing.M) {
- h.Init()
- os.Exit(m.Run())
-}