From 46e5b36b2a2fd70fef26ee0ad7e08a3c7c2fd7fd Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Fri, 25 Aug 2017 16:50:07 +0200 Subject: ct: use 'unicode' option for regexps --- lib/common_test/src/ct.erl | 3 ++- lib/common_test/src/ct_telnet.erl | 6 +++--- lib/common_test/src/ct_testspec.erl | 4 ++-- lib/common_test/src/test_server_node.erl | 2 +- lib/common_test/src/test_server_sup.erl | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/common_test/src/ct.erl b/lib/common_test/src/ct.erl index 19b0ee20fe..a12c0c9101 100644 --- a/lib/common_test/src/ct.erl +++ b/lib/common_test/src/ct.erl @@ -848,7 +848,8 @@ capture_get([ExclCat | ExclCategories]) -> Strs = test_server:capture_get(), CatsStr = [atom_to_list(ExclCat) | [[$| | atom_to_list(EC)] || EC <- ExclCategories]], - {ok,MP} = re:compile("
.*"), + {ok,MP} = re:compile("
.*", + [unicode]), lists:flatmap(fun(Str) -> case re:run(Str, MP) of {match,_} -> []; diff --git a/lib/common_test/src/ct_telnet.erl b/lib/common_test/src/ct_telnet.erl index 14d9d381da..b50cddd492 100644 --- a/lib/common_test/src/ct_telnet.erl +++ b/lib/common_test/src/ct_telnet.erl @@ -1455,7 +1455,7 @@ match_line(Name,Pid,Line,[{prompt,PromptType}|Patterns],FoundPrompt,Term, when PromptType=/=FoundPrompt -> match_line(Name,Pid,Line,Patterns,FoundPrompt,Term,EO,RetTag); match_line(Name,Pid,Line,[{Tag,Pattern}|Patterns],FoundPrompt,Term,EO,RetTag) -> - case re:run(Line,Pattern,[{capture,all,list}]) of + case re:run(Line,Pattern,[{capture,all,list},unicode]) of nomatch -> match_line(Name,Pid,Line,Patterns,FoundPrompt,Term,EO,RetTag); {match,Match} -> @@ -1463,7 +1463,7 @@ match_line(Name,Pid,Line,[{Tag,Pattern}|Patterns],FoundPrompt,Term,EO,RetTag) -> {RetTag,{Tag,Match}} end; match_line(Name,Pid,Line,[Pattern|Patterns],FoundPrompt,Term,EO,RetTag) -> - case re:run(Line,Pattern,[{capture,all,list}]) of + case re:run(Line,Pattern,[{capture,all,list},unicode]) of nomatch -> match_line(Name,Pid,Line,Patterns,FoundPrompt,Term,EO,RetTag); {match,Match} -> @@ -1575,7 +1575,7 @@ split_lines([],Line,Lines) -> match_prompt(Str,Prx) -> match_prompt(Str,Prx,[]). match_prompt(Str,Prx,Acc) -> - case re:run(Str,Prx) of + case re:run(Str,Prx,[unicode]) of nomatch -> noprompt; {match,[{Start,Len}]} -> diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl index 09839bd35d..bb445bb0d2 100644 --- a/lib/common_test/src/ct_testspec.erl +++ b/lib/common_test/src/ct_testspec.erl @@ -537,7 +537,7 @@ replace_names_in_elems([],Modified,_Defs) -> replace_names_in_string(Term,Defs=[{Name,Replacement=[Ch|_]}|Ds]) when is_integer(Ch) -> try re:replace(Term,[$'|atom_to_list(Name)]++"'", - Replacement,[{return,list}]) of + Replacement,[{return,list},unicode]) of Term -> % no match, proceed replace_names_in_string(Term,Ds); Term1 -> @@ -569,7 +569,7 @@ replace_names_in_node1(NodeStr,Defs=[{Name,Replacement}|Ds]) -> replace_names_in_node1(NodeStr,Ds); true -> case re:replace(NodeStr,atom_to_list(Name), - ReplStr,[{return,list}]) of + ReplStr,[{return,list},unicode]) of NodeStr -> % no match, proceed replace_names_in_node1(NodeStr,Ds); NodeStr1 -> diff --git a/lib/common_test/src/test_server_node.erl b/lib/common_test/src/test_server_node.erl index a18ff1fd62..c0d7e12721 100644 --- a/lib/common_test/src/test_server_node.erl +++ b/lib/common_test/src/test_server_node.erl @@ -692,7 +692,7 @@ find_rel_suse_2(Rel, RootWc) -> case file:list_dir(RelDir) of {ok,Dirs} -> case lists:filter(fun(Dir) -> - case re:run(Dir, Pat) of + case re:run(Dir, Pat, [unicode]) of nomatch -> false; _ -> true end diff --git a/lib/common_test/src/test_server_sup.erl b/lib/common_test/src/test_server_sup.erl index 9a26de4774..21f4be22fe 100644 --- a/lib/common_test/src/test_server_sup.erl +++ b/lib/common_test/src/test_server_sup.erl @@ -346,7 +346,7 @@ check_appup_clauses_plausible([], _Direction, _Modules) -> ok; check_appup_clauses_plausible([{Re, Instrs} | Rest], Direction, Modules) when is_binary(Re) -> - case re:compile(Re) of + case re:compile(Re,[unicode]) of {ok, _} -> case check_appup_instructions(Instrs, Direction, Modules) of ok -> -- cgit v1.2.3