Skip to content

Test Infrastructure

trentmeester edited this page Dec 8, 2011 · 8 revisions

Tests rely heavily upon C++ inheritance and polymorphism to solve various requirements. The base class of every test is called Test, and attempts to place constraints and guidelines onto developers to support the following:

  1. Force developers to code test logic in uniform way.
  2. Force developers to easily document tests.
  3. Allow many ways for a test to report errors.
  4. Bind resource lifetimes.
  5. Check for hidden PCI or controller space register errors.

Force Coding in Uniform Way

The Test base class has a pure virtual method called RunCoreTest(). This method must be implemented within all children otherwise they cannot be instantiated. RunCoreTest() is where each and every test contains its core test logic. This is the entry point into each and every test residing within the framework.

Force Documenting Tests

The children derived from base class Test are required to document the reason for the existence of the test, as well as other useful information. All tests are documented in a similar manner and will have a common output displayed when a user requests test details from the command line.

Specifically, the children must supply valid and relevant text by populating member variable Test::mTestDesc within the constructor of the child. This member variable is itself an object and requires initialization of the following items:

  1. SetCompliance() - Which section and spec revision is this test targeting.
  2. SetShort() – Provide a short 66 character description for the test cases existence.
  3. SetLong() – Provide an unlimited amount of text to thoroughly describe the test.

This duty, albeit cumbersome but simple, will be vital to handing off test case descriptions to future generations.

Allow Multiple Error Reporting Techniques

There are basically 2 acceptable methods of reporting test case errors and/or compliance violations to the framework. Because Test::RunCoreTest() returns a bool, a developer returns false upon errors and true when the test successfully passes. The other mechanisms is to throw a std::exception() from anywhere within the child class. All exceptions are caught by the base class and this is converted to the proper reporting mechanism back to the framework so that users see a test case ending in error when one throws.

Check for Hidden Errors

During test case execution the test creates an environment and decides on the pass fail criteria of the logic. The framework adds further test case pass fail criteria by looking at the PCI register space and detecting any PCI error bits which have been set during the test run. The same holds true for controller register STS. All registers which are checked after each test runs are reset before the test runs. This guarantees that if a bit has become set it is the result of what has occurred within the test. For complete details see method Test:: GetStatusRegErrors().

Clone this wiki locally