diff --git a/perf/perf_pmu.py b/perf/perf_pmu.py index 13cbf58d3..578316f95 100644 --- a/perf/perf_pmu.py +++ b/perf/perf_pmu.py @@ -14,6 +14,7 @@ # Author: Nageswara R Sastry import os +import configparser import glob from avocado import Test from avocado.utils import cpu, dmesg, genio, linux_modules, process @@ -109,14 +110,11 @@ def test_config_PMU_sysfs(self): sysfs_file = "/sys/devices/system/cpu/cpu0/" - sysfs_dict = {"power8": ['mmcr0', 'mmcr1', 'mmcra'], - "power8e": ['mmcr0', 'mmcr1', 'mmcra'], - "power9": ['mmcr0', 'mmcr1', 'mmcra'], - "power10": ['mmcr0', 'mmcr1', 'mmcr3', 'mmcra']} - + parser = configparser.ConfigParser() + parser.read(self.get_data('sysfs_PMU.cfg')) + sysfs_PMU_list = parser.get(self.model, 'dir_list').split(',') # Check for any missing files according to the model - self._check_file_existence( - sysfs_dict[self.model], os.listdir(sysfs_file)) + self._check_file_existence(sysfs_PMU_list, os.listdir(sysfs_file)) try: for filename in glob.glob("%smmcr*" % sysfs_file): diff --git a/perf/perf_pmu.py.data/sysfs_PMU.cfg b/perf/perf_pmu.py.data/sysfs_PMU.cfg new file mode 100644 index 000000000..2da4cfe02 --- /dev/null +++ b/perf/perf_pmu.py.data/sysfs_PMU.cfg @@ -0,0 +1,10 @@ +[power8] +dir_list = mmcr0,mmcr1,mmcra +[power8e] +dir_list = mmcr0,mmcr1,mmcra +[power9] +dir_list = mmcr0,mmcr1,mmcra +[power10] +dir_list = mmcr0,mmcr1,mmcr3,mmcra +[power11] +dir_list = mmcr0,mmcr1,mmcr3,mmcra