php-src/ext/snmp/tests
Niels Dossche 3ba725a556
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18309: ipv6 filter integer overflow
  Fix GH-18304: Changing the properties of a DateInterval through dynamic properties triggers a SegFault
2025-04-11 23:36:42 +02:00
..
bigtest
bigtest.js Support bug64159.phpt on Windows CI (GH-15895) 2024-09-21 16:03:25 +02:00
bug60749.phpt
bug64124.phpt
bug64159.phpt Support bug64159.phpt on Windows CI (GH-15895) 2024-09-21 16:03:25 +02:00
bug72479.phpt
clean.inc
CONFLICTS
generic_timeout_error.phpt
gh16959.phpt [skip ci] Ignore snmp test on asan that frequently times out 2025-03-10 11:24:27 +01:00
gh17330.phpt Fix GH-17330: SNMP::setSecurity segfaults when object had been closed. 2025-01-05 13:34:21 +00:00
gh18304.phpt Fix GH-18304: Changing the properties of a DateInterval through dynamic properties triggers a SegFault 2025-04-11 23:33:58 +02:00
ipv6.phpt
README.md
skipif.inc
snmp-object-errno-errstr.phpt Merge branch 'PHP-8.1' into PHP-8.2 2025-03-08 16:11:33 +01:00
snmp-object-error.phpt Suppress snmp lib memory leak, skip ASAN tests 2025-03-08 16:10:59 +01:00
snmp-object-properties-error.phpt
snmp-object-properties.phpt
snmp-object-setSecurity_error.phpt
snmp-object.phpt
snmp2_get.phpt Suppress snmp lib memory leak, skip ASAN tests 2025-03-08 16:10:59 +01:00
snmp2_getnext.phpt
snmp2_real_walk.phpt
snmp2_set-nomib.phpt Suppress snmp lib memory leak, skip ASAN tests 2025-03-08 16:10:59 +01:00
snmp2_set.phpt
snmp2_walk.phpt Suppress snmp lib memory leak, skip ASAN tests 2025-03-08 16:10:59 +01:00
snmp3-error.phpt Suppress snmp lib memory leak, skip ASAN tests 2025-03-08 16:10:59 +01:00
snmp3.phpt
snmp_get_quick_print.phpt
snmp_get_valueretrieval.phpt
snmp_getvalue.phpt Merge branch 'PHP-8.1' into PHP-8.2 2025-03-08 16:11:33 +01:00
snmp_include.inc
snmp_read_mib.phpt
snmp_session_error.phpt Fix snmp_session_error.phpt for 32bit machines (GH-17611) 2025-01-29 14:41:15 +01:00
snmp_set_enum_print.phpt
snmp_set_oid_output_format.phpt
snmpd.conf
snmpget.phpt Suppress snmp lib memory leak, skip ASAN tests 2025-03-08 16:10:59 +01:00
snmpgetnext.phpt
snmprealwalk.phpt
snmpset-nomib.phpt Suppress snmp lib memory leak, skip ASAN tests 2025-03-08 16:10:59 +01:00
snmpset.phpt
snmpwalk.phpt Suppress snmp lib memory leak, skip ASAN tests 2025-03-08 16:10:59 +01:00
wrong_hostname.phpt

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

  • On Ubuntu, install snmpd and snmp-mibs-downloader. (May be net-snmpd on other distributions.)
  • 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