Skip to content

Commit 5128c09

Browse files
committed
Added a way of identifying if the pub or sub is the one that does not support a feature
1 parent e7139f5 commit 5128c09

File tree

3 files changed

+63
-25
lines changed

3 files changed

+63
-25
lines changed

generate_xlsx_report.py

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,19 @@
2222
from enum import Enum
2323

2424
class TestStatus(Enum):
25+
"""
26+
Enumeration of the test status.
27+
PASSED: The test has passed
28+
FAILED: The test has failed
29+
PUB_UNSUPPORTED: The test is unsupported for the Publisher
30+
SUB_UNSUPPORTED: The test is unsupported for the Subscriber
31+
PUB_SUB_UNSUPPORTED: The test is unsupported for both Publisher and Subscriber
32+
"""
2533
PASSED = 1
2634
FAILED = 2
27-
UNSUPPORTED = 3
35+
PUB_UNSUPPORTED = 3
36+
SUB_UNSUPPORTED = 4
37+
PUB_SUB_UNSUPPORTED = 5
2838

2939
class XlxsReportArgumentParser:
3040
"""Class that parse the arguments of the application."""
@@ -236,25 +246,42 @@ def get_info(self, input: pathlib.Path = None):
236246
# subscriber
237247
unsupported_tests_count = 0
238248
for case in list(iter(suite)):
239-
this_test_unsupported = False
249+
is_pub_unsupported = False
250+
is_sub_unsupported = False
251+
status = None
240252
test_name = re.search(r'((?:Test_)[\S]+_\d+)', case.name).group(1)
241253

242254
# count number of unsupported tests for the summary
243255
# result array is not empty and the message contains 'UNSUPPORTED_FEATURE'
244-
if case.result and len(case.result) > 0 \
245-
and 'UNSUPPORTED_FEATURE' in case.result[0].message.upper():
256+
if case.result and len(case.result) > 0:
257+
if 'PUB_UNSUPPORTED_FEATURE' in case.result[0].message.upper():
258+
is_pub_unsupported = True
259+
if 'SUB_UNSUPPORTED_FEATURE' in case.result[0].message.upper():
260+
is_sub_unsupported = True
261+
262+
if is_pub_unsupported or is_sub_unsupported:
246263
unsupported_tests_count += 1
247-
this_test_unsupported = True
264+
265+
# Get test status
266+
if case.is_passed:
267+
status = TestStatus.PASSED
268+
elif is_pub_unsupported and is_sub_unsupported:
269+
status = TestStatus.PUB_SUB_UNSUPPORTED
270+
elif is_pub_unsupported:
271+
status = TestStatus.PUB_UNSUPPORTED
272+
elif is_sub_unsupported:
273+
status = TestStatus.SUB_UNSUPPORTED
274+
else:
275+
status = TestStatus.FAILED
276+
248277

249278
# update the value of the publisher_name as publisher with
250279
# all products as subscribers.
251280
# the tuple is (subscriber_name, test_name, status)
252281
publisher_test_result = JunitTestCaseAggregatedData(
253282
product=subscriber_name,
254283
test_name=test_name,
255-
status=TestStatus.PASSED if case.is_passed
256-
else TestStatus.FAILED if not this_test_unsupported
257-
else TestStatus.UNSUPPORTED
284+
status=status
258285
)
259286

260287
# add the resulting tuple to the publisher dictionary, the key
@@ -272,9 +299,7 @@ def get_info(self, input: pathlib.Path = None):
272299
subscriber_test_result = JunitTestCaseAggregatedData(
273300
product=publisher_name,
274301
test_name=test_name,
275-
status=TestStatus.PASSED if case.is_passed
276-
else TestStatus.FAILED if not this_test_unsupported
277-
else TestStatus.UNSUPPORTED
302+
status=status
278303
)
279304

280305
# add the resulting tuple to the subscriber dictionary, the key
@@ -677,10 +702,21 @@ def add_product_table(self,
677702
element.get_test_name(),
678703
self.__formats['bold_w_border'])
679704

680-
# set OK or ERROR if the test passed or not
681-
str_result = 'OK' if element.get_status() == TestStatus.PASSED \
682-
else 'ERROR' if element.get_status() == TestStatus.FAILED \
683-
else 'UNSUPPORTED'
705+
# get status string of the test result
706+
if element.get_status() == TestStatus.PASSED:
707+
str_result = 'OK'
708+
elif element.get_status() == TestStatus.FAILED:
709+
str_result = 'ERROR'
710+
elif element.get_status() == TestStatus.PUB_UNSUPPORTED:
711+
str_result = 'PUB UNSUPPORTED'
712+
elif element.get_status() == TestStatus.SUB_UNSUPPORTED:
713+
str_result = 'SUB UNSUPPORTED'
714+
elif element.get_status() == TestStatus.PUB_SUB_UNSUPPORTED:
715+
str_result = 'PUB/SUB UNSUPPORTED'
716+
else:
717+
str_result = 'UNKNOWN'
718+
719+
# write status string to the test result
684720
worksheet.write(
685721
process_row,
686722
process_column,

interoperability_report.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def run_subscriber_shape_main(
148148
if index == 2 or index == 3:
149149
produced_code[produced_code_index] = ReturnCode.TOPIC_NOT_CREATED
150150
elif index == 1:
151-
produced_code[produced_code_index] = ReturnCode.UNSUPPORTED_FEATURE
151+
produced_code[produced_code_index] = ReturnCode.SUB_UNSUPPORTED_FEATURE
152152
elif index == 0:
153153
# Step 3: Check if the reader is created
154154
log_message(f'Subscriber {subscriber_index}: Waiting for DataReader '
@@ -170,7 +170,7 @@ def run_subscriber_shape_main(
170170
elif index == 1:
171171
produced_code[produced_code_index] = ReturnCode.FILTER_NOT_CREATED
172172
elif index == 2:
173-
produced_code[produced_code_index] = ReturnCode.UNSUPPORTED_FEATURE
173+
produced_code[produced_code_index] = ReturnCode.SUB_UNSUPPORTED_FEATURE
174174
elif index == 0:
175175
# Step 4: Read data or incompatible qos or deadline missed
176176
log_message(f'Subscriber {subscriber_index}: Waiting for data', verbosity)
@@ -194,7 +194,7 @@ def run_subscriber_shape_main(
194194
elif index == 4 or index == 5:
195195
produced_code[produced_code_index] = ReturnCode.DATA_NOT_RECEIVED
196196
elif index == 3:
197-
produced_code[produced_code_index] = ReturnCode.UNSUPPORTED_FEATURE
197+
produced_code[produced_code_index] = ReturnCode.SUB_UNSUPPORTED_FEATURE
198198
elif index == 0:
199199
# Step 5: Receiving samples
200200
log_message(f'Subscriber {subscriber_index}: Receiving samples',
@@ -300,7 +300,7 @@ def run_publisher_shape_main(
300300
if index == 2 or index == 3:
301301
produced_code[produced_code_index] = ReturnCode.TOPIC_NOT_CREATED
302302
elif index == 1:
303-
produced_code[produced_code_index] = ReturnCode.UNSUPPORTED_FEATURE
303+
produced_code[produced_code_index] = ReturnCode.PUB_UNSUPPORTED_FEATURE
304304
elif index == 0:
305305
# Step 3: Check if the writer is created
306306
log_message(f'Publisher {publisher_index}: Waiting for DataWriter '
@@ -317,7 +317,7 @@ def run_publisher_shape_main(
317317
if index == 2 or index == 3:
318318
produced_code[produced_code_index] = ReturnCode.WRITER_NOT_CREATED
319319
elif index == 1:
320-
produced_code[produced_code_index] = ReturnCode.UNSUPPORTED_FEATURE
320+
produced_code[produced_code_index] = ReturnCode.PUB_UNSUPPORTED_FEATURE
321321
elif index == 0:
322322
# Step 4: Check if the writer matches the reader
323323
log_message(f'Publisher {publisher_index}: Waiting for matching '
@@ -337,7 +337,7 @@ def run_publisher_shape_main(
337337
elif index == 1:
338338
produced_code[produced_code_index] = ReturnCode.INCOMPATIBLE_QOS
339339
elif index == 2:
340-
produced_code[produced_code_index] = ReturnCode.UNSUPPORTED_FEATURE
340+
produced_code[produced_code_index] = ReturnCode.PUB_UNSUPPORTED_FEATURE
341341
elif index == 0:
342342
# In the case that the option -w is selected, the Publisher
343343
# saves the samples sent in order, so the Subscriber can check
@@ -360,7 +360,7 @@ def run_publisher_shape_main(
360360
elif index == 3 or index == 4:
361361
produced_code[produced_code_index] = ReturnCode.DATA_NOT_SENT
362362
elif index == 2:
363-
produced_code[produced_code_index] = ReturnCode.UNSUPPORTED_FEATURE
363+
produced_code[produced_code_index] = ReturnCode.PUB_UNSUPPORTED_FEATURE
364364
elif index == 0:
365365
produced_code[produced_code_index] = ReturnCode.OK
366366
log_message(f'Publisher {publisher_index}: Sending '
@@ -384,7 +384,7 @@ def run_publisher_shape_main(
384384
produced_code[produced_code_index] = ReturnCode.DEADLINE_MISSED
385385
break
386386
elif index == 2:
387-
produced_code[produced_code_index] = ReturnCode.UNSUPPORTED_FEATURE
387+
produced_code[produced_code_index] = ReturnCode.PUB_UNSUPPORTED_FEATURE
388388
break
389389
elif index == 3:
390390
produced_code[produced_code_index] = ReturnCode.DATA_NOT_SENT

rtps_test_utilities.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ class ReturnCode(Enum):
2828
DEADLINE_MISSED : Publisher/Subscriber missed the deadline period
2929
ORDERED_ACCESS_INSTANCE : Subscriber reading with ordered access and access scope INSTANCE
3030
ORDERED_ACCESS_TOPIC : Subscriber reading with ordered access and access scope TOPIC
31-
UNSUPPORTED_FEATURE : The test requires a feature not supported by the implementation
31+
PUB_UNSUPPORTED_FEATURE : The test requires a feature not supported by the publisher implementation
32+
SUB_UNSUPPORTED_FEATURE : The test requires a feature not supported by the subscriber implementation
3233
"""
3334
OK = 0
3435
TOPIC_NOT_CREATED = 1
@@ -45,7 +46,8 @@ class ReturnCode(Enum):
4546
DEADLINE_MISSED = 14
4647
ORDERED_ACCESS_INSTANCE = 15
4748
ORDERED_ACCESS_TOPIC = 16
48-
UNSUPPORTED_FEATURE = 17
49+
PUB_UNSUPPORTED_FEATURE = 17
50+
SUB_UNSUPPORTED_FEATURE = 18
4951

5052
def log_message(message, verbosity):
5153
if verbosity:

0 commit comments

Comments
 (0)