From 8e8e7666b4b62014a8acb10a373c71d6729be302 Mon Sep 17 00:00:00 2001 From: Elieva Pignat Date: Thu, 15 Mar 2018 16:50:06 +0000 Subject: [PATCH] CPU Migration test: fix parallelism issue The file that contains the description of the tasks was written before the test are launched and read back after the tests run to control the that the result of the test are coherent. The problem is when the test is run for several platforms in parallel the file containing the json description may have been overwritten by another platform test and may not contain the description of the test anymore. To avoid the problem of sharing this file, the tasks descritpion is saved in a variable in the test class and the file containing the json is no more read. Signed-off-by: Elieva Pignat --- libs/wlgen/wlgen/rta.py | 4 ++-- tests/eas/load_tracking.py | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/libs/wlgen/wlgen/rta.py b/libs/wlgen/wlgen/rta.py index 813b30703..b26328b37 100644 --- a/libs/wlgen/wlgen/rta.py +++ b/libs/wlgen/wlgen/rta.py @@ -222,8 +222,6 @@ class RTA(Workload): rtapp_conf = self.params['custom'] - self._log.info('Loading custom configuration:') - self._log.info(' %s', rtapp_conf) self.json = '{0:s}_{1:02d}.json'.format(self.name, self.exc_id) ofile = open(self.json, 'w') @@ -252,6 +250,8 @@ class RTA(Workload): "a filename or an embedded dictionary") else: # We assume we are being passed a filename instead of a dict + self._log.info('Loading custom configuration:') + self._log.info(' %s', rtapp_conf) ifile = open(rtapp_conf, 'r') for line in ifile: diff --git a/tests/eas/load_tracking.py b/tests/eas/load_tracking.py index c8a927e71..fdc714e17 100644 --- a/tests/eas/load_tracking.py +++ b/tests/eas/load_tracking.py @@ -557,6 +557,9 @@ class _CPUMigrationBase(LisaTest): # Allowed error margin allowed_util_margin = UTIL_SCALE * 0.02 + # Dictionary that contains the description of the tasks + tasks_desc = {} + @classmethod def setUpClass(cls, *args, **kwargs): super(_CPUMigrationBase, cls).runExperiments(*args, **kwargs) @@ -581,12 +584,13 @@ class _CPUMigrationBase(LisaTest): rtapp.conf(kind='profile', params={'task{}'.format(i): task.get() for i, task in enumerate(tasks)}, run_dir=Executor.get_run_dir(test_env.target)) + cls.tasks_desc = rtapp.rta_profile['tasks'] return { 'migration': { 'type' : 'rt-app', 'conf' : { 'class' : 'custom', - 'json' : rtapp.json, + 'json' : rtapp.rta_profile, 'prefix' : 'mig_test', }, } @@ -743,6 +747,7 @@ class _CPUMigrationBase(LisaTest): def _test_util_per_cpu(self, experiment, tasks): trace = self.get_trace(experiment) + if not trace.hasEvents('sched_switch'): raise ValueError('No sched_switch events. ' 'Does the kernel support them?') @@ -750,31 +755,29 @@ class _CPUMigrationBase(LisaTest): raise ValueError('No sched_load_cfs_rq events. ' 'Does the kernel support them?') cpus = set() - # Load the JSON tasks description - tasks_desc = json.load(open(experiment.wload.params['custom']), - object_pairs_hook=OrderedDict)['tasks'] - sw_df = trace.data_frame.trace_event('sched_switch') + # Filter the event related to the tasks - sw_df = sw_df[sw_df.next_comm.isin(tasks_desc.keys())] + sw_df = trace.data_frame.trace_event('sched_switch') + sw_df = sw_df[sw_df.next_comm.isin(self.tasks_desc.keys())] util_df = trace.data_frame.trace_event('sched_load_cfs_rq') - phases = self._get_phases_names(self._get_one_task(tasks_desc, 0)) + phases = self._get_phases_names(self._get_one_task(self.tasks_desc, 0)) # Compute the interval where the signal is stable for the phases window = self._get_stable_window(sw_df, - self._get_one_task(tasks_desc, 0)) + self._get_one_task(self.tasks_desc, 0)) msg = 'Saw util {} on cpu {}, expected {} during phase {}' for phase in phases: # Get all the cpus where tasks are running during this phase - for task in tasks_desc.iteritems(): + for task in self.tasks_desc.iteritems(): cpus.update(self._get_cpus(task[1], phase)) # Get the mean utilization per CPU util_mean = self._get_util_mean(window[phase][0], window[phase][1], util_df, cpus) # Get the expected utilization per CPU - expected = self._get_util_expected(tasks_desc, cpus, phase) + expected = self._get_util_expected(self.tasks_desc, cpus, phase) # Check that the expected utilization value and the measured one # match for each CPU. -- GitLab