From d7c6e2781c64e5e75add8a89d1b553bd5e9283f1 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 18 Feb 2011 19:18:12 +0100 Subject: Lost of fixes... *) Update release notes (with regard to module_compliance) *) New compiler options: agent_capabilities and module_compliance *) Update mib compiler option description (new options for agent_capabilities and module_compliance) *) New test case for module_compliance. *) Added test mib for module_complianc test case. *) Added some options for the MIB makefile. ... --- lib/snmp/test/snmp_compiler_test.erl | 77 ++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 7 deletions(-) (limited to 'lib/snmp/test/snmp_compiler_test.erl') diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl index 09fc417af4..592b3efee2 100644 --- a/lib/snmp/test/snmp_compiler_test.erl +++ b/lib/snmp/test/snmp_compiler_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -45,6 +45,7 @@ imports/1, module_identity/1, agent_capabilities/1, + module_compliance/1, tickets/1, otp_6150/1, @@ -98,6 +99,7 @@ all(suite) -> imports, module_identity, agent_capabilities, + module_compliance, tickets ]. @@ -183,12 +185,73 @@ agent_capabilities(Config) when is_list(Config) -> OtpMibsMibsDir = join(OtpMibsPrivDir, "mibs"), Dir = ?config(mib_dir, Config), AcMib = join(Dir,"AC-TEST-MIB.mib"), - ?line {ok, Mib} = snmpc:compile(AcMib, [options, - version, - {i, [SnmpMibsDir, OtpMibsMibsDir]}, - {outdir, Dir}, - {verbosity, trace}]), - io:format("agent_capabilities -> Mib: ~n~p~n", [Mib]), + ?line {ok, MibFile1} = snmpc:compile(AcMib, [options, + version, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib1} = snmp_misc:read_mib(MibFile1), + ?line {ok, MibFile2} = snmpc:compile(AcMib, [options, + version, + agent_capabilities, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib2} = snmp_misc:read_mib(MibFile2), + MEDiff = Mib2#mib.mes -- Mib1#mib.mes, + %% This is a rather pathetic test, but it is somthing... + io:format("agent_capabilities -> " + "~n MEDiff: ~p" + "~n Mib1: ~p" + "~n Mib2: ~p" + "~n", [MEDiff, Mib1, Mib2]), + case length(MEDiff) of + 2 -> + ok; + _BadLen -> + exit({unexpected_mes, MEDiff}) + end, + ok. + + +module_compliance(suite) -> + []; +module_compliance(Config) when is_list(Config) -> + put(tname,module_compliance), + p("starting with Config: ~p~n", [Config]), + + SnmpPrivDir = code:priv_dir(snmp), + SnmpMibsDir = join(SnmpPrivDir, "mibs"), + OtpMibsPrivDir = code:priv_dir(otp_mibs), + OtpMibsMibsDir = join(OtpMibsPrivDir, "mibs"), + Dir = ?config(mib_dir, Config), + AcMib = join(Dir,"MC-TEST-MIB.mib"), + ?line {ok, MibFile1} = snmpc:compile(AcMib, [options, + version, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib1} = snmp_misc:read_mib(MibFile1), + ?line {ok, MibFile2} = snmpc:compile(AcMib, [options, + version, + module_compliance, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib2} = snmp_misc:read_mib(MibFile2), + MEDiff = Mib2#mib.mes -- Mib1#mib.mes, + %% This is a rather pathetic test, but it is somthing... + io:format("agent_capabilities -> " + "~n MEDiff: ~p" + "~n Mib1: ~p" + "~n Mib2: ~p" + "~n", [MEDiff, Mib1, Mib2]), + case length(MEDiff) of + 1 -> + ok; + _BadLen -> + exit({unexpected_mes, MEDiff}) + end, ok. -- cgit v1.2.3