def analyze(self):
        """
        Analyzes and eventually compares sets of IOzone data.
        """
        overall = []
        record_size = []
        file_size = []
        for path in self.list_files:
            c_file = open(path, 'r')
            self.log.info('FILE: %s', path)

            results = self.parse_file(c_file)

            overall_results = self.process_results(results)
            record_size_results = self.process_results(results, 'record_size')
            file_size_results = self.process_results(results, 'file_size')
            self.report(overall_results, record_size_results,
                        file_size_results)

            if len(self.list_files) == 2:
                overall.append(overall_results)
                record_size.append(record_size_results)
                file_size.append(file_size_results)

        if len(self.list_files) == 2:
            record_comparison = data_structures.compare_matrices(*record_size)
            file_comparison = data_structures.compare_matrices(*file_size)
            self.report_comparison(record_comparison, file_comparison)
 def test_compare_matrices(self):
     """
     Verify the correct value is produced when comparing matrices.
     """
     # Note that first row contains header in first column, while the
     # second contains only values (for testing purposes)
     matrix1 = [["header", 51.7, 60], [1, 0, 0]]
     matrix2 = [["header", 57.2, 54], [2, 51, 0]]
     self.assertEqual(data_structures.compare_matrices(matrix1, matrix2),
                      ([["header", '+10.6382978723', -10.0], ['+100.0',
                       'error_51/0', '.']], 3, 1, 5))
Beispiel #3
0
 def test_compare_matrices(self):
     """
     Verify the correct value is produced when comparing matrices.
     """
     # Note that first row contains header in first column, while the
     # second contains only values (for testing purposes)
     matrix1 = [["header", 51.7, 60], [1, 0, 0]]
     matrix2 = [["header", 57.2, 54], [2, 51, 0]]
     self.assertEqual(data_structures.compare_matrices(matrix1, matrix2),
                      ([["header", '+10.6383', -10.0],
                        ['+100', 'error_51/0', '.']], 3, 1, 5))