Skip to content

Commit 81607fb

Browse files
author
Ma Shimiao
committed
automatically get os when validating runtime
Signed-off-by: Ma Shimiao <[email protected]>
1 parent fc994d5 commit 81607fb

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ BINDIR ?= $(DESTDIR)/usr/bin
66

77
BUILDTAGS=
88
RUNTIME ?= runc
9-
PLATFORM ?= linux
109

1110
all: tool runtimetest
1211

@@ -40,7 +39,7 @@ clean:
4039
rm -f oci-runtime-tool runtimetest *.1
4140

4241
localvalidation: runtimetest
43-
RUNTIME=$(RUNTIME) PLATFORM=$(PLATFORM) go test -tags "$(BUILDTAGS)" ${TESTFLAGS} -v github.com/opencontainers/runtime-tools/validation
42+
RUNTIME=$(RUNTIME) go test -tags "$(BUILDTAGS)" ${TESTFLAGS} -v github.com/opencontainers/runtime-tools/validation
4443

4544
.PHONY: test .gofmt .govet .golint
4645

cmd/runtimetest/main.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"io/ioutil"
1010
"os"
1111
"path/filepath"
12+
"runtime"
1213
"strconv"
1314
"strings"
1415
"syscall"
@@ -588,7 +589,7 @@ func validate(context *cli.Context) error {
588589
return err
589590
}
590591

591-
platform := context.String("platform")
592+
platform := runtime.GOOS
592593

593594
defaultValidations := []validation{
594595
{
@@ -699,11 +700,6 @@ func main() {
699700
Value: ".",
700701
Usage: "Path to the configuration",
701702
},
702-
cli.StringFlag{
703-
Name: "platform",
704-
Value: "linux",
705-
Usage: "Platform the runtime runs on",
706-
},
707703
}
708704

709705
app.Action = validate

validation/validation_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ import (
1414
)
1515

1616
var (
17-
runtime = "runc"
18-
platform = "linux"
17+
runtime = "runc"
1918
)
2019

2120
func init() {
2221
runtime = os.Getenv("RUNTIME")
23-
platform = os.Getenv("PLATFORM")
2422
}
2523

2624
func runtimeValidate(runtime string, g *generate.Generator) error {
@@ -81,7 +79,7 @@ func runtimeValidate(runtime string, g *generate.Generator) error {
8179
func getDefaultGenerator() *generate.Generator {
8280
g := generate.New()
8381
g.SetRootPath(".")
84-
g.SetProcessArgs([]string{"/runtimetest", "--platform", platform})
82+
g.SetProcessArgs([]string{"/runtimetest"})
8583
return &g
8684
}
8785

0 commit comments

Comments
 (0)