reframe icon indicating copy to clipboard operation
reframe copied to clipboard

Allow templated executable scripts

Open vkarak opened this issue 8 months ago • 0 comments

It would be extremely useful to allow users having full control over the generated executable through Jinja2 templating. Here is an example:

class MyTest(...):
    var = variable(int, value=3)
    executable_script = '''#!/bin/bash
# normal shell script code here
{% for i in range(5) %}
{{launch_cmd}} {{test.executable}} --foo {{test.var + 1}}
{% endfor %}
'''

The test template variable should be bound to self and launch_cmd and others would be shortcuts their equivalent calls, as everything can be emitted from the test info. This should greatly simplify emitting multiple job steps, for which now we have to rely on prerun_cmds.

I'd suggest that executable_scripts should co-exist with executable and executable_opts and the former will essentially only provide the template for generating the final launch script. This will be very useful for base library tests, since they could emit tailored code for their subclasses transparently.

vkarak avatar Feb 04 '25 22:02 vkarak