php-src/ext/snmp/tests
2024-08-21 21:12:17 +01:00
..
bigtest Rename ext/snmp/tests/bigtest.sh to bigtest 2018-09-27 02:41:54 +02:00
bug60749.phpt Fix snmp test for ipv6 2021-07-20 15:01:51 +02:00
bug64124.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
bug64159.phpt Test snmp on Windows CI 2022-05-11 13:24:23 +02:00
bug72479.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
clean.inc
CONFLICTS Mark snmp tests as conflicting 2020-09-09 11:24:06 +02:00
generic_timeout_error.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
ipv6.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
README.md Wildcard output differences in snmp tests 2020-09-09 10:02:25 +02:00
skipif.inc Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp2_get.phpt Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
snmp2_getnext.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp2_real_walk.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp2_set-nomib.phpt [skip ci] Avoid running asan tests that timeout 2023-10-02 16:57:50 +02:00
snmp2_set.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp2_walk.phpt [skip ci] Avoid running asan tests that timeout 2023-10-02 16:57:50 +02:00
snmp3-error.phpt [skip ci] Avoid running asan tests that timeout 2023-10-02 16:57:50 +02:00
snmp3.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp_get_quick_print.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp_get_valueretrieval.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp_getvalue.phpt [skip ci] Avoid running asan tests that timeout 2023-10-02 16:57:50 +02:00
snmp_include.inc Reindent phpt files 2020-02-03 22:52:20 +01:00
snmp_read_mib.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp_set_enum_print.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp_set_oid_output_format.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp-object-errno-errstr.phpt [skip ci] Avoid running asan tests that timeout 2023-10-02 16:57:50 +02:00
snmp-object-error.phpt [skip ci] Avoid running asan tests that timeout 2023-10-02 16:57:50 +02:00
snmp-object-properties-error.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmp-object-properties.phpt Deprecate implicit dynamic properties 2021-11-26 14:10:11 +01:00
snmp-object-setSecurity_error.phpt add SHA256 and SHA512 for security protocol 2021-08-11 13:02:18 +02:00
snmp-object.phpt Fix 'can not' in error messages 2021-10-05 09:51:58 +01:00
snmpd.conf Test snmp on Windows CI 2022-05-11 13:24:23 +02:00
snmpget.phpt [skip ci] Avoid running asan tests that timeout 2023-10-02 16:57:50 +02:00
snmpgetnext.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmprealwalk.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmpset-nomib.phpt [skip ci] Avoid running asan tests that timeout 2023-10-02 16:57:50 +02:00
snmpset.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
snmpwalk.phpt [skip ci] Avoid running asan tests that timeout 2023-10-02 16:57:50 +02:00
wrong_hostname.phpt Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02: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

  • 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