Magic strings

Benchmarking configuration files support a special placeholder syntax, using double curly braces {{placeholder}}. This syntax is specially useful for:

  • Refactoring configuration fields.

  • Replacing with values from other configuration files, such as the machine config.

  • Making use of code variables modified at runtime, by having reserved keywords.

  • Fetching defined parameters values that change during runtime.

To get a value of a field in the same file, the field path must be separated by dots. For example,

"field_a":{
    "field_b":{
        "field_c": "my value"
    }
}

"example_placeholder": "{{field_a.field_b.field_c}}"

For replacing a value coming from the machine configuration, simply prepend any placeholder path with machine.

1. Reserved Keywords

The framework is equiped with the following reserved keywords for placeholders:

  • {{instance}} : Returns the hashcode of the current ReFrame test.

  • {{.value}}: The value keyword must be appended to a parameter name (e.g. {{parameters.my_param.value}}). It fetches the current value of a given runtime variable (such as a parameter). More information on the Parameters section.

2. Nested placeholders

Nested placeholders are supported.

For example, lets say you have a machine configuration containing

"platform":"builtin"

And a benchmark configuration:

"platforms":{
    "builtin":"my_builtin_value",
    "other":"my_other_value"
},
"nested_placeholder":"My platform dependent value is {{ platforms.{{machine.platform}} }}"

The nested_placeholder field will then take the value of "My platform dependent value is my_buildin_value", because the machine config specifies that "platform" is "builtin". But this will change if "platform" is set to "other".

3. Using environment variables

Environment variables can be specifed in any configuration file by prepending a $. For example,

"my_home": "$HOME"

Shorthand representations such as ~ and relative paths starting by . are not supported. For relative file or folder paths, use $PWD instead.