Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testament: add flags (more flexible than matrix, cmd, targets) #349

Open
timotheecour opened this issue Mar 6, 2021 · 1 comment
Open

Comments

@timotheecour
Copy link
Member

timotheecour commented Mar 6, 2021

proposal

add options testament spec; this generalizes targets, cmd, and matrix. In particular, this allows specifying different options per backend, where some option combinations would either be non-meaningful for a backend or redundant, avoiding combinatorial explosion.

example

discard """
  flags: “js"
  flags: “js -u:nodejs" # -u:nodejs will override the default added -d:nodejs
  flags: “c —threads:on"
  flags: “c —threads:on -d:ssl"
  flags: “$target -d:foo"
    # $target honors default target, which depends (currently) on `NIM_COMPILE_TO_CPP`
  flags: “r -b:cpp"
  flags: “doc —doccmd:-d:foo"
"""

doAssert true

benefits

  • faster CI by avoiding redundant combinations
  • allows testing other backends without having to jump through hoops (eg --threads:on currently breaks js, refs js should ignore threads:on Nim#17267)

implementation

testament will then run:

$nim $options $flags $file

where $options is already defined in testament as default options to use; note that $flags can override those

alternative

allow multiple cmd entries (currently only 1 possible)

```nim
discard """
  cmd: “$nim c $options $file"
  cmd: “$nim c --threads:on $options $file"
  cmd: “$nim js $options $file"
"""
doAssert true

but cmd in most cases would have the redundant prefix $nim and $options $file, so flags is IMO a simple but useful sugar.

note that we can still also support multiple cmd entries, for those cases where the cmd to run doesn't fit a pattern like “$nim c $options $file" (eg: no $options, or arguemnts after $file, etc)

@timotheecour timotheecour changed the title testament: add options (more flexible than matrix, cmd, targets) testament: add flags (more flexible than matrix, cmd, targets) Mar 6, 2021
@Araq
Copy link
Member

Araq commented Mar 6, 2021

I prefer the flags, however multiple cmd have their own advantage, we can then test for both nim c and nim check, for example. We should do whatever is easier to implement IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants