Test Programs

Name

NTP Client Test Programs -- Describe the test programs and their host-side support

Test Programs

There are four test programs in the tests subdirectory of this package that exercise the NTP client and do duty as examples of its use. These are supported by a test NTP server in the hosts directory. There is a README.TXT file in that directory describing how to build and run the test server.

ntp_basic

The ntp_basic.c test performs no actual tests. Instead it just starts the NTP client and then prints the current time, in the form of seconds since the UNIX epoch, every 10s for some number of iterations before shutting down. The main purpose of this test is to check the basic functionality of the client. With access to a suitable host clock, this can also serve as a manual verification that the client is correctly tracking the server.

ntp_accuracy

The ntp_accuracy.c test attempts to check the accuracy of the local clock against the test server. After starting the NTP client and allowing it to synchronize it queries the time on the test server via its control interface and compares the result with local time. It takes a number of samples and if more than 80% of these are within 10ms then the test is considered a pass. It repeats this test a number of times at 10s intervals to look for any clock drift.

ntp_date

The ntp_date.c test attempts to check that the client can handle crossing various pathological dates. These include handling leap seconds, the UNIX 32 bit time_t sign overflow in 2038, the UNIX 32 bit unsigned overflow in 2106 and the NTP timestamp era ends in 2036 and 2172. It does this by using the test server's control interface to change its idea of the current data and then watching the local clock as the NTP client resynchronizes to the new date.

ntp_adjtime

The ntp_adjtime.c test attempts to check that the underlying clock adjustment subsystem correctly handles various time adjustments. It does this by changing the test server's idea of time by some amount and watching the NTP client resyncronize to the new time. It has the option for each test of either delaying until the adjustment is made, or polling the current time, checking that time continues to increse monotonically.

2017-02-09
Documentation license for this page: eCosPro License