BSP Test Rules

From DDCIDeos
Jump to navigationJump to search

Boot

  1. Avoid creating unnecessary testpoint. If the test does not requires to perform the configuration or verification at a specific point, look first for a testpoint that already exist that complies the conditions of the test.

PAL

  1. Perform calculations in the application, not in the PAL interceptor, because they take too long (which introduces extra time in the PAL)
  2. To access the BootInterface Object, use BootInterfaceStructTYP *BIO = getBootObjectPtr();
  3. For variables that need to be preserved across a mode change, such as the phase of the test you are in, use the BIO->testValue<n> values. This value should be set back to 0 after every test so that future tests can rely on it being set to 0 == test_not_started.
  4. If you are accessing the PSIO and you need to write to it, you need to use the PSIO->kernelModePSIO.
  5. When writing a dev-kit-test (ipal portion), put anything platform specific in test-platform-functions.cpp platformConfigTest(tppID, param1, param2, param3).
    • Specify in the generic portion of the test what is expected to be done.
    • PALCOLDSTART is a special case of tppID that is used to do any platform specific coldstart behavior.
    • Store any platform specific variables mapped in PALCOLDSTART as globals in test-platform-functions.cpp to be used by later functions to directly access the hardware.
  6. Architecture specific functions can be put in the utilityFunctions. See utilityFunction.cpp enableGlobalInterrupts() as an example.
    • Notice that there are also arm/x86/ppc folders at various levels of the dev-kit, e.g. testcore. These should be tests that have a substantial amount of architecture specific behavior in them.

Questions

  • How should test cases / requirements be grouped?
    • By generic, architecture, customer, target?
    • What level of granularity? (group by functions within a broader category such as COLDSTART?)
  • What numbering (and naming) scheme is (or should be) followed for requirements and test cases?
    • Initially, number by 10's (100, 110, 120, ...)
    • When adding related scenarios later, use the "in between" numbering (xx1-xx9) to keep similar scenarios together.
  • Is there a database of some sort for current numbers used?
    • This might be helpful as we increase the number of test cases and requirements in the common (dev-kit) repository to prevent accidentally re-using the same numbers

See Also...

Test Development

Test-Utils references:

PAL interceptor code (interfaces, functions, examples):

Toolbox

A collection of useful macros and functions for use in test procedures...

Logging user defined events to the timemap

void logExampleEvent(uint8_t example_number, uint8_t example_part, int32_t timeout)
{
  logSystemEvent(((example_number & 0xF)<<28) | ((example_part & 0xF) <<24) | (timeout & 0xFFFFFF));
}

Start logging events:

enableSystemEventLog();

Stop logging events:

disableSystemEventLog();

The enable/disable functions above come from deos.h (which includes deoskern.h, which includes statapi.h which provides the functions).

Wait until the start of a specified window index

void waitForWindowIndex(windowIndex_t index)
{
  do{
    waitUntilNextPeriod();
  } while (testStructPtr->startingWindowIndex != index);
}

where in tpp#_specializeIPal.cpp, testWindowTimerWrite function:

testPtr->startingWindowIndex = startingWindowIndex

Convert time units

// Local macros
#define US2NS(us)     (us * 1000LL)             // nanoseconds in a microsecond
#define MS2NS(ms)     (ms * 1000000LL)          // nanoseconds in a millisecond
#define NS2US(us)     (us / 1000LL)             // nanoseconds in a microsecond
#define NS2MS(ms)     (ms / 1000000LL)          // nanoseconds in a millisecond

Calculate the number of nanoseconds from the current time (to set timer parameter)

// Return the value to write to the timer given the duration you want to wait from now and the 
// value returned from getElapsedTimeInNsecs(); 
#define expireTime(timerWaitInNS, currentTimeNS)  (timerWaitInNS + currentTimeNS - getLastMajorFrameStartTimeInNsecs())

Or

// Return the value to write to the timer given the duration you want to wait from now
#define expireTime(timerWaitInNS)  (timerWaitInNS + getElapsedTimeInNsecs() - getLastMajorFrameStartTimeInNsecs())