Skip to contentSkip to conversation

fix regression reporting for nightly build

PATCH New [email protected] 1 participant 4 messages Mar 23, 2023

lore
Share & tools
lore
#0 lore raw

cover fix regression reporting for nightly build

From: Alexis Lothoré <[email protected]>

It has been observed that regression reporting is currently failing on nightly builds ([1]). Those builds parameters are currently not properly managed by the base and target computation for regression reports. Add default behaviour to generate report against last tag

[1] https://lore.kernel.org/yocto/[email protected]/T/#m4c1e0a8124c1bcfb74a80c4ef64176f42fee4e4e

Alexis Lothoré (3):
scripts/test_utils: test master nightly build case scripts/test_send_qa_email.py: allow tests with non static results scripts/send_qa_email: return previous tag when running a non-release
master build

 scripts/send_qa_email.py      |  3 +++
 scripts/test_send_qa_email.py | 15 +++++++++++++--
 scripts/test_utils.py         | 10 ++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)
Signature · 1 line
2.40.0
#1 lore raw

PATCH 1/3 scripts/test_utils: test master nightly build case

From: Alexis Lothoré <[email protected]>

---
 scripts/test_utils.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
scripts/test_utils.py +10 -0
index ab91e3b..d02e9b2 100755
@@ -99,6 +99,16 @@ class TestGetComparisonBranch(unittest.TestCase):
         self.assertEqual(
             comparebranch, None,  msg="Arbitrary repo/branch should not return any specific comparebranch")
 
+    def test_master_nightly(self):
+        repo = "ssh://[email protected]/poky"
+        branch = "master"
+        basebranch, comparebranch = utils.getcomparisonbranch(
+            self.TEST_CONFIG, repo, branch)
+        self.assertEqual(
+            basebranch, "master", msg="Master branch should be returned")
+        self.assertEqual(
+            comparebranch, None,  msg="No specific comparebranch should be returned")
+
 
 if __name__ == '__main__':
     unittest.main()
Signature · 1 line
2.40.0
#2 lore raw

PATCH 2/3 scripts/test_send_qa_email.py: allow tests with non static results

In reply to [email protected]

From: Alexis Lothoré <[email protected]>

When the test assert is about a tag in Poky, the result will not be the same depending on existing tags at the time of running tests.

Add a LAST_TAG marker to loosen constraints but still allow to tests for general cases (e.g. : test that tag-depending tests does not return None)

---
 scripts/test_send_qa_email.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
scripts/test_send_qa_email.py +11 -2
index ccdcba6..ce0c6b7 100755
@@ -65,8 +65,17 @@ class TestVersion(unittest.TestCase):
     def test_get_regression_base_and_target(self):
         for data in self.regression_inputs:
             with self.subTest(data['name']):
-                self.assertEqual(send_qa_email.get_regression_base_and_target(
-                    data['input']['basebranch'], data['input']['comparebranch'], data['input']['release'], os.environ.get("POKY_PATH")), data['expected'])
+                base, target = send_qa_email.get_regression_base_and_target(
+                    data['input']['basebranch'], data['input']['comparebranch'], data['input']['release'], os.environ.get("POKY_PATH"))
+                expected_base, expected_target = data["expected"]
+                # The comparison base can not be set statically in tests when it is supposed to be the previous tag,
+                # since the result will depend on current tags
+                if expected_base == "LAST_TAG":
+                    self.assertIsNotNone(base)
+                else:
+                    self.assertEqual(base, expected_base)
+                self.assertEqual(target, expected_target)
+
 
 if __name__ == '__main__':
     if os.environ.get("POKY_PATH") is None:
Signature · 1 line
2.40.0
#3 lore raw

PATCH 3/3 scripts/send_qa_email: return previous tag when running a non-release master build

In reply to [email protected]

From: Alexis Lothoré <[email protected]>

Some nightly builders are configured in yocto-autobuilder2 to run master builds. Those build parameters currently skip all branches of get_regression_base_and_target, which then return None, while the caller expects a base and target tuple

Set default behaviour to return previous tag as comparison base and passed branch as target for such builds

---
 scripts/send_qa_email.py      | 3 +++
 scripts/test_send_qa_email.py | 2 ++
 2 files changed, 5 insertions(+)
scripts/send_qa_email.py +3 -0
index 78e051a..4613bff 100755
@@ -61,6 +61,9 @@ def get_regression_base_and_target(basebranch, comparebranch, release, targetrep
         # Basebranch/comparebranch is defined in config.json: regression reporting must be done against branches as defined in config.json
         return comparebranch, basebranch
 
+    #Default case: return previous tag as base
+    return get_previous_tag(targetrepodir, release), basebranch
+
 def generate_regression_report(querytool, targetrepodir, base, target, resultdir, outputdir):
     print(f"Comparing {target} to {base}")
 
scripts/test_send_qa_email.py +2 -0
index ce0c6b7..974112a 100755
@@ -48,6 +48,8 @@ class TestVersion(unittest.TestCase):
                                           "comparebranch": "master", "release": None}, "expected": ("master", "master-next")},
         {"name": "Fork Master Next", "input": {"basebranch": "ross/mut",
                                                "comparebranch": "master", "release": None}, "expected": ("master", "ross/mut")},
+        {"name": "Nightly a-quick", "input": {"basebranch": "master",
+                                               "comparebranch": None, "release": "20230322-2"}, "expected": ("LAST_TAG", "master")},
     ]
 
     def test_versions(self):
Signature · 1 line
2.40.0