aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/main.go2
-rw-r--r--contrib/perftest/main.go7
-rw-r--r--libpod/image/image.go4
-rw-r--r--libpod/image/image_test.go8
-rw-r--r--test/e2e/common_test.go10
5 files changed, 20 insertions, 11 deletions
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 8cc8a0b8e..344170ddd 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -149,6 +149,8 @@ func main() {
//cpuProfile := false
if reexec.Init() {
+ // We were invoked with a different argv[0] indicating that we
+ // had a specific job to do as a subprocess, and it's done.
return
}
// Hard code TMPDIR functions to use /var/tmp, if user did not override
diff --git a/contrib/perftest/main.go b/contrib/perftest/main.go
index f6c90914a..9b928a6b3 100644
--- a/contrib/perftest/main.go
+++ b/contrib/perftest/main.go
@@ -36,6 +36,9 @@ var helpMessage = `
`
func main() {
+ if reexec.Init() {
+ return
+ }
ctx := context.Background()
imageName := ""
@@ -51,10 +54,6 @@ func main() {
flag.Parse()
- if reexec.Init() {
- return
- }
-
switch strings.ToLower(*logLevel) {
case "error":
logrus.SetLevel(logrus.ErrorLevel)
diff --git a/libpod/image/image.go b/libpod/image/image.go
index 0be6eeeb9..855da8611 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -29,7 +29,6 @@ import (
"github.com/containers/libpod/pkg/registries"
"github.com/containers/libpod/pkg/util"
"github.com/containers/storage"
- "github.com/containers/storage/pkg/reexec"
"github.com/opencontainers/go-digest"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
@@ -85,9 +84,6 @@ func NewImageRuntimeFromStore(store storage.Store) *Runtime {
// NewImageRuntimeFromOptions creates an Image Runtime including the store given
// store options
func NewImageRuntimeFromOptions(options storage.StoreOptions) (*Runtime, error) {
- if reexec.Init() {
- return nil, errors.Errorf("unable to reexec")
- }
store, err := setStore(options)
if err != nil {
return nil, err
diff --git a/libpod/image/image_test.go b/libpod/image/image_test.go
index 5a6d095f6..ef39d09c3 100644
--- a/libpod/image/image_test.go
+++ b/libpod/image/image_test.go
@@ -11,6 +11,7 @@ import (
"github.com/containers/libpod/libpod/events"
"github.com/containers/libpod/pkg/util"
"github.com/containers/storage"
+ "github.com/containers/storage/pkg/reexec"
"github.com/opencontainers/go-digest"
"github.com/stretchr/testify/assert"
)
@@ -70,6 +71,13 @@ func makeLocalMatrix(b, bg *Image) ([]localImageTest, error) {
}
+func TestMain(m *testing.M) {
+ if reexec.Init() {
+ return
+ }
+ os.Exit(m.Run())
+}
+
// TestImage_NewFromLocal tests finding the image locally by various names,
// tags, and aliases
func TestImage_NewFromLocal(t *testing.T) {
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 4e9881d59..1c2acf8ed 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -78,11 +78,15 @@ func (a testResultsSorted) Less(i, j int) bool { return a[i].length < a[j].lengt
var testResults []testResult
-// TestLibpod ginkgo master function
-func TestLibpod(t *testing.T) {
+func TestMain(m *testing.M) {
if reexec.Init() {
- os.Exit(1)
+ return
}
+ os.Exit(m.Run())
+}
+
+// TestLibpod ginkgo master function
+func TestLibpod(t *testing.T) {
if os.Getenv("NOCACHE") == "1" {
CACHE_IMAGES = []string{}
RESTORE_IMAGES = []string{}