Skip to contentSkip to conversation

resulttool/regression: Ensure LTP results are only compared against other LTP runs

PATCH New Richard Purdie 1 participant 2 messages Feb 26, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 resulttool/regression: Ensure LTP results are only compared against other LTP runs

If a test result contains LTP test results, it should only be compared with other runs containing LTP test results.

---
 scripts/lib/resulttool/regression.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
scripts/lib/resulttool/regression.py +6 -1
index 1b0c8335a39..04a2f3fbb07 100644
@@ -146,6 +146,7 @@ def can_be_compared(logger, base, target):
     run with different tests sets or parameters. Return true if tests can be
     compared
     """
+    ret = True
     base_configuration = base['configuration']
     target_configuration = target['configuration']
 
@@ -165,7 +166,11 @@ def can_be_compared(logger, base, target):
             logger.debug(f"Enriching {target_configuration['STARTTIME']} with {guess}")
             target_configuration['OESELFTEST_METADATA'] = guess
 
-    return metadata_matches(base_configuration, target_configuration) \
+    # Test runs with LTP results in should only be compared with other runs with LTP tests in them
+    if base_configuration.get('TEST_TYPE') == 'runtime' and any(result.startswith("ltpresult") for result in base['result']):
+        ret = target_configuration.get('TEST_TYPE') == 'runtime' and any(result.startswith("ltpresult") for result in target['result'])
+
+    return ret and metadata_matches(base_configuration, target_configuration) \
         and machine_matches(base_configuration, target_configuration)
 
 
Signature · 1 line
2.37.2
#1 lore raw

PATCH 2/2 resulttool/regression: Improve matching of poor ptest test names

Some test case naming is poor and contains random strings, particularly lttng/babeltrace but also curl. Truncating the test names works since they contain file and line number identifiers which allows us to match them without the random components, or in the case or curl, test IDs.

Going forward we may be able to improve the test names but this tweak allows historical test results to work in reports.

---
 scripts/lib/resulttool/regression.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
scripts/lib/resulttool/regression.py +21 -0
index 04a2f3fbb07..74fd5f38951 100644
@@ -248,6 +248,24 @@ def regression_common(args, logger, base_results, target_results):
 
     return 0
 
+# Some test case naming is poor and contains random strings, particularly lttng/babeltrace.
+# Truncating the test names works since they contain file and line number identifiers
+# which allows us to match them without the random components.
+def fixup_ptest_names(results, logger):
+    for r in results:
+        for i in results[r]:
+            tests = list(results[r][i]['result'].keys())
+            for test in tests:
+                new = None
+                if test.startswith(("ptestresult.lttng-tools.", "ptestresult.babeltrace.", "ptestresult.babeltrace2")) and "_-_" in test:
+                    new = test.split("_-_")[0]
+                elif test.startswith(("ptestresult.curl.")) and "__" in test:
+                    new = test.split("__")[0]
+                if new:
+                    results[r][i]['result'][new] = results[r][i]['result'][test]
+                    del results[r][i]['result'][test]
+
+
 def regression_git(args, logger):
     base_results = {}
     target_results = {}
@@ -309,6 +327,9 @@ def regression_git(args, logger):
     base_results = resultutils.git_get_result(repo, revs[index1][2])
     target_results = resultutils.git_get_result(repo, revs[index2][2])
 
+    fixup_ptest_names(base_results, logger)
+    fixup_ptest_names(target_results, logger)
+
     regression_common(args, logger, base_results, target_results)
 
     return 0
Signature · 1 line
2.37.2