From: George Dunlap Date: Fri, 27 Oct 2017 16:10:50 +0000 (+0100) Subject: main: Move 'systemtest' command outside of XsaMain X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a1b2f54a2b5e277e81e404a237509ae11eadc042;p=people%2Fgdunlap%2Fxsatool main: Move 'systemtest' command outside of XsaMain XsaMain() is meant to be called by systemtest; there's no sense in being able to call systemtest via XsaMain. Moving the test for 'systemtest' into main() allows us to get rid of systemtest special-casing re argument counts. Signed-off-by: George Dunlap --- diff --git a/main.go b/main.go index e090f21..3c71c84 100644 --- a/main.go +++ b/main.go @@ -82,7 +82,7 @@ func globalReset() { } func XsaMain(args []string) int { - if len(args) < 3 && args[1] != "systemtest" { + if len(args) < 3 { fmt.Printf("Not enough arguments\n") return 1 } @@ -99,18 +99,8 @@ func XsaMain(args []string) int { loadXSA := false tgt := args[1] - args = args[2:] - - // Check for this first - if tgt == "systemtest" { - return MainSystemTest(args) - } - - var cmd string - if len(args) > 0 { - cmd = args[0] - args = args[1:] - } + cmd := args[2] + args = args[3:] if xsanum, err = strconv.Atoi(tgt); err == nil { switch cmd { @@ -249,6 +239,11 @@ func QuerySetResponses(responses []string) { } func main() { + // 'systemtest' isn't subject to system testing, so shouldn't be in XsaMain + if len(os.Args) > 1 && os.Args[1] == "systemtest" { + os.Exit(MainSystemTest(os.Args)) + } + Q.real = true os.Exit(XsaMain(os.Args)) }