File 0441-snmp-test-Fixed-inet-backend-testing.patch of Package erlang
From b6a9beeec933bbc29f668c8ffc20ee86f22ea686 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Tue, 12 Nov 2024 09:11:21 +0100
Subject: [PATCH 1/7] [snmp|test] Fixed inet-backend testing
---
lib/snmp/test/snmp_test_lib.erl | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl
index 6e354d5510..1bf63dd91e 100644
--- a/lib/snmp/test/snmp_test_lib.erl
+++ b/lib/snmp/test/snmp_test_lib.erl
@@ -279,20 +279,24 @@ explicit_inet_backend() ->
false
end.
+%% We cannot use application:get_all_env(snmp) since that only "works"
+%% when the application has been started and this function may be called
+%% well before that happens.
test_inet_backends() ->
- case application:get_all_env(snmp) of
- Env when is_list(Env) ->
- case lists:keysearch(test_inet_backends, 1, Env) of
- {value, {test_inet_backends, true}} ->
- true;
- _ ->
- false
- end;
+ case init:get_argument(snmp) of
+ {ok, Args} when is_list(Args) ->
+ test_inet_backends(Args);
_ ->
- false
+ false
end.
-
+test_inet_backends([]) ->
+ false;
+test_inet_backends([["test_inet_backends","true"]|_]) ->
+ true;
+test_inet_backends([_|Args]) ->
+ test_inet_backends(Args).
+
proxy_call(F, Timeout, Default) ->
proxy_call(F, Timeout, infinity, Default).
--
2.43.0