Share via


System Time (Real-Time Clock) Tests (Compact 7)

3/12/2014

The System Time (Real-Time Clock) tests verify the implementation and behavior of the device's real-time clock.

Test Prerequisites

Your device must meet the following requirements before you run this test.

The test should be run on a minimal OS design, such as one with only the following SYSGENs set to minimize the likelihood of interactions from other system components:

SYSGEN_ETHERNET=1

SYSGEN_SHELL=1

The test will frequently change the RTC clock of the system which may have side effects on a larger image. In particular, SYSGEN_POOM must not be set.

The following table shows the hardware requirements for the test:

Requirement Description

Real-time clock (RTC)

Clock that corresponds to the GetSystemTime function

The following table shows the software requirements for the test:

Requirements Description

Tux.exe

Tux test harness, required for executing the test

Kato.dll

Kato logging engine, required for logging test data

OalTestTimers.dll

Library containing the timer tests

Subtests

The table below lists the subtests included in this test.

SubTest ID Description

1220

RTC Backwards Check - busy.

Confirms that the real-time clock is a monotonically increasing value that runs backward only when it overflows. This test case reads each subsequent clock tick and verifies that the value is greater than the previous value. If the value is less than the previous value, the difference between the values must be less than twice the resolution of the clock. If the difference between the values is greater than twice the resolution of the clock, this test case fails.

This test uses GetSystemTime to access the RTC.

By default, this test case runs for 3 hours. You can specify the length of time that it runs by specifying -backwardsRunTime <time>, where <time> is the run time for the test in seconds.

The test must run a quick calibration to determine how many iterations are needed to run for the full test time. The default length of the calibration test is 10 seconds, but the length of the calibration test can be changed with the -CalibThresh <time in ms> option on the command line.

1250

This is a simple test that queries and prints out the current RTC value. It will pass so long as the RTC query functions succeed.

1260

Real-Time Clock Range.

Finds the range of years supported by the RTC in the OAL code. The test looks for the range beginning with the minimum possible FILETIME (FILETIME 0 is the start of Jan 1st 1601) and end with maximum possible FILETIME (Max FILETIME is the maximum 64-bit value).

The test begins by setting a time. While OEMSetRealTime returns FALSE, it increments the time and sets it again, and does this until OEMSetRealTime returns TRUE and the start of the range is found. It then increments the time again and sets it until OEMSetRealTime returns a FALSE. This marks the end of the range.

The test case uses SetLocalTime and GetLocalTime functions to access the OAL functions OEMSetRealTime and OEMGetRealTime respectively.

It is possible that the end of range might not be found and the FILETIME overflow value is reached. In this case, the end of range might not exist; for the purpose of testing, the test case uses the maximum 64-bit ULONGLONG value; in other words, the maximum FILETIME value as the end of range.

This test case assumes that the supported range of years is always contiguous. The test case fails if the supported range is less than 100 years.

This test case sets the RTC back to the value it had at the beginning of the test if it completes successfully.

1270

OEMGetRealTime and OEMSetRealTime Functions.

Verifies that the OEMSetRealTime and OEMGetRealTime functions correctly set and get the real-time clock values.

The test case sets various valid times (within the supported time range) and invalid times (out of the supported range). It verifies that the valid times are set and invalid times are not set. The time read back should match the value that was set if it was a valid time, and should match the value before the time was set if it was an invalid time.

The test case uses SetLocalTime and GetLocalTime functions to access the OAL functions OEMSetRealTime and OEMGetRealTime respectively.

You can optionally supply your own date and time for testing using -c "-dateAndTime mm/dd/yyyy hh:mm:ss", where mm/dd/yyyy hh:mm:ss is the date and time you want to test.

This test case sets the RTC back to the value it had at the beginning of the test if it completes successfully.

1280

Rollover of RTC.

Verifies that the RTC rolls over correctly when transitioning between years, months, days, hours, minutes and seconds.

The test case sets a time, sleeps for 5 seconds, then gets the time and verifies if the time is as expected.

The test case uses SetLocalTime and GetLocalTime functions to access the OAL functions OEMSetRealTime and OEMGetRealTime respectively.

This test case sets the RTC back to the value it had at the beginning of the test if it completes successfully.

Setting Up the Test

This test has no additional requirements, beyond the standard test environment setup.

Running the Test

The test performs the following on default execution: tux -o -d oalTestTimers.dll -x 1220-1280 -c"-backwardsRunTime 1800"

You can modify the RTC Real-Time Functions Test by editing the command line for the test. To specify one or more of the following optional command line parameters for this test, use the -c command line parameter, which forces Tux to pass the specified string into the test module. For more information about how to edit the command line for a test, see Editing the Command-Line for a Test.

The following table shows the command line parameters for the RTC Real-Time Functions Test.

Command line parameter Description

-backwardsRunTime <time>

For test case 1220, specifies the run time for the test, in seconds, unless the modifiers below are used. The default run time is 3 hours.

-CalibThresh <time in ms>

For test case 1220, specifies the time allowed for calibration, in milliseconds. The default time is 10 seconds.

-dateAndTime mm/dd/yyyy hh:mm:ss

For test case 1270, specifies the date and time to test. Used for OEMGetRealTime and OEMSetRealTime functions and with the RTC Set System Time test case (test case 1300), which is not run by default. mm/dd/yyyy hh:mm:ss is the date and time respectively.

* s means seconds (12s = 12 seconds)

* m means minutes (12m = 12 minutes)

* h means hours (12h = 12 hours)

* d means days (12d = 12 days)

Verifying the Test

When the test completes running, verify that "PASS" appears in the test log for all sub-tests.

Troubleshooting the Test

* Ensure that you are running on a minimal run-time image such as an "OAL" configuration image.

* Ensure that drivers and servers running on the OS meet real time constraints and do not interrupt the test.

* Determine the point of failure and record the exact error message. Check that the setup steps were followed and that all pre-requisites were met. If the source code is available, examine the point of failure in code to see if any additional information can be gathered about the failure domain.

For additional platform specific issues, consult the CTK articles on the TechNet wiki.

See Also

Other Resources

OAL - KITL, Memory, RTC Tests