File 0862-Add-more-testcases-for-PATHs.patch of Package erlang

From 71e9483dcc11b08f958c064673522264cfd6f2dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?=
 <eric.meadows.jonsson@gmail.com>
Date: Thu, 23 Jan 2025 15:59:57 +0100
Subject: [PATCH 2/6] Add more testcases for PATHs

Co-authored-by: Rin Kuryloski <rin.kuryloski@mechanical-orchard.com>
Co-authored-by: Bella Bai <bella.bai@mechanical-orchard.com>
---
 erts/test/erlexec_SUITE.erl | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/erts/test/erlexec_SUITE.erl b/erts/test/erlexec_SUITE.erl
index 18ec4e2d37..0c9933cb7b 100644
--- a/erts/test/erlexec_SUITE.erl
+++ b/erts/test/erlexec_SUITE.erl
@@ -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.
 
 
-- 
2.43.0

openSUSE Build Service is sponsored by