]> xenbits.xensource.com Git - people/gdunlap/xsatool.git/commitdiff
Testing: Add a wrapper for XsaMain so that calling it is less ugly
authorGeorge Dunlap <george.dunlap@citrix.com>
Thu, 11 May 2017 12:37:44 +0000 (13:37 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Wed, 17 May 2017 15:19:44 +0000 (16:19 +0100)
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
main.go
system_test.go

diff --git a/main.go b/main.go
index d564b97ef3783966e833d730155f9d7dea1e8ff3..a8263b1ce282e2c1b94cff125a834e713a715dab 100644 (file)
--- a/main.go
+++ b/main.go
@@ -180,3 +180,8 @@ func XsaMain(args []string) int {
 func main() {
        os.Exit(XsaMain(os.Args))
 }
+
+func MainHarness(args ...string) int {
+       x := append([]string{"xsatool"}, args...)
+       return XsaMain(x)
+}
index 723fbc346853982c16d0b0ddc20bf6d8feeeebe4..6ff68af2e5aeee8041ec70094467a07855527823 100644 (file)
@@ -50,16 +50,14 @@ func InitRepo(t *testing.T) bool {
 
        if callRepoInit {
                // Initialize a current version of the repo
-               args := []string{"xsatool", "repo", "init"}
-               if ret := XsaMain(args); ret != 0 {
-                       t.Errorf("Command %v failed: %d\n", args, ret)
+               if ret := MainHarness("repo", "init"); ret != 0 {
+                       t.Errorf("repo init failed: %d\n", ret)
                        return false
                }
        } else {
                // Read existing version of repos
-               args := []string{"xsatool", "repo", "info"}
-               if ret := XsaMain(args); ret != 0 {
-                       t.Errorf("Command %v failed: %d\n", args, ret)
+               if ret := MainHarness("repo", "info"); ret != 0 {
+                       t.Errorf("repo info failed: %d\n", ret)
                        return false
                }
        }