Chapter 159. Testing

159.1. Test Programs

There are a number of test programs supplied with the PPP subsystem. By default all of these tests use the device configured by CYGPKG_PPP_TEST_DEVICE as the PPP link device.

ppp_up

This test just brings up the PPP link on CYGPKG_PPP_TEST_DEVICE and waits until the remote end brings it back down. No modem lines are used and the program expects a PPP connection to be waiting on the other end of the line. Typically the remote end will test the link using ping or access the HTTP system monitor if it is present.

If CYGPKG_PPP_TESTS_AUTOMATE is set, then this test attempts to bring PPP up at each of the baud rates specified in CYGDAT_PPP_TEST_BAUD_RATES. If it is not set then it will just bring the connection up at 115200 baud.

ppp_updown

This test brings the PPP link up on CYGPKG_PPP_TEST_DEVICE and attempts to ping the remote end of the link. Once the pings have finished, the link is then brought down.

If CYGPKG_PPP_TESTS_AUTOMATE is set, then this test attempts to bring PPP up at each of the baud rates specified in CYGDAT_PPP_TEST_BAUD_RATES. If it is not set then it will just bring the connection up at 115200 baud.

chat

This test does not bring the PPP link up but simply executes a chat script. It expects a server at the remote end of the link to supply the correct responses.

This program expects the test_server.sh script to be running on the remote end and attempts several different tests, expecting a variety of different responses for each.

ppp_auth

This test attempts to bring up the PPP link under a variety of different authentication conditions. This includes checking that both PAP and CHAP authentication work, and that the connection is rejected when the incorrect authentication protcol or secrets are used.

This test expects the test_server.sh script to be running on the remote end. For this test to work the /etc/ppp/pap-secrets file on the remote end should contain the following two lines:

eCos       *         secret       *
eCosPAP    *         secretPAP    *

The /etc/ppp/chap-secrets file should contain:

eCos       *         secret       *
eCosCHAP   *         secretCHAP   *
isp

This test expects the serial test device to be connected to a Hayes compatible modem. The test dials the telephone number given in CYGPKG_PPP_DEFAULT_DIALUP_NUMBER and attempts to log on to an ISP using the user name and password supplied in CYGPKG_PPP_AUTH_DEFAULT_USER and CYGPKG_PPP_AUTH_DEFAULT_PASSWD. Once the PPP connection has been made, the program then attempts to ping a number of well known addresses.

Since this test is designed to interact with an ISP, it does not run within the automated testing system.

tcp_echo

This is a version of the standard network tcp_echo test that brings up the PPP connection before waiting for the tcp_sink and tcp_source programs to connect. It is expected that at least one of these programs will connect via the PPP link. However, if another network interface is present, such as an ethernet device, then one may connect via that interface.

While this test is supported by the test_server.sh script, it runs for such a long time that it should not normally be used during automated testing.

nc_test_slave

This is a version of the standard network nc_test_slave test that brings up the PPP connection before waiting for the nc_test_master program to connect. It is expected that the master will connect via the PPP link.

While this test is supported by the test_server.sh script, it runs for such a long time that it should not normally be used during automated testing.

159.2. Test Script

The PPP package additionally contains a shell script (test_server.sh) that may be used to operate the remote end of a PPP test link.

The script may be invoked with the following arguments:

--dev=<devname>
This mandatory option gives the name of the device to be used for the PPP link. Typically "/dev/ttyS0" or "/dev/ttyS1".
--myip=<ipaddress>
This mandatory option gives the IP address to be attached to this end of the PPP link.
--hisip=<ipaddress>
This mandatory option gives the IP address to be attached to the remote (test target) end of the PPP link.
--baud=<baud_rate>
This option gives the baud rate at which the PPP link is to be run. If absent then the link will run at the value set for --redboot-baud.
--redboot
If this option is present then the script will look for a "RedBoot>" prompt between test runs. This is necessary if the serial device being used for testing is also used by RedBoot.
--redboot-baud=<baud_rate>
This option gives the baud rate at which the search for the RedBoot prompt will be made. If absent then the link will run at 38400 baud.
--debug
If this option is present, then the script will print out some additional debug messages while it runs.

This script operates as follows: If the --redboot option is set it sets the device baud rate to the RedBoot baud rate and waits until a "RedBoot>" prompt is encountered. It then sets the baud rate to the value given by the --baud option and reads lines from the device until a recognizable test announce string is read. It then executes an appropriate set of commands to satisfy the test. This usually means bringing up the PPP link by running pppd and maybe executing various commands. It then either terminates the link itself, or waits for the target to terminate it. It then goes back to looking for another test announce string. If a string of the form "BAUD:XXX" is received then the baud rate is changed depending on the XXX value. If a "FINISH" string is received it returns to waiting for a "RedBoot>" prompt. The script repeats this process until it is terminated with a signal.