Skip to content

Commit bee6568

Browse files
angelrtiMiguelCompanyarulmoondra1mitza-oci
authored
Adding support for Micro and unsupported test scenarios (#78)
* Other improvements --------- Co-authored-by: Miguel Company <miguelcompany@eprosima.com> Co-authored-by: Arul Moondra <arul@rti.com> Co-authored-by: Adam Mitz <mitza@objectcomputing.com>
1 parent 6b75d87 commit bee6568

12 files changed

+1009
-167
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,16 @@ GeneratedCode
4848

4949
# Generated files
5050
srcCxx/shape.*
51+
!srcCxx/shape.idl
5152
srcCxx/shapePlugin.*
5253
srcCxx/shapeSupport.*
5354

55+
# Generated files Connext Micro
56+
srcCxx/shape_bounded.*
57+
!srcCxx/shape_bounded.idl
58+
srcCxx/shape_boundedPlugin.*
59+
srcCxx/shape_boundedSupport.*
60+
5461
# VSCode default folders
5562
.vscode/
5663
build/

generate_xlsx_report.py

Lines changed: 170 additions & 63 deletions
Large diffs are not rendered by default.

interoperability_report.py

Lines changed: 65 additions & 30 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.
@@ -51,16 +51,19 @@ def stop_process(child_process, timeout=30, poll_interval=0.2):
5151
else:
5252
return True # Process already exited
5353

54-
start_time = time.time()
54+
return_value = True
5555

56+
start_time = time.time()
5657
while child_process.isalive() and (time.time() - start_time < timeout):
5758
time.sleep(poll_interval)
5859

5960
if child_process.isalive():
6061
child_process.terminate(force=True)
61-
return False # Process was forcefully terminated
62+
return_value = False # Process was forcefully terminated
63+
64+
child_process.expect(pexpect.EOF, timeout=5)
6265

63-
return True
66+
return return_value
6467

6568
def run_subscriber_shape_main(
6669
name_executable: str,
@@ -138,40 +141,51 @@ def run_subscriber_shape_main(
138141
index = child_sub.expect(
139142
[
140143
'Create topic:', # index = 0
141-
pexpect.TIMEOUT, # index = 1
142-
pexpect.EOF # index = 2
144+
re.compile('not supported', re.IGNORECASE), # index = 1
145+
pexpect.TIMEOUT, # index = 2
146+
pexpect.EOF # index = 3
143147
],
144148
timeout
145149
)
146150

147-
if index == 1 or index == 2:
151+
if index == 2 or index == 3:
148152
produced_code[produced_code_index] = ReturnCode.TOPIC_NOT_CREATED
153+
elif index == 1:
154+
produced_code[produced_code_index] = ReturnCode.SUB_UNSUPPORTED_FEATURE
149155
elif index == 0:
150156
# Step 3: Check if the reader is created
151157
log_message(f'Subscriber {subscriber_index}: Waiting for DataReader '
152158
'creation', verbosity)
153159
index = child_sub.expect(
154160
[
155161
'Create reader for topic:', # index = 0
156-
pexpect.TIMEOUT, # index = 1
157-
'failed to create content filtered topic' # index = 2
162+
'failed to create content filtered topic', # index = 1
163+
re.compile('not supported', re.IGNORECASE), # index = 2
164+
pexpect.TIMEOUT, # index = 3
165+
pexpect.EOF # index = 4
166+
158167
],
159168
timeout
160169
)
161170

162-
if index == 1:
171+
if index == 3 or index == 4:
163172
produced_code[produced_code_index] = ReturnCode.READER_NOT_CREATED
164-
elif index == 2:
173+
elif index == 1:
165174
produced_code[produced_code_index] = ReturnCode.FILTER_NOT_CREATED
175+
elif index == 2:
176+
produced_code[produced_code_index] = ReturnCode.SUB_UNSUPPORTED_FEATURE
166177
elif index == 0:
167178
# Step 4: Read data or incompatible qos or deadline missed
168179
log_message(f'Subscriber {subscriber_index}: Waiting for data', verbosity)
169180
index = child_sub.expect(
170181
[
171-
'\[[0-9]+\]', # index = 0
182+
r'\[[0-9]+\]', # index = 0
172183
'on_requested_incompatible_qos()', # index = 1
173184
'on_requested_deadline_missed()', # index = 2
174-
pexpect.TIMEOUT, # index = 3
185+
re.compile('not supported', re.IGNORECASE), # index = 3
186+
pexpect.TIMEOUT, # index = 4
187+
pexpect.EOF # index = 5
188+
175189
],
176190
timeout
177191
)
@@ -180,8 +194,10 @@ def run_subscriber_shape_main(
180194
produced_code[produced_code_index] = ReturnCode.INCOMPATIBLE_QOS
181195
elif index == 2:
182196
produced_code[produced_code_index] = ReturnCode.DEADLINE_MISSED
183-
elif index == 3:
197+
elif index == 4 or index == 5:
184198
produced_code[produced_code_index] = ReturnCode.DATA_NOT_RECEIVED
199+
elif index == 3:
200+
produced_code[produced_code_index] = ReturnCode.SUB_UNSUPPORTED_FEATURE
185201
elif index == 0:
186202
# Step 5: Receiving samples
187203
log_message(f'Subscriber {subscriber_index}: Receiving samples',
@@ -277,43 +293,54 @@ def run_publisher_shape_main(
277293
index = child_pub.expect(
278294
[
279295
'Create topic:', # index == 0
280-
pexpect.TIMEOUT, # index == 1
281-
pexpect.EOF # index == 2
296+
re.compile('not supported', re.IGNORECASE), # index = 1
297+
pexpect.TIMEOUT, # index == 2
298+
pexpect.EOF # index == 3
282299
],
283300
timeout
284301
)
285302

286-
if index == 1 or index == 2:
303+
if index == 2 or index == 3:
287304
produced_code[produced_code_index] = ReturnCode.TOPIC_NOT_CREATED
305+
elif index == 1:
306+
produced_code[produced_code_index] = ReturnCode.PUB_UNSUPPORTED_FEATURE
288307
elif index == 0:
289308
# Step 3: Check if the writer is created
290309
log_message(f'Publisher {publisher_index}: Waiting for DataWriter '
291310
'creation', verbosity)
292311
index = child_pub.expect(
293312
[
294313
'Create writer for topic', # index = 0
295-
pexpect.TIMEOUT # index = 1
314+
re.compile('not supported', re.IGNORECASE), # index = 1
315+
pexpect.TIMEOUT, # index = 2
316+
pexpect.EOF # index == 3
296317
],
297318
timeout
298319
)
299-
if index == 1:
320+
if index == 2 or index == 3:
300321
produced_code[produced_code_index] = ReturnCode.WRITER_NOT_CREATED
322+
elif index == 1:
323+
produced_code[produced_code_index] = ReturnCode.PUB_UNSUPPORTED_FEATURE
301324
elif index == 0:
302325
# Step 4: Check if the writer matches the reader
303326
log_message(f'Publisher {publisher_index}: Waiting for matching '
304327
'DataReader', verbosity)
305328
index = child_pub.expect(
306329
[
307330
'on_publication_matched()', # index = 0
308-
pexpect.TIMEOUT, # index = 1
309-
'on_offered_incompatible_qos' # index = 2
331+
'on_offered_incompatible_qos', # index = 1
332+
re.compile('not supported', re.IGNORECASE), # index = 2
333+
pexpect.TIMEOUT, # index = 3
334+
pexpect.EOF # index == 4
310335
],
311336
timeout
312337
)
313-
if index == 1:
338+
if index == 3 or index == 4:
314339
produced_code[produced_code_index] = ReturnCode.READER_NOT_MATCHED
315-
elif index == 2:
340+
elif index == 1:
316341
produced_code[produced_code_index] = ReturnCode.INCOMPATIBLE_QOS
342+
elif index == 2:
343+
produced_code[produced_code_index] = ReturnCode.PUB_UNSUPPORTED_FEATURE
317344
elif index == 0:
318345
# In the case that the option -w is selected, the Publisher
319346
# saves the samples sent in order, so the Subscriber can check
@@ -324,15 +351,19 @@ def run_publisher_shape_main(
324351
if '-w ' in parameters or parameters.endswith('-w'):
325352
# Step 5: Check whether the writer sends the samples
326353
index = child_pub.expect([
327-
'\[[0-9]+\]', # index = 0
354+
r'\[[0-9]+\]', # index = 0
328355
'on_offered_deadline_missed()', # index = 1
329-
pexpect.TIMEOUT # index = 2
356+
re.compile('not supported', re.IGNORECASE), # index = 2
357+
pexpect.TIMEOUT, # index = 3
358+
pexpect.EOF # index == 4
330359
],
331360
timeout)
332361
if index == 1:
333362
produced_code[produced_code_index] = ReturnCode.DEADLINE_MISSED
334-
elif index == 2:
363+
elif index == 3 or index == 4:
335364
produced_code[produced_code_index] = ReturnCode.DATA_NOT_SENT
365+
elif index == 2:
366+
produced_code[produced_code_index] = ReturnCode.PUB_UNSUPPORTED_FEATURE
336367
elif index == 0:
337368
produced_code[produced_code_index] = ReturnCode.OK
338369
log_message(f'Publisher {publisher_index}: Sending '
@@ -341,20 +372,24 @@ def run_publisher_shape_main(
341372
for x in range(0, MAX_SAMPLES_SAVED, 1):
342373
# At this point, at least one sample has been printed
343374
# Therefore, that sample is added to samples_sent.
344-
pub_string = re.search('[0-9]+ [0-9]+ \[[0-9]+\]',
375+
pub_string = re.search(r'[0-9]+ [0-9]+ \[[0-9]+\]',
345376
child_pub.before + child_pub.after)
346377
last_sample = pub_string.group(0)
347378
samples_sent.put(last_sample)
348379
index = child_pub.expect([
349-
'\[[0-9]+\]', # index = 0
380+
r'\[[0-9]+\]', # index = 0
350381
'on_offered_deadline_missed()', # index = 1
351-
pexpect.TIMEOUT # index = 2
382+
re.compile('not supported', re.IGNORECASE), # index = 2
383+
pexpect.TIMEOUT # index = 3
352384
],
353385
timeout)
354386
if index == 1:
355387
produced_code[produced_code_index] = ReturnCode.DEADLINE_MISSED
356388
break
357389
elif index == 2:
390+
produced_code[produced_code_index] = ReturnCode.PUB_UNSUPPORTED_FEATURE
391+
break
392+
elif index == 3:
358393
produced_code[produced_code_index] = ReturnCode.DATA_NOT_SENT
359394
break
360395
last_sample_saved.put(last_sample)
@@ -811,7 +846,7 @@ def main():
811846
raise RuntimeError('Cannot process function of '
812847
f'test case: {test_case_name}')
813848
else:
814-
check_function = no_check
849+
check_function = basic_check
815850

816851
assert(len(parameters) == len(expected_codes))
817852

rtps_test_utilities.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +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+
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
3133
"""
3234
OK = 0
3335
TOPIC_NOT_CREATED = 1
@@ -44,6 +46,8 @@ class ReturnCode(Enum):
4446
DEADLINE_MISSED = 14
4547
ORDERED_ACCESS_INSTANCE = 15
4648
ORDERED_ACCESS_TOPIC = 16
49+
PUB_UNSUPPORTED_FEATURE = 17
50+
SUB_UNSUPPORTED_FEATURE = 18
4751

4852
def log_message(message, verbosity):
4953
if verbosity:
@@ -56,3 +60,18 @@ def remove_ansi_colors(text):
5660

5761
def no_check(child_sub, samples_sent, last_sample_saved, timeout):
5862
return ReturnCode.OK
63+
64+
def basic_check(child_sub, samples_sent, last_sample_saved, timeout):
65+
""" Only checks that the data is well formed and size is not zero."""
66+
sub_string = re.search('\w\s+\w+\s+[0-9]+ [0-9]+ \[([0-9]+)\]',
67+
child_sub.before + child_sub.after)
68+
69+
if sub_string is None:
70+
return ReturnCode.DATA_NOT_RECEIVED
71+
72+
sample_size = int(sub_string.group(1))
73+
74+
if sample_size == 0:
75+
return ReturnCode.DATA_NOT_CORRECT
76+
77+
return ReturnCode.OK

run_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ for i in $publisher; do
8181
subscriber_name=$(basename "$j" _shape_main_linux)
8282
echo "Testing Publisher $publisher_name --- Subscriber $subscriber_name"
8383
extra_args=""
84-
if [[ "${subscriber,,}" == *opendds* && "${publisher,,}" == *connext* ]]; then
84+
if [[ "${subscriber_name,,}" == *opendds* && "${publisher_name,,}" == *connext_dds* ]]; then
8585
extra_args="--periodic-announcement 5000"
8686
fi;
8787
if [[ -n $output ]]; then
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
######################################################################
2+
# To compile, type:
3+
# make -f makefile_rti_connext_micro_linux
4+
# To compile with the Debug option, use:
5+
# make -f makefile_rti_connext_micro_linux DEBUG=1
6+
#
7+
# This makefile assumes that your build environment is already correctly
8+
# configured. (For example, the correct version of your compiler and
9+
# linker should be on your PATH.)
10+
#
11+
# You should set the environemnt variable RTIMEHOME to point to where
12+
# RTI Connext Micro is installed.
13+
#
14+
######################################################################
15+
16+
# If undefined in the environment default RTIMEHOME to install dir
17+
ifndef RTIMEHOME
18+
$(error RTIMEHOME not defined)
19+
endif
20+
21+
COMPILER_FLAGS = -m64
22+
LINKER_FLAGS = -m64 -static-libgcc
23+
24+
split_path_name = $(subst /rti_, , $(RTIMEHOME))
25+
# from connext_dds_micro-x.y.z remove _dds to get connext_micro-x.y.z
26+
product_name = $(notdir $(split_path_name))
27+
product_name := $(subst _dds,,$(product_name))
28+
29+
version_name = $(lastword $(product_name))
30+
common_name = "_shape_main_linux"
31+
executable_name = $(version_name)$(common_name)
32+
33+
RTIMEARCH = x64Linux4gcc7.3.0
34+
35+
ifndef COMPILER
36+
COMPILER = g++
37+
endif
38+
39+
ifndef LINKER
40+
LINKER = g++
41+
endif
42+
43+
SYSLIBS = -ldl -lnsl -lm -lpthread -lrt
44+
45+
ifeq ($(DEBUG),1)
46+
COMPILER_FLAGS += -g -O0
47+
LINKER_FLAGS += -g
48+
LIBS = -L$(RTIMEHOME)/lib/$(RTIMEARCH) \
49+
-lrti_me_cppzd -lrti_me_netiosdmzd \
50+
-lrti_me_discdpdezd -lrti_me_ddsfilterzd -lrti_me_rhsmzd \
51+
-lrti_me_whsmzd -lrti_mezd -lrti_me_ddsxtypeszd $(SYSLIBS)
52+
else
53+
# This option strips the executable symbols
54+
LINKER_FLAGS += -s
55+
LIBS = -L$(RTIMEHOME)/lib/$(RTIMEARCH) \
56+
-lrti_me_cppz -lrti_me_netiosdmz \
57+
-lrti_me_discdpdez -lrti_me_ddsfilterz -lrti_me_rhsmz \
58+
-lrti_me_whsmz -lrti_mez -lrti_me_ddsxtypesz $(SYSLIBS)
59+
endif
60+
61+
DEFINES = -DRTI_UNIX -DRTI_LINUX -DRTI_CONNEXT_MICRO
62+
63+
INCLUDES = -I. -I$(RTIMEHOME)/include -I$(RTIMEHOME)/include/rti_me
64+
65+
OBJDIR := objs/$(RTIMEARCH)_micro
66+
67+
CDRSOURCES := shape_bounded.idl
68+
AUTOGENSOURCES := shape_boundedSupport.cxx shape_boundedPlugin.cxx shape_bounded.cxx
69+
70+
EXEC := $(executable_name)
71+
AUTOGENOBJS := $(addprefix $(OBJDIR)/, $(AUTOGENSOURCES:%.cxx=%.o))
72+
73+
$(OBJDIR)/$(EXEC) : $(AUTOGENSOURCES) $(AUTOGENOBJS) $(OBJDIR)/shape_main.o
74+
$(LINKER) $(LINKER_FLAGS) -o $@ $(OBJDIR)/shape_main.o $(AUTOGENOBJS) $(LIBS)
75+
76+
$(OBJDIR)/%.o : %.cxx
77+
$(COMPILER) $(COMPILER_FLAGS) -o $@ $(DEFINES) $(INCLUDES) -c $<
78+
79+
shape_main.cxx : shape_configurator_rti_connext_micro.h
80+
81+
# Generate type-specific sources
82+
$(AUTOGENSOURCES) : $(CDRSOURCES)
83+
$(RTIMEHOME)/rtiddsgen/scripts/rtiddsgen $(CDRSOURCES) -replace -micro -language C++
84+
85+
$(AUTOGENOBJS): | objs/$(RTIMEARCH)_micro
86+
87+
objs/$(RTIMEARCH)_micro:
88+
echo "Making directory objs/$(RTIMEARCH)_micro";
89+
mkdir -p objs/$(RTIMEARCH)_micro

0 commit comments

Comments
 (0)