summaryrefslogtreecommitdiffhomepage
path: root/test/benchmarks/media/ffmpeg_test.go
diff options
context:
space:
mode:
authorZach Koopmans <zkoopmans@google.com>2020-12-09 11:55:06 -0800
committerShentubot <shentubot@google.com>2020-12-09 15:56:08 -0800
commit992769c7748d886e7ee1580f0c6cfdfa7ce0eb75 (patch)
treed8cc08dbd93588c7badde91ca1d9dea4ea9edfd7 /test/benchmarks/media/ffmpeg_test.go
parent45619ded38b9c9f24b2b7ade812fd903e09ac1b9 (diff)
Add tensorflow, ffmpeg, and redis jobs.
PiperOrigin-RevId: 346603153
Diffstat (limited to 'test/benchmarks/media/ffmpeg_test.go')
-rw-r--r--test/benchmarks/media/ffmpeg_test.go12
1 files changed, 10 insertions, 2 deletions
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())
+}