vptest_utils
Python API for virtual platform test.
add_checkpoint_tests
SYNOPSIS
add_checkpoint_tests(suite, target, script, start, duration, variation = '', assert_objs = ['cpu0'], extra_args = [], assert_time = 10, check_cycles_and_steps_in_sync = True)
DESCRIPTION
Add tests to check that reading and writing checkpoints does not change the behavior of a target system.
The test does this by running Simics several times:
- first load the target, run to time start, and then collect the state-assertion file while running for duration cycles,
- then save a checkpoint at time start and run for duration cycles, comparing against the state-assertion file,
- then load the checkpoint from the previous step, write a new checkpoint and run for duration cycles, comparing against the state-assertion file,
- then load the new checkpoint and run for duration cycles comparing against the state-assertion file,
- finally a test is run which runs up to time start and then writes several checkpoints with duration cycles between them.
Arguments:
- suite
the test suite to add the tests to - target
the name of the target directory in[project]/targets
- script
the script in that directory which creates and sets up the target - start
the time the checks performed by the tests should be started ad, in steps - duration
the number of steps past the start time the tests should check the state of the system - variation
a name for this variation of testing the target, defaults to the empty string - assert_objs
a list of objects to use in the state assertion, defaults to["cpu0"]
- extra_args
extra arguments passed to each Simics process started by the test, defaults to[]
- assert_time
the interval in steps between state-assertion saves, defaults to10
- check_cycles_and_steps_in_sync
if True the tests check that the cycle and step counts remain in sync, defaults toTrue
add_random_command_tests
SYNOPSIS
add_random_command_tests(suite, target, script, name = None, project_only = False, disabled_commands = [], disabled_classes = [], disabled_interfaces = [])
DESCRIPTION
Add tests to check all the commands provided by the virtual platform can be run properly.
Arguments:
- suite
the test suite to add the tests to - target
the name of the target directory in[project]/targets
- script
the script in that directory which creates and sets up the target - name
the test name, defaults toNone
- project_only
ifTrue
the tests will test the commands of local modules, defaults toFalse
- disabled_commands
the commands which will be ignored by the test, defaults to[]
- disabled_classes
the classes which will be ignored by the test, defaults to[]
- disabled_interfaces
the interfaces which will be ignored by the test, defaults to[]
testparams
Information about the test environment and some test utilities.
fail
SYNOPSIS
fail(reason = '')
DESCRIPTION
Raise a TestFailure
exception.
Argument:
- reason
a string containing the reason for the failure, passed to theTestFailure
constructor
timeout
SYNOPSIS
timeout()
DESCRIPTION
Raise a TestTimeout
exception.
simics_base_path
SYNOPSIS
simics_base_path()
DESCRIPTION
Return the absolute path to the Simics base package.
project_path
SYNOPSIS
project_path()
DESCRIPTION
Returns the absolute path to the project under test. Tests added with
suite.add_simics_test()
and suite.add_simics_tests()
run Simics in
this project.
test_root
SYNOPSIS
test_root()
DESCRIPTION
Return the absolute path to the simics-base test directory.
TestFailure
SUPERCLASSES
builtins.Exception
DESCRIPTION
Exception which test functions should raise to indicate test failure.
TestTimeout
SUPERCLASSES
builtins.Exception
DESCRIPTION
Exception which test functions should raise to indicate timeout.