Index: lnt/server/reporting/analysis.py =================================================================== --- lnt/server/reporting/analysis.py +++ lnt/server/reporting/analysis.py @@ -18,6 +18,7 @@ # Minimal percentage difference that is visible in reports MIN_PERCENTAGE_CHANGE = .01 + def absmin_diff(current, prevs): """Min of differences between current sample and all previous samples. Given more than one min, use the last one detected which is probably a Index: lnt/server/reporting/report.py =================================================================== --- lnt/server/reporting/report.py +++ lnt/server/reporting/report.py @@ -8,10 +8,12 @@ OrderAndHistory = namedtuple('OrderAndHistory', ['max_order', 'recent_orders']) + def pairs(l): """Make an iterable of all pairs of consecutive elements in l.""" return zip(l[:-1], l[1:]) + # The hash color palette avoids green and red as these colours are already used # in quite a few places to indicate "good" or "bad". _hash_color_palette = ( @@ -23,6 +25,7 @@ colorsys.hsv_to_rgb(h=180. / 360, s=0.3, v=0.9999), # mid cyan ) + def _clamp(v, minVal, maxVal): return min(max(v, minVal), maxVal) @@ -55,6 +58,7 @@ result.append(_toColorString(rgb)) return result + # Helper classes to make the sparkline chart construction easier in the jinja # template. class RunResult: @@ -65,6 +69,7 @@ if self.samples is None: self.samples = [] + class RunResults: """ RunResults contains pre-processed data to easily construct the HTML for @@ -113,6 +118,7 @@ if dr is not None: dr.hash_rgb_color = rgb_colors[i] + # Compute static CSS styles for elements. We use the style directly on # elements instead of via a stylesheet to support major email clients # (like Gmail) which can't deal with embedded style sheets. Index: lnt/server/reporting/runs.py =================================================================== --- lnt/server/reporting/runs.py +++ lnt/server/reporting/runs.py @@ -216,6 +216,8 @@ BucketEntry = namedtuple('BucketEntry', ['name', 'cr', 'test_id']) + + def _get_changes_by_type(ts, run_a, run_b, metric_fields, test_names, num_comparison_runs, sri): comparison_results = {} Index: lnt/server/ui/globals.py =================================================================== --- lnt/server/ui/globals.py +++ lnt/server/ui/globals.py @@ -33,9 +33,11 @@ except Exception: return False + class fixed_location_response(Response): autocorrect_location_header = False + def v4_redirect(*args, **kwargs): """ Like redirect but can be used to allow relative URL redirection. @@ -48,6 +50,7 @@ """ return flask.redirect(*args, Response=fixed_location_response, **kwargs) + def register(env): # Add some normal Python builtins which can be useful in templates. env.globals.update(zip=zip) Index: lnt/server/ui/views.py =================================================================== --- lnt/server/ui/views.py +++ lnt/server/ui/views.py @@ -1517,6 +1517,7 @@ config=config, all_machines=all_machines, all_orders=all_orders, **ts_data(ts)) + @v4_route("/latest_runs_report") def v4_latest_runs_report(): session = request.session @@ -1535,6 +1536,7 @@ analysis=lnt.server.reporting.analysis, **ts_data(ts)) + @db_route("/summary_report") def v4_summary_report(): session = request.session Index: tests/SharedInputs/FakeCompilers/fakecompiler.py =================================================================== --- tests/SharedInputs/FakeCompilers/fakecompiler.py +++ tests/SharedInputs/FakeCompilers/fakecompiler.py @@ -118,6 +118,7 @@ "%s" "-cc1" "-E" ... more boring stuff here ...""" % ( g_program,), file=sys.stderr) + # Monorepo clang build with some extra stuff after the version string class Clang_monorepo2(LLVMCompiler): compiler_name = "clang-monorepo2" @@ -131,6 +132,7 @@ "%s" "-cc1" "-E" ... more boring stuff here ...""" % ( g_program,), file=sys.stderr) + class AppleClang_138_1(LLVMCompiler): compiler_name = "apple-clang-138.1" Index: tests/__init__.py =================================================================== --- tests/__init__.py +++ tests/__init__.py @@ -1,5 +1,6 @@ import os import lit.discovery + def test_all(): return lit.discovery.load_test_suite([os.path.dirname(__file__)]) Index: tests/server/db/Migrations.py =================================================================== --- tests/server/db/Migrations.py +++ tests/server/db/Migrations.py @@ -46,6 +46,7 @@ overview = client.get(os.path.join("/", link)) assert "LNT : %s - Recent Activity" % (name,) in overview.data + def check_instance(instance_path, temp_path): logging.info("checking instance: %r", instance_path) @@ -66,6 +67,7 @@ # Sanity check that the update instance works correctly. sanity_check_instance(instance_temp_path) + def main(): _, temp_path = sys.argv @@ -86,5 +88,6 @@ # Otherwise, we have a test instance. Check migration of it. check_instance(input_path, temp_path) + if __name__ == '__main__': main() Index: tests/server/db/search.py =================================================================== --- tests/server/db/search.py +++ tests/server/db/search.py @@ -105,7 +105,7 @@ ('machine3', '6512'), ('machine3', '65') ]) - + def test_default_machine(self): session = self.session ts = self.db.testsuite.get('nts') @@ -116,6 +116,7 @@ ('machine2', '6512') ]) + if __name__ == '__main__': if len(sys.argv) > 1: base_path = sys.argv[1] Index: tests/testing/cPerf.py =================================================================== --- tests/testing/cPerf.py +++ tests/testing/cPerf.py @@ -5,7 +5,8 @@ import os import tempfile from lnt.testing.profile.perf import LinuxPerfProfile - + + class CPerfTest(unittest.TestCase): def setUp(self): self.inputs = os.path.join(os.path.dirname(os.path.abspath(__file__)), @@ -118,7 +119,7 @@ [{}, 4196092, u'\td65f03c0 \tret']]}}}} - + def _getNm(self, perf_data_fname, non_dynamic=False): stub = perf_data_fname.rsplit('.perf_data', 1)[0] s = 'python %s/fake-nm.py %s.nm.out' % (self.inputs, stub) @@ -132,7 +133,7 @@ def _getInput(self, fname): return os.path.join(self.inputs, fname) - + def test_check_file(self): self.assertTrue(LinuxPerfProfile.checkFile(self._getInput('fib-aarch64.perf_data'))) @@ -183,5 +184,6 @@ LinuxPerfProfile.deserialize(open(fd.name), propagateExceptions=True) + if __name__ == '__main__': unittest.main(argv=[sys.argv[0], ]) Index: tests/testing/profilev1impl.py =================================================================== --- tests/testing/profilev1impl.py +++ tests/testing/profilev1impl.py @@ -11,6 +11,7 @@ logging.basicConfig(level=logging.DEBUG) + class ProfileV1Test(unittest.TestCase): def setUp(self): self.test_data = { @@ -57,5 +58,6 @@ self.assertEqual(p2.data, self.test_data) + if __name__ == '__main__': unittest.main(argv=[sys.argv[0], ]) Index: tests/testing/profilev2impl.py =================================================================== --- tests/testing/profilev2impl.py +++ tests/testing/profilev2impl.py @@ -12,6 +12,7 @@ logging.basicConfig(level=logging.DEBUG) + class ProfileV2Test(unittest.TestCase): def setUp(self): self.test_data = { @@ -49,6 +50,7 @@ self.assertEqual(p.getFunctions(), {'fn1': {'counters': {'cycles': 45.0, 'branch-misses': 10.0}, 'length': 2}}) - + + if __name__ == '__main__': unittest.main(argv=[sys.argv[0], ])