~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to lib/snmp/test/snmp_manager_config_test.erl

  • Committer: Elliot Murphy
  • Date: 2010-06-08 03:55:44 UTC
  • mfrom: (3.5.6 squeeze)
  • Revision ID: elliot@elliotmurphy.com-20100608035544-dd8zh2swk7jr5rz2
* Merge with Debian unstable; remaining Ubuntu changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to. (LP #438365)
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
* Added missing symlinks to /usr/include for a few new header files.
* Fixed generation of ${erlang-base:Depends} and ${erlang-x11:Depends}
  substitution variables.
* Added a fix for a re:compile/2 crash on a long regular expression.
* Changed urgency to medium as the change fixes a security bug.
* Manpages in section 1 are needed even if only arch-dependent packages are
  built. So, re-enabled them.
* Fixed HiPE architecture recognition for powerpc Debian architecture.
* Moved xsltproc and fop to build-depends-indep and do not build
  documentation if only architecture-specific packages are built.
* Refreshed all patches.
* Made Emacs look in man5 and man7 for Erlang manpages and added code
  skeleton files to erlang-mode package.
* New upstream release.
* Moved manpages from incorrect sections 4 and 6 to correct 5 and 7
  (closes: #498492).
* Made manpages regexp in Emacs mode match only 3erl pages in section 3.
* Removed docb_gen script which is no longer needed to build manpages.
* Added erlang-doc package which contains documentation in HTML and PDF
  formats. This package replaces erlang-doc-html package and it's easier
  to synchronize it with the main Erlang packages as it's built from
  a single source package (closes: #558451).
* Removed RPATH from ssl and crypto application binaries as required by
  Debian policy.
* Added libwxgtk2.4-dev and libwxgtk2.6-dev to build conflicts.
* Added a few dpendencies for erlang-dialyzer, erlang-et, erlang-observer
  and erlang-examples packages which now call functions from more modules
  than in 1:13.b.3.
* Added a workaround which disables vfork() for hppa architecture
  (closes: #562218).
* Strictened check for JDK 1.5 adding a call to String(int[], int, int)
  because GCJ 4.4 doesn't implement it and OpenJDK isn't available for all
  architectures.
* Fixed erlang-manpages package section.
* Made erlang-depends add only substvars which are requested in
  debian/control file. This minimizes number of warnings from dh_gencontrol.
  Also, improved descriptions of the functions in erlang-depends escript.
* Added erlang-erl-docgen package to erlang-nox dependencies.
* Made dummy packages erlang-nox and erlang-x11 architecture all.
* Cleaned up working with custom substitution variables in debian/rules.
* Reorganized debian/rules to ensure that manpages arent built twice, and
  aren't built at all if only architecture-dependent packages are requested.
* Fixed project links in README.Debian.
* Added a new package erlang-jinterface which provides tools for
  communication of Java programs with Erlang processes. This adds build
  depandency on default-jdk and as a result enables Java module for IDL
  compiler.
* Bumped standards version to 3.8.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%% 
2
2
%% %CopyrightBegin%
3
 
%% 
4
 
%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
5
 
%% 
 
3
%%
 
4
%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
 
5
%%
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
9
9
%% Erlang Public License along with this software. If not, it can be
10
10
%% retrieved online at http://www.erlang.org/.
11
 
%% 
 
11
%%
12
12
%% Software distributed under the License is distributed on an "AS IS"
13
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
%% the License for the specific language governing rights and limitations
15
15
%% under the License.
16
 
%% 
 
16
%%
17
17
%% %CopyrightEnd%
18
18
%% 
19
19
 
86
86
         stats_create_and_increment/1,
87
87
 
88
88
         tickets/1,
89
 
         otp_7219/1
 
89
         otp_7219/1, 
 
90
         otp_8395/1, 
 
91
         otp_8395_1/1, 
 
92
         otp_8395_2/1, 
 
93
         otp_8395_3/1, 
 
94
         otp_8395_4/1
90
95
 
91
96
        ]).
92
97
 
2295
2300
 
2296
2301
tickets(suite) ->
2297
2302
    [
2298
 
     otp_7219
 
2303
     otp_7219, 
 
2304
     otp_8395
2299
2305
    ].
2300
2306
 
2301
2307
 
2347
2353
    ok.
2348
2354
 
2349
2355
 
 
2356
 
 
2357
otp_8395(suite) ->
 
2358
    [
 
2359
     otp_8395_1, 
 
2360
     otp_8395_2, 
 
2361
     otp_8395_3, 
 
2362
     otp_8395_4 
 
2363
    ].
 
2364
 
 
2365
otp_8395_1(suite) -> [];
 
2366
otp_8395_1(doc) ->
 
2367
    "OTP-8395(1)";
 
2368
otp_8395_1(Conf) when is_list(Conf) ->
 
2369
    put(tname, otp_8395_1),
 
2370
    p("start"),
 
2371
    process_flag(trap_exit, true),
 
2372
    otp8395(Conf, false, ok),
 
2373
    ok.
 
2374
 
 
2375
otp_8395_2(suite) -> [];
 
2376
otp_8395_2(doc) ->
 
2377
    "OTP-8395(2)";
 
2378
otp_8395_2(Conf) when is_list(Conf) ->
 
2379
    put(tname, otp_8395_2),
 
2380
    p("start"),
 
2381
    process_flag(trap_exit, true),
 
2382
    otp8395(Conf, true, ok),
 
2383
    ok.
 
2384
 
 
2385
otp_8395_3(suite) -> [];
 
2386
otp_8395_3(doc) ->
 
2387
    "OTP-8395(3)";
 
2388
otp_8395_3(Conf) when is_list(Conf) ->
 
2389
    put(tname, otp_8395_3),
 
2390
    p("start"),
 
2391
    process_flag(trap_exit, true),
 
2392
    otp8395(Conf, gurka, error),
 
2393
    ok.
 
2394
 
 
2395
otp8395(Conf, SeqNoVal, Expect) ->
 
2396
    ConfDir   = ?config(manager_conf_dir, Conf),
 
2397
    DbDir     = ?config(manager_db_dir, Conf),
 
2398
    LogDir    = ?config(manager_log_dir, Conf),
 
2399
    StdMibDir = filename:join(code:priv_dir(snmp), "mibs") ++ "/",
 
2400
    
 
2401
    write_manager_conf(ConfDir),
 
2402
    
 
2403
    %% Third set of options (no versions):
 
2404
    p("all options"),
 
2405
    NetIfOpts  = [{module,    snmpm_net_if}, 
 
2406
                  {verbosity, trace},
 
2407
                  {options,   [{recbuf,   30000},
 
2408
                               {bind_to,  false},
 
2409
                               {no_reuse, false}]}],
 
2410
    ServerOpts = [{timeout, 10000}, {verbosity, trace}],
 
2411
    NoteStoreOpts = [{timeout, 20000}, {verbosity, trace}],
 
2412
    ConfigOpts = [{dir, ConfDir}, {verbosity, trace}, {db_dir, DbDir}],
 
2413
    Mibs = [join(StdMibDir, "SNMP-NOTIFICATION-MIB"),
 
2414
            join(StdMibDir, "SNMP-USER-BASED-SM-MIB")],
 
2415
    Prio = normal,
 
2416
    ATL  = [{type,   read_write}, 
 
2417
            {dir,    LogDir}, 
 
2418
            {size,   {10,10240}},
 
2419
            {repair, true},
 
2420
            {seqno,  SeqNoVal}],
 
2421
    Vsns = [v1,v2,v3],
 
2422
    Opts = [{config,          ConfigOpts},
 
2423
            {net_if,          NetIfOpts},
 
2424
            {server,          ServerOpts},
 
2425
            {note_store,      NoteStoreOpts},
 
2426
            {audit_trail_log, ATL},
 
2427
            {priority,        Prio}, 
 
2428
            {mibs,            Mibs},
 
2429
            {versions,        Vsns}],
 
2430
    
 
2431
    case config_start(Opts) of
 
2432
        {ok, _Pid} when (Expect =:= ok) ->
 
2433
            ?line ok = config_stop(),
 
2434
            ok;
 
2435
        {ok, _Pid} when (Expect =/= ok) ->
 
2436
            config_stop(),
 
2437
            exit({unexpected_started_config, SeqNoVal});
 
2438
        _Error when (Expect =/= ok) ->
 
2439
            ok; 
 
2440
        Error when (Expect =:= ok) ->
 
2441
            exit({unexpected_failed_starting_config, SeqNoVal, Error})
 
2442
    end,
 
2443
    p("done"),
 
2444
    ok.
 
2445
 
 
2446
 
 
2447
otp_8395_4(suite) -> [];
 
2448
otp_8395_4(doc) ->
 
2449
    "OTP-8395(4)";
 
2450
otp_8395_4(Conf) when is_list(Conf) ->
 
2451
    put(tname, otp_8395_4),
 
2452
    p("start"),
 
2453
    process_flag(trap_exit, true),
 
2454
 
 
2455
    snmp:print_version_info(),
 
2456
 
 
2457
    ConfDir   = ?config(manager_conf_dir, Conf),
 
2458
    DbDir     = ?config(manager_db_dir, Conf),
 
2459
    LogDir    = ?config(manager_log_dir, Conf),
 
2460
    StdMibDir = filename:join(code:priv_dir(snmp), "mibs") ++ "/",
 
2461
    
 
2462
    write_manager_conf(ConfDir),
 
2463
    
 
2464
    %% Third set of options (no versions):
 
2465
    p("all options"),
 
2466
    NetIfOpts  = [{module,    snmpm_net_if}, 
 
2467
                  {verbosity, trace},
 
2468
                  {options,   [{recbuf,   30000},
 
2469
                               {bind_to,  false},
 
2470
                               {no_reuse, false}]}],
 
2471
    ServerOpts = [{timeout, 10000}, {verbosity, trace}],
 
2472
    NoteStoreOpts = [{timeout, 20000}, {verbosity, trace}],
 
2473
    ConfigOpts = [{dir, ConfDir}, {verbosity, trace}, {db_dir, DbDir}],
 
2474
    Mibs = [join(StdMibDir, "SNMP-NOTIFICATION-MIB"),
 
2475
            join(StdMibDir, "SNMP-USER-BASED-SM-MIB")],
 
2476
    Prio = normal,
 
2477
    ATL  = [{type,   read_write}, 
 
2478
            {dir,    LogDir}, 
 
2479
            {size,   {10,10240}},
 
2480
            {repair, true},
 
2481
            {seqno,  true}],
 
2482
    Vsns = [v1,v2,v3],
 
2483
    Opts = [{config,          ConfigOpts},
 
2484
            {net_if,          NetIfOpts},
 
2485
            {server,          ServerOpts},
 
2486
            {note_store,      NoteStoreOpts},
 
2487
            {audit_trail_log, ATL},
 
2488
            {priority,        Prio}, 
 
2489
            {mibs,            Mibs},
 
2490
            {versions,        Vsns}],
 
2491
    
 
2492
    ?line {ok, _Pid} = config_start(Opts),
 
2493
    
 
2494
    Counter   = otp_8395_4, 
 
2495
    Initial   = 10,
 
2496
    Increment = 2, 
 
2497
    Max       = 20,
 
2498
    
 
2499
    %% At this call the counter does *not* exist. The call creates
 
2500
    %% it with the initial value!
 
2501
 
 
2502
    Val1 = Initial, 
 
2503
    Val1 = otp8395_incr_counter(Counter, Initial, Increment, Max),
 
2504
 
 
2505
    %% Now it exist, make sure another call does the expected increment
 
2506
    
 
2507
    Val2 = Initial + Increment, 
 
2508
    Val2 = otp8395_incr_counter(Counter, Initial, Increment, Max),
 
2509
 
 
2510
    ?line ok = config_stop(),
 
2511
 
 
2512
    p("done"),
 
2513
    ok.
 
2514
    
 
2515
 
 
2516
otp8395_incr_counter(Counter, Initial, Increment, Max) ->
 
2517
    snmpm_config:increment_counter(Counter, Initial, Increment, Max).
 
2518
 
 
2519
 
2350
2520
%%======================================================================
2351
2521
%% Internal functions
2352
2522
%%======================================================================