summaryrefslogtreecommitdiffhomepage
path: root/test/runner/runner.go
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2020-09-14 15:32:46 -0700
committerAndrei Vagin <avagin@gmail.com>2020-09-16 12:22:17 -0700
commitf148242abab1ff043428036ccaf464de98268863 (patch)
tree1e57aea21f2fe0cfaf7031d6fa4b9f2fb3b0aa8c /test/runner/runner.go
parent113928754c26ea3d4d7d387bae459ce447774d30 (diff)
Revert "fuse: add benchmarking support for FUSE"
test/fuse/benchmark/read_benchmark.cc:34: Failure Expected: (fuse_prefix) != (nullptr), actual: NULL vs (nullptr) external/com_google_benchmark/src/benchmark_runner.cc:120: RunInThread: Check `st.iterations() >= st.max_iterations' failed. Benchmark returned before State::KeepRunning() returned false! --- FAIL: Benchmarks_BM_Read/262144/real_time (0.29s) runner.go:502: test "Benchmarks.BM_Read/262144/real_time" failed with error exit status 134, want nil FAIL
Diffstat (limited to 'test/runner/runner.go')
-rw-r--r--test/runner/runner.go112
1 files changed, 11 insertions, 101 deletions
diff --git a/test/runner/runner.go b/test/runner/runner.go
index fe501c4c7..22d535f8d 100644
--- a/test/runner/runner.go
+++ b/test/runner/runner.go
@@ -23,20 +23,16 @@ import (
"os"
"os/exec"
"os/signal"
- "path"
"path/filepath"
"strings"
"syscall"
"testing"
"time"
- "github.com/docker/docker/api/types/mount"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/syndtr/gocapability/capability"
"golang.org/x/sys/unix"
- "gvisor.dev/gvisor/pkg/context"
"gvisor.dev/gvisor/pkg/log"
- "gvisor.dev/gvisor/pkg/test/dockerutil"
"gvisor.dev/gvisor/pkg/test/testutil"
"gvisor.dev/gvisor/runsc/specutils"
"gvisor.dev/gvisor/test/runner/gtest"
@@ -44,19 +40,17 @@ import (
)
var (
- debug = flag.Bool("debug", false, "enable debug logs")
- strace = flag.Bool("strace", false, "enable strace logs")
- platform = flag.String("platform", "ptrace", "platform to run on")
- network = flag.String("network", "none", "network stack to run on (sandbox, host, none)")
- useTmpfs = flag.Bool("use-tmpfs", false, "mounts tmpfs for /tmp")
- useImage = flag.String("use-image", "", "container image to use for test. Path relative to //images")
- setupCommand = flag.String("setup-command", "", "command to run before running the test to set up container environment")
- fileAccess = flag.String("file-access", "exclusive", "mounts root in exclusive or shared mode")
- overlay = flag.Bool("overlay", false, "wrap filesystem mounts with writable tmpfs overlay")
- vfs2 = flag.Bool("vfs2", false, "enable VFS2")
- fuse = flag.Bool("fuse", false, "enable FUSE")
- parallel = flag.Bool("parallel", false, "run tests in parallel")
- runscPath = flag.String("runsc", "", "path to runsc binary")
+ debug = flag.Bool("debug", false, "enable debug logs")
+ strace = flag.Bool("strace", false, "enable strace logs")
+ platform = flag.String("platform", "ptrace", "platform to run on")
+ network = flag.String("network", "none", "network stack to run on (sandbox, host, none)")
+ useTmpfs = flag.Bool("use-tmpfs", false, "mounts tmpfs for /tmp")
+ fileAccess = flag.String("file-access", "exclusive", "mounts root in exclusive or shared mode")
+ overlay = flag.Bool("overlay", false, "wrap filesystem mounts with writable tmpfs overlay")
+ vfs2 = flag.Bool("vfs2", false, "enable VFS2")
+ fuse = flag.Bool("fuse", false, "enable FUSE")
+ parallel = flag.Bool("parallel", false, "run tests in parallel")
+ runscPath = flag.String("runsc", "", "path to runsc binary")
addUDSTree = flag.Bool("add-uds-tree", false, "expose a tree of UDS utilities for use in tests")
)
@@ -319,92 +313,8 @@ func setupUDSTree(spec *specs.Spec) (cleanup func(), err error) {
return cleanup, nil
}
-func runTestCaseInContainer(testBin string, tc gtest.TestCase, image string, t *testing.T) {
- if usingFUSE, err := dockerutil.UsingFUSE(); err != nil {
- t.Fatalf("failed to read config for runtime %s: %v", dockerutil.Runtime(), err)
- } else if !usingFUSE {
- t.Skip("FUSE not being used.")
- }
-
- ctx := context.Background()
- d := dockerutil.MakeContainer(ctx, t)
- defer d.CleanUp(ctx)
-
- // Run the basic container.
- tmpDir := "/tmpDir"
- testBinDir := "/testDir"
- opts := dockerutil.RunOpts{
- Image: image,
- Privileged: true,
- CapAdd: []string{"CAP_SYS_ADMIN"},
-
- // Mount a tmpfs directory to use when benchmarking.
- Mounts: []mount.Mount{
- {
- Type: mount.TypeTmpfs,
- Target: tmpDir,
- ReadOnly: false,
- },
- },
- Env: []string{
- fmt.Sprintf("TEST_TMPDIR=%s", tmpDir),
- fmt.Sprintf("TEST_FUSEPRE=%s", "/fus/mountpoint"),
- },
- }
- wd, err := os.Getwd()
- if err != nil {
- t.Fatalf("Getwd run failed: %v", err)
- }
-
- wdPathToTestBin := strings.TrimPrefix(testBin, wd)
- containerTestBin := path.Join(testBinDir, path.Base(wdPathToTestBin))
- d.CopyFiles(&opts, testBinDir, wdPathToTestBin)
- if err := d.CopyErr(); err != nil {
- t.Fatalf("Copy failed %v", err)
- }
-
- err = d.Spawn(ctx, opts, "sleep", "1000")
- if err != nil {
- t.Fatalf("docker run failed: %v", err)
- }
-
- // Run the server setup command.
- if *setupCommand != "" {
- out, err := d.Exec(ctx, dockerutil.ExecOpts{
- Privileged: true,
- }, "/bin/sh", "-c", *setupCommand)
- if err != nil {
- t.Fatalf("docker exec failed: %v with output %v", err, out)
- }
- }
-
- cmd := "chmod +x " + containerTestBin
- out, err := d.Exec(ctx, dockerutil.ExecOpts{
- Privileged: true,
- }, "/bin/sh", "-c", cmd)
- if err != nil {
- t.Fatalf("docker exec failed: %v with output %v", err, out)
- }
-
- cmd = containerTestBin + " " + strings.Join(tc.Args(), " ")
- out, err = d.Exec(ctx, dockerutil.ExecOpts{
- Privileged: true,
- }, "/bin/sh", "-c", cmd)
- if err != nil {
- t.Fatalf("docker exec failed: %v with output %v", err, out)
- }
-
- fmt.Print(out)
- return
-}
-
// runsTestCaseRunsc runs the test case in runsc.
func runTestCaseRunsc(testBin string, tc gtest.TestCase, t *testing.T) {
- if *useImage != "" {
- runTestCaseInContainer(testBin, tc, *useImage, t)
- return
- }
-
// Run a new container with the test executable and filter for the
// given test suite and name.
spec := testutil.NewSpecWithArgs(append([]string{testBin}, tc.Args()...)...)