]> xenbits.xensource.com Git - people/gdunlap/xsatool.git/commitdiff
testing: Implement 206 'implement and sync' tests
authorGeorge Dunlap <george.dunlap@citrix.com>
Fri, 19 May 2017 14:37:47 +0000 (15:37 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 19 May 2017 14:37:47 +0000 (15:37 +0100)
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
system_test.go

index 7263cb882476db673cef74373865e3dd397fa5be..9d1b8462509a0a6bb95003694fd4e9e3ba4b32f7 100644 (file)
@@ -305,6 +305,56 @@ func Story206Init(t *testing.T) (pass bool) {
        return
 }
 
+func Story206Implement(t *testing.T) (pass bool) {
+       // [should already be on correct branch]
+
+       // git am $PATH/xsa206-master/*.patch
+
+       out, err := G.repos.XenRepos[TreeXen].Am("../testdata/xsa206-unstable/*.patch")
+       if err != nil {
+               t.Errorf("Error importing example patches: %v %s\n", err, string(out))
+               return
+       }
+
+       return true
+}
+
+func Story206SyncOne(t *testing.T) (pass bool) {
+       t.Logf(" xsatool 206 sync-patches")
+       if MainHarness("206", "sync-patches") != 0 {
+               t.Errorf("xsatool 206 sync-patches failed\n")
+               return false
+       }
+
+       var xsa XSAMeta
+
+       err := xsa.Load(206)
+       if err != nil {
+               t.Errorf("Error loading updated recipe: %v\n", err)
+               return false
+       }
+
+       pass = true
+
+       for v := range xsa.Recipes {
+               r := xsa.GetRecipe(v)
+               for tree := range r.Recipes {
+                       tr := r.Recipes[tree]
+                       expected := 0
+                       if v == XenVersion("master") && tree == TreeXen {
+                               expected = 1
+                       }
+                       if len(tr.Patches) != expected {
+                               t.Errorf("Version %v tree %v: Wanted %d, got %d\n",
+                                       v, tree, expected, len(tr.Patches))
+                               pass = false
+                       }
+               }
+       }
+
+       return pass
+}
+
 func Story206(t *testing.T) bool {
        t.Logf("Starting XSA-206 'story'")
        // xsatool 206 init xen
@@ -313,8 +363,14 @@ func Story206(t *testing.T) bool {
        }
 
        // Fake-up xsa/206/master
+       if !Story206Implement(t) {
+               return false
+       }
 
        // 206 sync-patches
+       if !Story206SyncOne(t) {
+               return false
+       }
 
        // 206 Backport (should fail at 4.8. 4.7, and 4.6; NOT 4.5)