From b9470a0177175050ec5d11036090d97a8608bf67 Mon Sep 17 00:00:00 2001 From: Javi Merino Date: Fri, 15 Jan 2016 16:11:54 +0000 Subject: [PATCH 1/2] tests/eas/rfc: drop logging from test_execution_complete() The logging interferes with the output from nosetests: Check that data have been collected from the target ... 04:08:04 INFO : Check for data being collected ok Drop the message as it is redundant. Also drop the return as it's not needed. The test should be implemented using standard unittest.TestCase assert methods (self.assert*), not by returning a value. Put a TODO placeholder instead. --- tests/eas/rfc.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/eas/rfc.py b/tests/eas/rfc.py index 364468893..f6d487edf 100644 --- a/tests/eas/rfc.py +++ b/tests/eas/rfc.py @@ -110,9 +110,7 @@ class TestBase(unittest.TestCase): def test_execution_complete(self): """Check that data have been collected from the target""" - logging.info(r'Check for data being collected') - return True - + # TODO ################################################################################ # Utility methods -- GitLab From 382f2f47fcea339800d8cf8323815c078ff75db0 Mon Sep 17 00:00:00 2001 From: Javi Merino Date: Fri, 15 Jan 2016 11:07:13 +0000 Subject: [PATCH 2/2] tests/eas/rfc: test the boosted signal of the SchedTune test First test for SchedTune. In test_boosted_utilization_signal we check that the margin reported by SchedTune for the boosted task matches what the expected formula: (sched_load_scale - utilization) * boost --- tests/eas/rfc.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/eas/rfc.py b/tests/eas/rfc.py index f6d487edf..38c261c3b 100644 --- a/tests/eas/rfc.py +++ b/tests/eas/rfc.py @@ -15,12 +15,14 @@ # limitations under the License. # +from bart.common.Analyzer import Analyzer import collections import datetime import json import os import re import time +import trappy # Configure logging import logging @@ -560,6 +562,52 @@ class STune(TestBase): def setUpClass(cls): super(STune, cls).setUpTest('rfc_stune.config') + def test_boosted_utilization_signal(self): + """The boosted utilization signal is appropriately boosted + + The margin should match the formula + (sched_load_scale - utilization) * boost""" + + for tc in self.conf["confs"]: + test_id = tc["tag"] + + wload_idx = self.conf["wloads"].keys()[0] + run_dir = os.path.join(self.env.res_dir, + "rtapp:{}:{}".format(test_id, wload_idx), + "1") + + ftrace_events = ["sched_boost_task"] + ftrace = trappy.FTrace(run_dir, scope="custom", + events=ftrace_events) + + first_task_params = self.conf["wloads"][wload_idx]["conf"]["params"] + first_task_name = first_task_params.keys()[0] + rta_task_name = "task_{}".format(first_task_name) + + sbt_dfr = ftrace.sched_boost_task.data_frame + boost_task_rtapp = sbt_dfr[sbt_dfr.comm == rta_task_name] + + # Avoid the first period as the task starts with a very + # high load and it overutilizes the CPU + rtapp_period = first_task_params[first_task_name]["params"]["period_ms"] + task_start = boost_task_rtapp.index[0] + after_first_period = task_start + rtapp_period + boost_task_rtapp = boost_task_rtapp.ix[after_first_period:] + + sched_load_scale = 1024 + boost = tc["cgroups"]["conf"]["schedtune"]["/stune"]["boost"] / 100. + utilization = boost_task_rtapp["utilization"] + expected_margin = (sched_load_scale - utilization) * boost + expected_margin = expected_margin.astype(int) + boost_task_rtapp["expected_margin"] = expected_margin + ftrace.add_parsed_event("boost_task_rtapp", boost_task_rtapp) + + analyzer = Analyzer(ftrace, {}) + statement = "boost_task_rtapp:margin == boost_task_rtapp:expected_margin" + error_msg = "task was not boosted to the expected margin: {}".\ + format(boost) + self.assertTrue(analyzer.assertStatement(statement), msg=error_msg) + ################################################################################ # Globals -- GitLab