aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-04-11 17:38:39 +0200
committerFredrik Gustafsson <[email protected]>2013-04-11 17:38:39 +0200
commit8bb22100b1b12eca0f6953cac031c8f780988c16 (patch)
tree986e23dbdd906b341f67fff8e2171e20a34f404c /lib/common_test/src
parentd0b33917556c2af58993c277f255c4824648fd7f (diff)
parent2b6fe7c6ec79e43f906706ee169435c613b1b009 (diff)
downloadotp-8bb22100b1b12eca0f6953cac031c8f780988c16.tar.gz
otp-8bb22100b1b12eca0f6953cac031c8f780988c16.tar.bz2
otp-8bb22100b1b12eca0f6953cac031c8f780988c16.zip
Merge branch 'maint'
Diffstat (limited to 'lib/common_test/src')
-rw-r--r--lib/common_test/src/ct_telnet.erl39
1 files changed, 29 insertions, 10 deletions
diff --git a/lib/common_test/src/ct_telnet.erl b/lib/common_test/src/ct_telnet.erl
index 02186864a5..beb3c1d649 100644
--- a/lib/common_test/src/ct_telnet.erl
+++ b/lib/common_test/src/ct_telnet.erl
@@ -728,7 +728,8 @@ teln_get_all_data(Pid,Prx,Data,Acc,LastLine) ->
haltpatterns=[],
seq=false,
repeat=false,
- found_prompt=false}).
+ found_prompt=false,
+ wait_for_linebreak=true}).
%% @hidden
%% @doc Externally the silent_teln_expect function shall only be used
@@ -754,20 +755,25 @@ silent_teln_expect(Pid,Data,Pattern,Prx,Opts) ->
%% condition is fullfilled.
%% 3b) Repeat (sequence): 2) is repeated either N times or until a
%% halt condition is fullfilled.
-teln_expect(Pid,Data,Pattern0,Prx,Opts) -> HaltPatterns = case
- get_ignore_prompt(Opts) of true -> get_haltpatterns(Opts); false
- -> [prompt | get_haltpatterns(Opts)] end,
-
+teln_expect(Pid,Data,Pattern0,Prx,Opts) ->
+ HaltPatterns = case get_ignore_prompt(Opts) of
+ true ->
+ get_haltpatterns(Opts);
+ false ->
+ [prompt | get_haltpatterns(Opts)]
+ end,
+ WaitForLineBreak = get_line_break_opt(Opts),
Seq = get_seq(Opts),
Pattern = convert_pattern(Pattern0,Seq),
-
+
Timeout = get_timeout(Opts),
-
+
EO = #eo{teln_pid=Pid,
prx=Prx,
timeout=Timeout,
seq=Seq,
- haltpatterns=HaltPatterns},
+ haltpatterns=HaltPatterns,
+ wait_for_linebreak=WaitForLineBreak},
case get_repeat(Opts) of
false ->
@@ -808,6 +814,11 @@ get_timeout(Opts) ->
{value,{timeout,T}} -> T;
false -> ?DEFAULT_TIMEOUT
end.
+get_line_break_opt(Opts) ->
+ case lists:keysearch(wait_for_linebreak,1,Opts) of
+ {value,{wait_for_linebreak,false}} -> false;
+ _ -> true
+ end.
get_repeat(Opts) ->
case lists:keysearch(repeat,1,Opts) of
{value,{repeat,N}} when is_integer(N) ->
@@ -1004,8 +1015,9 @@ seq_expect1(Data,[],Acc,Rest,_EO) ->
%% Split prompt-chunk at lines
match_lines(Data,Patterns,EO) ->
FoundPrompt = EO#eo.found_prompt,
+ NeedLineBreak = EO#eo.wait_for_linebreak,
case one_line(Data,[]) of
- {noline,Rest} when FoundPrompt=/=false ->
+ {noline,Rest} when FoundPrompt=/=false, NeedLineBreak =:= true ->
%% This is the line including the prompt
case match_line(Rest,Patterns,FoundPrompt,EO) of
nomatch ->
@@ -1013,7 +1025,14 @@ match_lines(Data,Patterns,EO) ->
{Tag,Match} ->
{Tag,Match,[]}
end;
- {noline,Rest} ->
+ {noline,Rest} when NeedLineBreak =:= false ->
+ case match_line(Rest,Patterns,FoundPrompt,EO) of
+ nomatch ->
+ {nomatch,prompt};
+ {Tag,Match} ->
+ {Tag,Match,[]}
+ end;
+ {noline, Rest} ->
{nomatch,Rest};
{Line,Rest} ->
case match_line(Line,Patterns,false,EO) of