Skip to content

Commit

Permalink
ct: Fix fetching of old release versions
Browse files Browse the repository at this point in the history
We should ignore any erlang release that is a source Erlang release
as they cannot be used in various upgrade/downgrade tests.
  • Loading branch information
garazdawi authored and frazze-jobb committed Sep 21, 2022
1 parent ee2393a commit 212cb7c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
23 changes: 15 additions & 8 deletions lib/common_test/src/test_server_node.erl
Expand Up @@ -471,7 +471,7 @@ find_release(Rel) ->
none ->
case string:take(Rel,"_",true) of
{Rel,[]} ->
false;
none;
{RelNum,_} ->
find_release_path(RelNum)
end;
Expand All @@ -486,17 +486,24 @@ find_release_path(Rel) ->
Paths = string:lexemes(os:getenv("PATH"), ":"),
find_release_path(Paths, Rel).
find_release_path([Path|T], Rel) ->
CurrErl = os:find_executable("erl"),
case os:find_executable("erl", Path) of
false ->
find_release_path(T, Rel);
CurrErl -> find_release_path(T, Rel);
ErlExec ->
Release = os:cmd(ErlExec ++ " -noinput -eval 'io:format(\"~ts\", [erlang:system_info(otp_release)])' -s init stop"),
case Release =:= Rel of
true -> ErlExec;
false -> find_release_path(T, Rel)
end
QuotedExec = "\""++ErlExec++"\"",
Release = os:cmd(QuotedExec ++ " -noinput -eval 'io:format(\"~ts\", [erlang:system_info(otp_release)])' -s init stop"),
case Release =:= Rel of
true ->
%% Check is the release is a source tree release,
%% if so we should not use it.
case os:cmd(QuotedExec ++ " -noinput -eval 'io:format(\"~p\",[filelib:is_file(filename:join([code:root_dir(),\"OTP_VERSION\"]))]).' -s init stop") of
"true" ->
find_release_path(T, Rel);
"false" ->
ErlExec
end;
false -> find_release_path(T, Rel)
end
end;
find_release_path([], _) ->
none.
Expand Down
3 changes: 2 additions & 1 deletion lib/kernel/test/interactive_shell_SUITE.erl
Expand Up @@ -921,7 +921,8 @@ external_editor(Config) ->
send_tty(Term, "some text with\nnewline in it"),
check_content(Term,"3> some text with\\s*\n.+3>\\s*newline in it"),
send_tty(Term, "C-O"),
check_content(Term,"GNU nano [\\d.]+.+\nnewline in it"),
check_content(Term,"GNU nano [\\d.]+"),
check_content(Term,"newline in it"),
send_tty(Term, "still"),
send_tty(Term, "Enter"),
send_tty(Term, "C-O"), %% save in nano
Expand Down
2 changes: 1 addition & 1 deletion lib/kernel/test/rtnode.erl
Expand Up @@ -226,7 +226,7 @@ get_progs(Opts) ->
undefined -> {RunErl, ToErl, Erl};
Release ->
case test_server_node:find_release(Release) of
false -> {error, "Could not find release "++Release};
none -> {error, "Could not find release "++Release};
R -> {RunErl, ToErl, [R]}
end
end;
Expand Down
9 changes: 5 additions & 4 deletions lib/stdlib/test/edlin_expand_SUITE.erl
Expand Up @@ -157,9 +157,9 @@ filename_completion(Config) ->
{yes,"/", [{"../",_}]} = do_expand("\".."),
{yes,"ta/", _} = do_expand("\"../edlin_expand_SUITE_da"),
{yes,"erl\"",[{"complete_function_parameter.erl",_}]} = do_expand("\"complete_function_parameter."),
case os:type() of
R = case os:type() of
{win32,_} -> {skip, "Unicode on filenames in windows are tricky"};
{win64,_} -> {skip, "Unicode on filenames in windows are tricky"};
{_,latin1} -> {skip, "Cannot interpret unicode filenames when native_name_encoding is latin1"};
_ ->
{yes,"isible",
[{"visible file",_},{"visible_file",_},{"visible😀_file",_}]} = do_expand("\"v"),
Expand All @@ -169,10 +169,11 @@ filename_completion(Config) ->
[{"../",[]},
{".hidden file",_},
{".hidden_file",_},
{".hidden😀_file",_}]} = do_expand("\".")
{".hidden😀_file",_}]} = do_expand("\"."),
ok
end,
file:set_cwd(CWD),
ok.
R.

record_completion(_Config) ->
%% test record completion for loaded records
Expand Down

0 comments on commit 212cb7c

Please sign in to comment.