Skip to content

Commit

Permalink
Add more testcases for PATHs
Browse files Browse the repository at this point in the history
Co-authored-by: Rin Kuryloski <[email protected]>
Co-authored-by: Bella Bai <[email protected]>
  • Loading branch information
3 people committed Jan 23, 2025
1 parent c4257e7 commit 52cd2da
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions erts/test/erlexec_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,24 @@ zdbbl_dist_buf_busy_limit(Config) when is_list(Config) ->

long_path_env(Config) when is_list(Config) ->
OriginalPath = os:getenv("PATH"),
[BinPath, _RestPath] = string:split(OriginalPath, ":"),
[BinPath, RestPath] = string:split(OriginalPath, ":"),
LongPath = lists:duplicate(10240, "x"),
TestPath = OriginalPath ++ ":" ++ LongPath ++ ":" ++ BinPath,
AssertPath = OriginalPath ++ ":" ++ LongPath,
os:putenv("PATH", TestPath),

ExpectedPath = OriginalPath ++ ":" ++ LongPath,
{ok, [[PName]]} = init:get_argument(progname),
Cmd = PName ++ " -noshell -eval 'io:format(\"~ts\", [os:getenv(\"PATH\")]),erlang:halt()'",
Output = os:cmd(Cmd),

true = string:equal(AssertPath, Output),
os:putenv("PATH", OriginalPath ++ ":" ++ LongPath ++ ":" ++ BinPath),
Output1 = os:cmd(Cmd),
true = string:equal(ExpectedPath, Output1),

os:putenv("PATH", ExpectedPath),
Output2 = os:cmd(Cmd),
true = string:equal(ExpectedPath, Output2),

os:putenv("PATH", RestPath ++ ":" ++ LongPath),
Output3 = os:cmd(Cmd),
true = string:equal(ExpectedPath, Output3),

ok.


Expand Down

0 comments on commit 52cd2da

Please sign in to comment.