예제 #1
0
    def test_reader_plain(self):
        reader = c_cacheReader.setup_reader("{}/trace.txt".format(DAT_FOLDER),
                                            'p')
        lines = c_cacheReader.get_num_of_req(reader)
        self.assertEqual(lines, 113872)
        first_request = c_cacheReader.read_one_element(reader)
        self.assertEqual(int(first_request), 42932745)

        c_cacheReader.reset_reader(reader)
        first_request = c_cacheReader.read_one_element(reader)
        self.assertEqual(int(first_request), 42932745)
        c_cacheReader.close_reader(reader)
예제 #2
0
    def test_reader_vscsi(self):
        reader = c_cacheReader.setup_reader(
            "{}/trace.vscsi".format(DAT_FOLDER), 'v')
        lines = c_cacheReader.get_num_of_req(reader)
        self.assertEqual(lines, 113872)

        first_request = c_cacheReader.read_one_element(reader)
        self.assertEqual(int(first_request),
                         42932745)  # +1 is to avoid block 0

        c_cacheReader.reset_reader(reader)
        first_request = c_cacheReader.read_one_element(reader)
        self.assertEqual(int(first_request), 42932745)
        c_cacheReader.close_reader(reader)
예제 #3
0
 def test_potpourri(self):
     vReader = c_cacheReader.setup_reader(
         "{}/trace.vscsi".format(DAT_FOLDER), 'v')
     cReader = c_cacheReader.setup_reader("{}/trace.csv".format(DAT_FOLDER),
                                          'c',
                                          data_type='l',
                                          init_params={
                                              "header": True,
                                              "delimiter": ",",
                                              "label": 5,
                                              "size": 4
                                          })
     e1 = c_cacheReader.read_one_element(vReader)
     e2 = c_cacheReader.read_one_element(cReader)
     while e1 and e2:
         self.assertEqual(e1, e2)
         e1 = c_cacheReader.read_one_element(vReader)
         e2 = c_cacheReader.read_one_element(cReader)
예제 #4
0
    def test_creader_binary(self):
        reader = c_cacheReader.setup_reader(
            "{}/trace.vscsi".format(DAT_FOLDER),
            'b',
            data_type='l',
            init_params={
                "label": 6,
                "real_time": 7,
                "fmt": "<3I2H2Q"
            })
        lines = c_cacheReader.get_num_of_req(reader)
        self.assertEqual(lines, 113872)
        first_request = c_cacheReader.read_one_element(reader)
        self.assertEqual(int(first_request), 42932745)

        c_cacheReader.reset_reader(reader)
        first_request = c_cacheReader.read_one_element(reader)
        self.assertEqual(int(first_request), 42932745)
        c_cacheReader.close_reader(reader)
예제 #5
0
    def test_reader_csv(self):
        reader = c_cacheReader.setup_reader("{}/trace.csv".format(DAT_FOLDER),
                                            'c',
                                            data_type='c',
                                            init_params={
                                                "header": True,
                                                "delimiter": ",",
                                                "label": 5,
                                                "size": 4
                                            })
        lines = c_cacheReader.get_num_of_req(reader)
        self.assertEqual(lines, 113872)
        first_request = c_cacheReader.read_one_element(reader)
        self.assertEqual(int(first_request), 42932745)

        c_cacheReader.reset_reader(reader)
        first_request = c_cacheReader.read_one_element(reader)
        self.assertEqual(int(first_request), 42932745)
        c_cacheReader.close_reader(reader)