Skip to content

Commit f31cd8f

Browse files
committed
Added a basic check for received samples
1 parent 0b666e0 commit f31cd8f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

interoperability_report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
if __name__ == "__main__" and platform.system() == "Darwin":
2525
multiprocessing.set_start_method('fork')
2626

27-
from rtps_test_utilities import ReturnCode, log_message, no_check, remove_ansi_colors
27+
from rtps_test_utilities import ReturnCode, log_message, basic_check, remove_ansi_colors
2828

2929
# This parameter is used to save the samples the Publisher sends.
3030
# MAX_SAMPLES_SAVED is the maximum number of samples saved.
@@ -846,7 +846,7 @@ def main():
846846
raise RuntimeError('Cannot process function of '
847847
f'test case: {test_case_name}')
848848
else:
849-
check_function = no_check
849+
check_function = basic_check
850850

851851
assert(len(parameters) == len(expected_codes))
852852

rtps_test_utilities.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,15 @@ def remove_ansi_colors(text):
6060

6161
def no_check(child_sub, samples_sent, last_sample_saved, timeout):
6262
return ReturnCode.OK
63+
64+
def basic_check(child_sub, samples_sent, last_sample_saved, timeout):
65+
sub_string = re.search('[0-9]+ [0-9]+ \[([0-9]+)\]',
66+
child_sub.before + child_sub.after)
67+
68+
# check the sample contains some info, just checking the size is different
69+
# than zero is enough
70+
if sub_string is not None:
71+
if int(sub_string.group(1)) != 0:
72+
return ReturnCode.OK
73+
74+
return ReturnCode.DATA_NOT_CORRECT

0 commit comments

Comments
 (0)