MCPcopy
hub / github.com/google/gvisor / TestRootNotMount

Function TestRootNotMount

runsc/container/container_test.go:2968–3003  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2966}
2967
2968func TestRootNotMount(t *testing.T) {
2969 appSym, err := testutil.FindFile("test/cmd/test_app/test_app")
2970 if err != nil {
2971 t.Fatal("error finding test_app:", err)
2972 }
2973
2974 app, err := filepath.EvalSymlinks(appSym)
2975 if err != nil {
2976 t.Fatalf("error resolving %q symlink: %v", appSym, err)
2977 }
2978 log.Infof("App path %q is a symlink to %q", appSym, app)
2979
2980 static, err := testutil.IsStatic(app)
2981 if err != nil {
2982 t.Fatalf("error reading application binary: %v", err)
2983 }
2984 if !static {
2985 // This happens during race builds; we cannot map in shared
2986 // libraries also, so we need to skip the test.
2987 t.Skip()
2988 }
2989
2990 root := filepath.Dir(app)
2991 exe := "/" + filepath.Base(app)
2992 log.Infof("Executing %q in %q", exe, root)
2993
2994 spec := testutil.NewSpecWithArgs(exe, "help")
2995 spec.Root.Path = root
2996 spec.Root.Readonly = true
2997 spec.Mounts = nil
2998
2999 conf := testutil.TestConfig(t)
3000 if err := run(spec, conf); err != nil {
3001 t.Fatalf("error running sandbox: %v", err)
3002 }
3003}
3004
3005func TestUserLog(t *testing.T) {
3006 app, err := testutil.FindFile("test/cmd/test_app/test_app")

Callers

nothing calls this directly

Calls 8

FindFileFunction · 0.92
InfofFunction · 0.92
IsStaticFunction · 0.92
NewSpecWithArgsFunction · 0.92
TestConfigFunction · 0.92
BaseMethod · 0.80
runFunction · 0.70
FatalfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…