ocaml / ocaml/dune

Allow `(alias ...)` in test(s) stanza to attach the test to a different alias, e.g. `longtests`

Open
#6,152 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

Desired Behavior

When (alias ...) is present in a test(s) stanza, run the test (and diff) for this alias and not the runtest alias.

This would allow to use nice concise test stanzas, including the diffing functionality, for the use case of running long tests / benchmarks only occasionnally (or in CI).

When one just wants to run some executable for some alias, it remains reasonably concise even without the test stanza : an executable stanza + a short rule stanza. With the diffing + promotion added, that's one more stanza with mostly boilerplate.

Example

I would like to be able to write:

(test
  (alias longtests)
  (name test)
  (libraries ...)
  (deps ...)
)

Instead of having to write

(executable
  (name test)
  (libraries ...)
)

(rule
  (deps ...)
  (action (with-stdout-to test.output (run ./test.exe)))
)

(rule
  (alias longtests)
  (action (diff test.expected test.output))
)

This would also make it easier to switch a test already using a test stanza to another alias.

Thank you very much for Dune,
Best.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start by tracing how test(s) stanzas currently attach to the runtest alias, then examine alias handling and diff/promotion behavior; done means (alias longtests) runs the test and diff for longtests instead of runtest without the extra executable and rule boilerplate.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.