Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / net-snmp / perl / SNMP / t / conf.t
1 #!./perl
2
3 BEGIN {
4     unless(grep /blib/, @INC) {
5         chdir 't' if -d 't';
6         @INC = '../lib' if -d '../lib';
7     }
8 }
9
10 # This merely checks to see if the default_store routines work from
11 # read configuration files.  Functionally, if this fails then it's a
12 # serious problem because they linked with static libraries instead of
13 # shared ones as the memory space is different.
14
15 use Test;
16 BEGIN {plan tests => 3}
17
18 $ENV{'SNMPCONFPATH'} = ".:t";
19
20 ok(1); # just start up
21
22 use SNMP;
23 use NetSNMP::default_store(':all');
24
25 # should be 0, as it's un-initialized
26 $myint = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
27                             NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
28
29 ok($myint == 0);
30
31 SNMP::init_snmp("conftest");
32
33 $myint = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
34                                 NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
35
36 # ok, should be 1 as it's initalized by the snmp.conf config file.
37 ok($myint == 1);
38
39 # this is a pretty major error, so if it's not true we really really
40 # print a big big warning.  Technically, I suspect this is a bad thing
41 # to do in perl tests but...
42 if ($myint != 1) {
43     die "\n\n\n" . "*" x 75 . "\nBIG PROBLEM: I wasn't able to read
44     data from a configuration file.  This likely means that you've
45     complied th net-snmp package with static libraries, which can
46     cause real problems with the perl module.  Please reconfigure your
47     net-snmp package for use with shared libraries (run configure with
48     --enable-shared)\n" . "*" x 75 . "\n\n\n\n";
49 }
50