Skip to content

Commit bbdbbe0

Browse files
committed
Updated Test_Cft_1 to handle EOF
1 parent 23a4c05 commit bbdbbe0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test_suite_functions.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,31 +313,35 @@ def test_size_less_than_20(child_sub, samples_sent, last_sample_saved, timeout):
313313
import re
314314
from rtps_test_utilities import ReturnCode
315315

316-
max_samples_received = 500
316+
max_samples_received = MAX_SAMPLES_READ / 2
317317
samples_read = 0
318+
return_code = ReturnCode.OK
318319

319320
sub_string = re.search('[0-9]+ [0-9]+ \[([0-9]+)\]', child_sub.before + child_sub.after)
320321

321322
while sub_string is not None and samples_read < max_samples_received:
322323
size = int(sub_string.group(1))
323324
if size < 1 or size > 20:
324-
return ReturnCode.DATA_NOT_CORRECT
325+
return_code = ReturnCode.DATA_NOT_CORRECT
326+
break
325327

326328
index = child_sub.expect(
327329
[
328330
'\[[0-9]+\]', # index = 0
329-
pexpect.TIMEOUT # index = 1
331+
pexpect.TIMEOUT, # index = 1
332+
pexpect.EOF # index = 2
330333
],
331334
timeout
332335
)
333-
if index == 1:
336+
if index == 1 or index == 2:
337+
return_code = ReturnCode.DATA_NOT_RECEIVED
334338
break
335339

336340
samples_read += 1
337341
sub_string = re.search('[0-9]+ [0-9]+ \[([0-9]+)\]', child_sub.before + child_sub.after)
338342

339343
print(f'Samples read: {samples_read}')
340-
return ReturnCode.OK
344+
return return_code
341345

342346

343347
def test_reliability_order(child_sub, samples_sent, last_sample_saved, timeout):

0 commit comments

Comments
 (0)