php-src/ext/snmp/tests
Fabien Villepinte 0c6d06ecfa Replace EXPECTF when possible
Closes GH-5779
2020-06-29 21:31:44 +02:00
..
bigtest Rename ext/snmp/tests/bigtest.sh to bigtest 2018-09-27 02:41:54 +02:00
bug60749.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
bug64124.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
bug64159.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
bug72479.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
clean.inc
generic_timeout_error.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
ipv6.phpt Make error messages more consistent by fixing capitalization 2020-01-17 14:52:46 +01:00
README.md Fix miscellaneous typos in docs 2019-10-19 19:19:28 +02:00
reflection.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
skipif.inc Reindent phpt files 2020-02-03 22:52:20 +01:00
snmp2_get.phpt More ZPP warning to error related test fixes 2019-09-27 19:16:35 +02:00
snmp2_getnext.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
snmp2_real_walk.phpt Fix tests wrt. ZPP warnings to errors 2019-09-27 19:07:29 +02:00
snmp2_set-nomib.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
snmp2_set.phpt Fix #78880: Yet another batch of spelling errors 2020-01-16 12:04:00 +01:00
snmp2_walk.phpt Fix tests wrt. ZPP warnings to errors 2019-09-27 19:07:29 +02:00
snmp3-error.phpt Fix tests wrt. ZPP warnings to errors 2019-09-27 19:07:29 +02:00
snmp3.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
snmp_get_quick_print.phpt Fix tests wrt. ZPP warnings to errors 2019-09-27 19:07:29 +02:00
snmp_get_valueretrieval.phpt Fix tests wrt. ZPP warnings to errors 2019-09-27 19:07:29 +02:00
snmp_getvalue.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
snmp_include.inc Reindent phpt files 2020-02-03 22:52:20 +01:00
snmp_read_mib.phpt Fix tests wrt. ZPP warnings to errors 2019-09-27 19:07:29 +02:00
snmp_set_enum_print.phpt Replace EXPECTF when possible 2020-06-29 21:31:44 +02:00
snmp_set_oid_output_format.phpt Merge branch 'PHP-7.4' 2019-10-01 11:19:43 +02:00
snmp-object-errno-errstr.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
snmp-object-error.phpt Improve error messages of various extensions 2020-03-23 18:59:04 +01:00
snmp-object-properties.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
snmp-object-setSecurity_error.phpt Fix tests wrt. ZPP warnings to errors 2019-09-27 19:07:29 +02:00
snmp-object.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
snmpd.conf Rename ext/snmp/tests/bigtest.sh to bigtest 2018-09-27 02:41:54 +02:00
snmpget.phpt More ZPP warning to error related test fixes 2019-09-27 19:16:35 +02:00
snmpgetnext.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
snmprealwalk.phpt Fix tests wrt. ZPP warnings to errors 2019-09-27 19:07:29 +02:00
snmpset-nomib.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
snmpset.phpt Fix #78880: Yet another batch of spelling errors 2020-01-16 12:04:00 +01:00
snmpwalk.phpt Fix tests wrt. ZPP warnings to errors 2019-09-27 19:07:29 +02:00
wrong_hostname.phpt Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00

The snmp extension tests

To enable these tests, you must have:

  • PHP compiled with SNMP --with-snmp
  • An SNMP server running.

How to test

You need to give credentials with environment vars if default ones are not suitable (see snmp_include.inc for more info):

SNMP_HOSTNAME : IPv4 of remote SNMP agent
SNMP_HOSTNAME : IPv6 or remote SNMP agent
SNMP_PORT : SNMP port for queries
SNMP_COMMUNITY : community name
SNMP_COMMUNITY_WRITE : community used for write tests (snmpset()).
SNMP_MIBDIR : Directory containing MIBS

To run test suite you may use this command (presuming that you pwd is where this README file is located):

make -C ../../.. test TESTS="`cd ../../..; /bin/ls -1 ext/snmp/tests/*.phpt | xargs echo`"

Running run-tests.php directly will clear your environment and therefore tests will fail if your SNMP configuration does not fit into default values specified in snmp_include.inc.

Configuring the SNMPD server

On Linux/FreeBSD

  • Install package net-snmpd (name may differ based on your distribution).
  • Replace config file (by default this is /etc/snmp/snmpd.conf on Linux and /usr/local/etc/snmp/snmpd.conf on FreeBSD) with snmpd.conf supplied.

Before launching daemon make sure that there is no file /var/net-snmp/snmpd.conf. Delete it if exists. Forgetting to do so will fail SNMPv3 tests.

  • Place ext/snmp/tests/bigtest near snmpd.conf, tune path to it in snmpd.conf.

  • Launch snmpd (service snmpd start or /etc/init.d/snmpd start). Alternatively you can start snmpd daemon using following command line:

    sudo snmpd -C -c ./snmpd.conf -f -Le