File 7672-snmp-test-Handle-debian-analyzis.patch of Package erlang
From cdc58503b7456e1a354c6cb55b132522e42d5b67 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Tue, 25 Jan 2022 19:01:05 +0100
Subject: [PATCH 12/12] [snmp|test] Handle debian analyzis
Also fixed snmpEngineTime sanity check.
---
lib/snmp/test/snmp_agent_SUITE.erl | 2 +-
lib/snmp/test/snmp_test_lib.erl | 41 ++++++++++++++++++++++++------
2 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/lib/snmp/test/snmp_agent_SUITE.erl b/lib/snmp/test/snmp_agent_SUITE.erl
index 6db80e924e..3db90e4be5 100644
--- a/lib/snmp/test/snmp_agent_SUITE.erl
+++ b/lib/snmp/test/snmp_agent_SUITE.erl
@@ -5967,7 +5967,7 @@ snmp_framework_mib_test() ->
?WPRINT("Failed snmpEngineTime 1 sanity check: "
"~n Time to acquire ~w >= 1000", [T2-T1]),
?SKIP({acquire, snmpEngineTime, 1, T1, T2});
- ((T4 - T3) => 1000) ->
+ ((T4 - T3) >= 1000) ->
?WPRINT("Failed snmpEngineTime 2 sanity check: "
"~n Time to acquire ~w >= 1000", [T4-T3]),
?SKIP({acquire, snmpEngineTime, 2, T3, T4});
diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl
index 975bf52f39..95aab43deb 100644
--- a/lib/snmp/test/snmp_test_lib.erl
+++ b/lib/snmp/test/snmp_test_lib.erl
@@ -1047,6 +1047,8 @@ linux_which_distro(Version) ->
montavista;
"Yellow Dog" ++ _ ->
yellow_dog;
+ "Debian" ++ _ ->
+ debian;
_ ->
other
end,
@@ -1210,14 +1212,6 @@ bogomips_to_int(BM) ->
end
end.
-linux_cpuinfo_model() ->
- case linux_cpuinfo_lookup("model") of
- [M|_] ->
- M;
- _X ->
- "-"
- end.
-
linux_cpuinfo_platform() ->
case linux_cpuinfo_lookup("platform") of
[P] ->
@@ -1226,6 +1220,14 @@ linux_cpuinfo_platform() ->
"-"
end.
+linux_cpuinfo_model() ->
+ case linux_cpuinfo_lookup("model") of
+ [M|_] ->
+ M;
+ _X ->
+ "-"
+ end.
+
linux_cpuinfo_model_name() ->
case linux_cpuinfo_lookup("model name") of
[M|_] ->
@@ -1311,6 +1313,29 @@ linux_which_cpuinfo(wind_river) ->
{ok, {CPU, BMips}}
end;
+%% Check for x86 (Intel, AMD, Raspberry (ARM))
+linux_which_cpuinfo(debian) ->
+ CPU =
+ case linux_cpuinfo_model() of
+ "-" ->
+ %% ARM (at least some distros...)
+ case linux_cpuinfo_processor() of
+ "-" ->
+ %% Ok, we give up
+ throw(noinfo);
+ Proc ->
+ Proc
+ end;
+ ModelName ->
+ ModelName
+ end,
+ case linux_cpuinfo_bogomips() of
+ "-" ->
+ {ok, CPU};
+ BMips ->
+ {ok, {CPU, BMips}}
+ end;
+
%% Check for x86 (Intel or AMD)
linux_which_cpuinfo(other) ->
CPU =
--
2.34.1