aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2014-07-30 10:10:38 +0200
committerRaimo Niskanen <[email protected]>2014-07-30 10:31:26 +0200
commit010bbdacbab4d4bfff7a7c59968aa333f081e7c5 (patch)
tree80aff9af9b813755fcc7160b579a57b961ba9dfb /lib/snmp
parentfbc5e6a9a58e6d923442e260003e0c6d554749d0 (diff)
downloadotp-010bbdacbab4d4bfff7a7c59968aa333f081e7c5.tar.gz
otp-010bbdacbab4d4bfff7a7c59968aa333f081e7c5.tar.bz2
otp-010bbdacbab4d4bfff7a7c59968aa333f081e7c5.zip
Rearrange test suite group structure
Diffstat (limited to 'lib/snmp')
-rw-r--r--lib/snmp/test/snmp_to_snmpnet_SUITE.erl83
1 files changed, 36 insertions, 47 deletions
diff --git a/lib/snmp/test/snmp_to_snmpnet_SUITE.erl b/lib/snmp/test/snmp_to_snmpnet_SUITE.erl
index 69d54570ea..6e9c57bce9 100644
--- a/lib/snmp/test/snmp_to_snmpnet_SUITE.erl
+++ b/lib/snmp/test/snmp_to_snmpnet_SUITE.erl
@@ -50,7 +50,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[
{group, ipv4},
- {group, ipv6}
+ {group, ipv6},
+ {group, ipv4_ipv6}
].
groups() ->
@@ -60,16 +61,17 @@ groups() ->
]},
{ipv6, [],
[{group, get},
- {group, inform},
- {group, dual_ip}
+ {group, inform}
+ ]},
+ {ipv4_ipv6, [],
+ [{group, get},
+ {group, inform}
]},
+ %%
{get, [],
[erlang_agent_netsnmp_get]},
{inform, [],
- [erlang_agent_netsnmp_inform]},
- {dual_ip, [],
- [erlang_agent_netsnmp_get,
- erlang_agent_netsnmp_inform]}
+ [erlang_agent_netsnmp_inform]}
].
init_per_suite(Config) ->
@@ -78,40 +80,31 @@ init_per_suite(Config) ->
end_per_suite(_Config) ->
ok.
-init_per_group(ipv6, Config) ->
- case ct:require(ipv6_hosts) of
- ok ->
- init_per_group_ip([inet6], Config);
- _ ->
- {skip, "Host does not support IPV6"}
- end;
-%%
init_per_group(ipv4, Config) ->
init_per_group_ip([inet], Config);
-%%
-init_per_group(dual_ip, Config) ->
- case find_executables([snmpget, snmptrapd], Config) of
- NewConfig when is_list(NewConfig) ->
- case ct:require(ipv6_hosts) of
- ok ->
- init_per_group_ip([inet, inet6], NewConfig);
- _ ->
- {skip, "Host does not support IPV6"}
- end;
- Other ->
- Other
- end;
+init_per_group(ipv6, Config) ->
+ init_per_group_ipv6([inet6], Config);
+init_per_group(ipv4_ipv6, Config) ->
+ init_per_group_ipv6([inet, inet6], Config);
%%
init_per_group(get, Config) ->
%% From Ubuntu package snmp
- find_executables([snmpget], Config);
-%%
+ find_executable(snmpget, Config);
init_per_group(inform, Config) ->
- %% From Ubuntu package snmptrapfmt
- find_executables([snmptrapd], Config);
+ %% From Ubuntu package snmpd
+ find_executable(snmptrapd, Config);
+%%
init_per_group(_, Config) ->
Config.
+init_per_group_ipv6(Families, Config) ->
+ case ct:require(ipv6_hosts) of
+ ok ->
+ init_per_group_ip(Families, Config);
+ _ ->
+ {skip, "Host does not support IPV6"}
+ end.
+
init_per_group_ip(Families, Config) ->
Dir = ?config(priv_dir, Config),
AgentPort = ?config(agent_port, Config),
@@ -159,33 +152,29 @@ end_per_testcase(_, Config) ->
end,
Config.
-find_executables([], Config) ->
- Config;
-find_executables([Exec | Execs], Config) ->
+find_executable(Exec, Config) ->
ExecStr = atom_to_list(Exec),
case os:find_executable(ExecStr) of
false ->
- find_sys_executables(
- Execs, Config, Exec, ExecStr,
+ %% The sbin dirs are not in the PATH on all platforms...
+ find_sys_executable(
+ Exec, ExecStr,
[["usr", "local", "sbin"],
["usr", "sbin"],
- ["sbin"]]);
+ ["sbin"]],
+ Config);
Path ->
- find_executables(
- Execs,
- [{Exec, Path} | Config])
+ [{Exec, Path} | Config]
end.
-find_sys_executables(_Execs, _Config, _Exec, ExecStr, []) ->
+find_sys_executable(_Exec, ExecStr, [], _Config) ->
{skip, ExecStr ++ " not found"};
-find_sys_executables(Execs, Config, Exec, ExecStr, [Dir | Dirs]) ->
+find_sys_executable(Exec, ExecStr, [Dir | Dirs], Config) ->
case os:find_executable(filename:join(["/" | Dir] ++ [ExecStr])) of
false ->
- find_sys_executables(Execs, Config, Exec, ExecStr, Dirs);
+ find_sys_executable(Exec, ExecStr, Dirs, Config);
Path ->
- find_executables(
- Execs,
- [{Exec, Path} | Config])
+ [{Exec, Path} | Config]
end.
start_agent(Config) ->