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