|
37 | 37 | "org.eclipse.tracecompass.analysis.timing.core.segmentstore.SegmentStoreStatisticsDataProvider:" |
38 | 38 | "org.eclipse.linuxtools.lttng2.ust.analysis.callstack" |
39 | 39 | ) |
| 40 | +TABLE_DP_ID = ( |
| 41 | + "org.eclipse.tracecompass.analysis.timing.core.segmentstore.SegmentStoreTableDataProvider:" |
| 42 | + "org.eclipse.linuxtools.lttng2.ust.analysis.callstack" |
| 43 | +) |
| 44 | + |
40 | 45 | REQUESTED_TIME_START = 1332170682440133097 |
41 | 46 | REQUESTED_TIME_END = 1332170692664579801 |
42 | 47 | REQUESTED_TIME_LENGTH = 10 |
|
47 | 52 | CONFIG_SOURCE_TYPE = 'org.eclipse.tracecompass.tmf.core.config.xmlsourcetype' |
48 | 53 |
|
49 | 54 | # pylint: disable=too-many-public-methods |
| 55 | + |
| 56 | + |
50 | 57 | class TestTspClient: |
51 | 58 | """TspClient test methods. |
52 | 59 |
|
@@ -81,34 +88,34 @@ def _delete_traces(self): |
81 | 88 | @pytest.fixture(scope='module') |
82 | 89 | def extension(self): |
83 | 90 | """Absolute xml analysis file path.""" |
84 | | - return (f'{os.getcwd()}/org.eclipse.tracecompass.incubator/tracetypes/' |
85 | | - f'org.eclipse.tracecompass.incubator.ftrace.core/xml_analyses/{self.name}') |
| 91 | + return os.path.join(os.getcwd(), 'org.eclipse.tracecompass.incubator', 'tracetypes', |
| 92 | + 'org.eclipse.tracecompass.incubator.ftrace.core', 'xml_analyses', self.name) |
86 | 93 |
|
87 | 94 | @staticmethod |
88 | 95 | @pytest.fixture(scope='module') |
89 | 96 | def kernel(): |
90 | 97 | """Absolute kernel test trace path.""" |
91 | | - return f'{os.getcwd()}/tracecompass-test-traces/ctf/src/main/resources/kernel' |
| 98 | + return os.path.join(os.getcwd(), 'tracecompass-test-traces', 'ctf', 'src', 'main', 'resources', 'kernel') |
92 | 99 |
|
93 | 100 | @staticmethod |
94 | 101 | @pytest.fixture(scope='module') |
95 | 102 | def other(): |
96 | 103 | """Absolute kernel-vm test trace path.""" |
97 | | - return f'{os.getcwd()}/tracecompass-test-traces/ctf/src/main/resources/kernel_vm' |
| 104 | + return os.path.join(os.getcwd(), 'tracecompass-test-traces', 'ctf', 'src', 'main', 'resources', 'kernel_vm') |
98 | 105 |
|
99 | 106 | @staticmethod |
100 | 107 | @pytest.fixture(scope='module') |
101 | 108 | def switches(): |
102 | 109 | """Absolute switches test trace path.""" |
103 | | - return (f'{os.getcwd()}/tracecompass-test-traces/ctf/src/main/resources/context-switches/' |
104 | | - f'context-switches-kernel') |
| 110 | + return os.path.join(os.getcwd(), 'tracecompass-test-traces', 'ctf', 'src', 'main', 'resources', 'context-switches', |
| 111 | + 'context-switches-kernel') |
105 | 112 |
|
106 | 113 | @staticmethod |
107 | 114 | @pytest.fixture(scope='module') |
108 | 115 | def ust(): |
109 | 116 | """Absolute ust test trace path.""" |
110 | | - return (f'{os.getcwd()}/tracecompass-test-traces/ctf/src/main/resources/context-switches/' |
111 | | - f'context-switches-ust') |
| 117 | + return os.path.join(os.getcwd(), 'tracecompass-test-traces', 'ctf', 'src', 'main', 'resources', 'context-switches', |
| 118 | + 'context-switches-ust') |
112 | 119 |
|
113 | 120 | @pytest.fixture(scope="module", autouse=True) |
114 | 121 | def test_fetch_traces(self): |
@@ -415,6 +422,88 @@ def test_fetch_timegraph_tree_complete(self, kernel): |
415 | 422 | self._delete_experiments() |
416 | 423 | self._delete_traces() |
417 | 424 |
|
| 425 | + def test_fetch_virtual_table_columns(self, ust): |
| 426 | + """Expect virtual table columns out of opened trace experiment.""" |
| 427 | + traces = [] |
| 428 | + response = self.tsp_client.open_trace(os.path.basename(ust), ust) |
| 429 | + traces.append(response.model.UUID) |
| 430 | + response = self.tsp_client.open_experiment( |
| 431 | + os.path.basename(ust), traces) |
| 432 | + assert response.status_code == 200 |
| 433 | + experiment_uuid = response.model.UUID |
| 434 | + |
| 435 | + status = ResponseStatus.RUNNING.name |
| 436 | + while status == ResponseStatus.RUNNING.name: |
| 437 | + time.sleep(1) |
| 438 | + response = self.tsp_client.fetch_virtual_table_columns( |
| 439 | + exp_uuid=experiment_uuid, output_id=TABLE_DP_ID) |
| 440 | + assert response.model is not None |
| 441 | + status = response.model.status.upper() |
| 442 | + |
| 443 | + output_id = TABLE_DP_ID |
| 444 | + response = self.tsp_client.fetch_virtual_table_columns(exp_uuid=experiment_uuid, output_id=output_id) |
| 445 | + assert response.status_code == 200 |
| 446 | + assert response.model.model_type == response.model.model_type.VIRTUAL_TABLE_HEADER |
| 447 | + assert len(response.model.model.columns) > 0 |
| 448 | + for column in response.model.model.columns: |
| 449 | + assert column.id is not None |
| 450 | + assert column.name is not None |
| 451 | + |
| 452 | + self._delete_experiments() |
| 453 | + self._delete_traces() |
| 454 | + |
| 455 | + def test_fetch_virtual_table_lines(self, ust): |
| 456 | + """Expect virtual table out of opened trace experiment.""" |
| 457 | + traces = [] |
| 458 | + response = self.tsp_client.open_trace(os.path.basename(ust), ust) |
| 459 | + traces.append(response.model.UUID) |
| 460 | + response = self.tsp_client.open_experiment( |
| 461 | + os.path.basename(ust), traces) |
| 462 | + assert response.status_code == 200 |
| 463 | + experiment_uuid = response.model.UUID |
| 464 | + |
| 465 | + status = ResponseStatus.RUNNING.name |
| 466 | + while status == ResponseStatus.RUNNING.name: |
| 467 | + time.sleep(1) |
| 468 | + response = self.tsp_client.fetch_virtual_table_columns( |
| 469 | + exp_uuid=experiment_uuid, output_id=TABLE_DP_ID) |
| 470 | + assert response.model is not None |
| 471 | + status = response.model.status.upper() |
| 472 | + |
| 473 | + output_id = TABLE_DP_ID |
| 474 | + response = self.tsp_client.fetch_virtual_table_columns(exp_uuid=experiment_uuid, output_id=output_id) |
| 475 | + assert response.status_code == 200 |
| 476 | + assert response.model.model_type == response.model.model_type.VIRTUAL_TABLE_HEADER |
| 477 | + assert len(response.model.model.columns) > 0 |
| 478 | + for column in response.model.model.columns: |
| 479 | + assert column.id is not None |
| 480 | + assert column.name is not None |
| 481 | + |
| 482 | + LOW_INDEX = 0 |
| 483 | + LINE_COUNT = 10 |
| 484 | + |
| 485 | + params = { |
| 486 | + TspClient.PARAMETERS_KEY: { |
| 487 | + TspClient.REQUESTED_TABLE_LINE_INDEX_KEY: LOW_INDEX, |
| 488 | + TspClient.REQUESTED_TABLE_LINE_COUNT_KEY: LINE_COUNT |
| 489 | + } |
| 490 | + } |
| 491 | + response = self.tsp_client.fetch_virtual_table_lines(exp_uuid=experiment_uuid, output_id=output_id, parameters=params) |
| 492 | + assert response.status_code == 200 |
| 493 | + assert response.model.model_type == response.model.model_type.VIRTUAL_TABLE |
| 494 | + assert len(response.model.model.lines) == 10 |
| 495 | + for i, line in enumerate(response.model.model.lines): |
| 496 | + assert line.index is not None |
| 497 | + if i == 0: |
| 498 | + assert line.index == LOW_INDEX |
| 499 | + |
| 500 | + assert len(line.cells) > 0 |
| 501 | + for cell in line.cells: |
| 502 | + assert cell.content is not None |
| 503 | + |
| 504 | + self._delete_experiments() |
| 505 | + self._delete_traces() |
| 506 | + |
418 | 507 | def test_fetch_configuration_sources(self): |
419 | 508 | """Expect at least configuration source .""" |
420 | 509 | response = self.tsp_client.fetch_configuration_sources() |
|
0 commit comments