diff options
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/oelib/buildhistory.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py b/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py index c3c15d83c0..042ccdd2b4 100644 --- a/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py +++ b/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py | |||
@@ -30,6 +30,16 @@ class TestBlobParsing(OESelftestTestCase): | |||
30 | import shutil | 30 | import shutil |
31 | shutil.rmtree(self.repo_path) | 31 | shutil.rmtree(self.repo_path) |
32 | 32 | ||
33 | @property | ||
34 | def heads_default(self): | ||
35 | """ | ||
36 | Support repos defaulting to master or to main branch | ||
37 | """ | ||
38 | try: | ||
39 | return self.repo.heads.main | ||
40 | except AttributeError: | ||
41 | return self.repo.heads.master | ||
42 | |||
33 | def commit_vars(self, to_add={}, to_remove = [], msg="A commit message"): | 43 | def commit_vars(self, to_add={}, to_remove = [], msg="A commit message"): |
34 | if len(to_add) == 0 and len(to_remove) == 0: | 44 | if len(to_add) == 0 and len(to_remove) == 0: |
35 | return | 45 | return |
@@ -67,10 +77,10 @@ class TestBlobParsing(OESelftestTestCase): | |||
67 | changesmap = { "foo-2" : ("2", "8"), "bar" : ("","4"), "bar-2" : ("","5")} | 77 | changesmap = { "foo-2" : ("2", "8"), "bar" : ("","4"), "bar-2" : ("","5")} |
68 | 78 | ||
69 | self.commit_vars(to_add = { "foo" : "1", "foo-2" : "2", "foo-3" : "3" }) | 79 | self.commit_vars(to_add = { "foo" : "1", "foo-2" : "2", "foo-3" : "3" }) |
70 | blob1 = self.repo.heads.master.commit.tree.blobs[0] | 80 | blob1 = self.heads_default.commit.tree.blobs[0] |
71 | 81 | ||
72 | self.commit_vars(to_add = { "foo-2" : "8", "bar" : "4", "bar-2" : "5" }) | 82 | self.commit_vars(to_add = { "foo-2" : "8", "bar" : "4", "bar-2" : "5" }) |
73 | blob2 = self.repo.heads.master.commit.tree.blobs[0] | 83 | blob2 = self.heads_default.commit.tree.blobs[0] |
74 | 84 | ||
75 | change_records = compare_dict_blobs(os.path.join(self.repo_path, self.test_file), | 85 | change_records = compare_dict_blobs(os.path.join(self.repo_path, self.test_file), |
76 | blob1, blob2, False, False) | 86 | blob1, blob2, False, False) |
@@ -86,10 +96,10 @@ class TestBlobParsing(OESelftestTestCase): | |||
86 | defaultmap = { x : ("default", "1") for x in ["PKG", "PKGE", "PKGV", "PKGR"]} | 96 | defaultmap = { x : ("default", "1") for x in ["PKG", "PKGE", "PKGV", "PKGR"]} |
87 | 97 | ||
88 | self.commit_vars(to_add = { "foo" : "1" }) | 98 | self.commit_vars(to_add = { "foo" : "1" }) |
89 | blob1 = self.repo.heads.master.commit.tree.blobs[0] | 99 | blob1 = self.heads_default.commit.tree.blobs[0] |
90 | 100 | ||
91 | self.commit_vars(to_add = { "PKG" : "1", "PKGE" : "1", "PKGV" : "1", "PKGR" : "1" }) | 101 | self.commit_vars(to_add = { "PKG" : "1", "PKGE" : "1", "PKGV" : "1", "PKGR" : "1" }) |
92 | blob2 = self.repo.heads.master.commit.tree.blobs[0] | 102 | blob2 = self.heads_default.commit.tree.blobs[0] |
93 | 103 | ||
94 | change_records = compare_dict_blobs(os.path.join(self.repo_path, self.test_file), | 104 | change_records = compare_dict_blobs(os.path.join(self.repo_path, self.test_file), |
95 | blob1, blob2, False, False) | 105 | blob1, blob2, False, False) |