Skip to content

Commit 6b746f9

Browse files
author
zhouhao
committed
runtimetest: add path option
Signed-off-by: zhouhao <[email protected]>
1 parent fa49c8e commit 6b746f9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cmd/runtimetest/main.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ type validation struct {
5252
description string
5353
}
5454

55-
func loadSpecConfig() (spec *rspec.Spec, err error) {
56-
cf, err := os.Open(specConfig)
55+
func loadSpecConfig(path string) (spec *rspec.Spec, err error) {
56+
configPath := filepath.Join(path, specConfig)
57+
cf, err := os.Open(configPath)
5758
if err != nil {
5859
if os.IsNotExist(err) {
5960
return nil, fmt.Errorf("%s not found", specConfig)
@@ -602,7 +603,8 @@ func validate(context *cli.Context) error {
602603
}
603604
logrus.SetLevel(logLevel)
604605

605-
spec, err := loadSpecConfig()
606+
inputPath := context.String("path")
607+
spec, err := loadSpecConfig(inputPath)
606608
if err != nil {
607609
return err
608610
}
@@ -712,6 +714,11 @@ func main() {
712714
Value: "error",
713715
Usage: "Log level (panic, fatal, error, warn, info, or debug)",
714716
},
717+
cli.StringFlag{
718+
Name: "path",
719+
Value: ".",
720+
Usage: "path to the configuration",
721+
},
715722
}
716723

717724
app.Action = validate

0 commit comments

Comments
 (0)