Registering CREDO Test suites with SCons

For CREDO tests to be able to be registered with and work with SCons, it currently requires several things to be done.

To set up your initial links between the SCons configuration for your project and CREDO:

  • Use of the CREDO SCons-related functions distributed with CREDO in the scons folder;
  • Addition of several targets to your project’s main SCons config file, e.g. SConstruct.

Then to register particular CREDO test suites with SCons just requires:

  • Calling the CREDO functions on your environment in your project configuration files, e.g. Underworld/SConscript.

These sections will be explained in turn - if you are working on an existing project that already has CREDO system testing integrated into the project’s SCons build system, you can safely jump ahead to Registering CREDO system tests suites for your project with SCons.

Note

for the instructions in this section to work, it requires the CREDO system test suite files to follow the conventions in Requirements for importing test suites: Dual-mode, and the suite() function, as this convention allows suites to be easily imported from other files.

Registering CREDO system tests suites for your project with SCons

Registering test suites to belong to SCons-visible testing targets is part of functionality provided by the CREDO SCons toolkit. So provided you (or whoever has setup your project) has followed the instructions in Setting up the links between SCons and CREDO for a project, you just need to:

  1. Right after you set up the cloned environment for a sub-project, define a CURR_PROJECT env variable recording the name of the project.

    CREDO’s SCons toolkit can then use this to record and report on which project a test suite is registered to.

    For example, for the Underworld the following lines are near the top of the project’s SConscript file:

    Import('env')
    
    env = env.Clone()
    env['CURR_PROJECT'] = "Underworld"
    
  2. use functions such as the following to add a test suite to an SCons target:

    • env.AddLowResTestSuite
    • env.AddIntegrationTestSuite
    • env.AddConvergenceTestSuite
    • env.AddSciBenchTestSuite

    ... where the only input to each function is the relative path to the CREDO Suite to register. For example, in the Underworld project this section looks like the following towards the bottom of the project’s SConscript file:

    env.AddLowResTestSuite('SysTest/RegressionTests/testAll_lowres.py')
    env.AddIntegrationTestSuite('SysTest/RegressionTests/testAll.py')
    env.AddConvergenceTestSuite('SysTest/PerformanceTests/testAll.py')
    env.AddSciBenchTestSuite('SysTest/ScienceBenchmarks/testAll.py')
    

That’s it! This will then allow you to run SCons command-line testing targets and get reporting on a per-project basis as shown in Running a test target, or test suite, via the SCons build system.