buildtest.builders.spack

This method defines the Spack buildsystem for the spack package manager (https://spack.readthedocs.io/en/latest/) by generating scripts that will do various spack operation. The SpackBuilder class will generate a test script using the schema definition ‘spack.schema.json’ that defines how buildspecs are written.

Module Contents

Classes

SpackBuilder

This is a subclass of BuilderBase used for building test that uses type: spack in the buildspec.

class buildtest.builders.spack.SpackBuilder(name, recipe, buildspec, buildexecutor, executor, testdir=None, numprocs=None, numnodes=None)[source]

Bases: buildtest.builders.base.BuilderBase

This is a subclass of BuilderBase used for building test that uses type: spack in the buildspec.

The BuilderBase provides common functions for any builder. The builder is an instance of BuilderBase. The initializer method will setup the builder attributes based on input test by name parameter.

Parameters:
  • name (str) – Name of test in buildspec recipe

  • recipe (str) – The loaded test section from the buildspec file

  • buildspec (str) – Full path to buildspec file

  • buildexecutor (buildtest.executors.setup.BuildExecutor) – An instance of BuildExecutor class used for accessing executors

  • testdir (str) – Test directory where tests are written. Must be full path on filesystem.

type = 'spack'
generate_script()[source]

Method responsible for generating the content of test script for spack buildsystem

_spack_test(spack_configuration)[source]

This method will return lines for generating spack test run and spack test results command for running tests via spack and getting results.

_resolve_spack_root(path, verify_spack=True)[source]

Given a path find the startup spack setup script to source.

Parameters:
  • path (str) – Full path to root of spack directory

  • verify_spack (bool, optional) – Check for existence of spack setup script $SPACK_ROOT/share/spack/setup-env.sh before sourcing file. By default this check is enabled but can be disabled to allow test to run even if spack doesn’t exist on filesystem.

Raises:

BuildTestError – Raise exception if root of spack doesn’t exist or we are unable to resolve path to setup script $SPACK_ROOT/share/spack/setup-env.sh

_spack_environment(spack_env)[source]

This method is responsible for creating a spack environment, activate an existing spack environment, deactivating an existing spack environment, create a spack environment from a directory and a manifest file (spack.yaml, spack.lock)

Parameters:

spack_env (dict) – Contains property env from buildspec dictionary