kani icon indicating copy to clipboard operation
kani copied to clipboard

Expand `${variable}` in benchcomp variant `env`

Open karkhaz opened this issue 7 months ago • 0 comments

Requested feature: The value of the env key in Benchcomp's config file should expand strings of the form ${variable} to the value of that environment variable.

Use case: Benchcomp variants often require a different value of $PATH for each variant. Currently users set $PATH in the command_line, which obscures the difference between variants. This feature would allow the user to do this:

env:
  PATH: /my/local/directory:${PATH}
  CFLAGS: -O2 ${CFLAGS}

Link to relevant documentation (Rust reference, Nomicon, RFC): N/A

Test case: Running benchcomp with the below config file should terminate successfully. Note that ${USER} is assumed to be set by the Unix session so should always be available, and the whoami command is also assumed to be available.

variants:
  var_set:
    config:
      command_line: "[ \"${kani_user}\" = \"$(whoami)\" ]"
      env:
        kani_user: "${USER}"
      directory: /tmp
run:
  suites:
    suite_1:
      parser:
        command: >
          echo '{"benchmarks": {}, "metrics": {}}'
      variants: [var_set]

visualize: []

karkhaz avatar Jan 22 '24 17:01 karkhaz