NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.55k stars 1.5k forks source link

Test environment report #10569

Open roberth opened 6 months ago

roberth commented 6 months ago

Is your feature request related to a problem? Please describe.

Nix runs in many environments, each of which needs testing. Not all tests run in all environments. Any non-trivial logic in test code can contain bugs, which will go unnoticed. Test conditions that control whether a test runs in particular are fail unsafe. (E.g. if system == "x86-64_linux" .... Did you spot it?)

Given the source of any test, I want to be able to tell reliably,

Describe the solution you'd like

Describe alternatives you've considered

Just hope.

Use an existing solution? Didn't find one. Most of our test code is custom, so I have doubts, but if anyone knows anything, please comment. JUnit's report format is a standard that's exported by a number of frameworks. Would be nice to reuse that perhaps. Maybe combine this with a cross referencing solution? Something like GHC Notes, or something that formalizes "grep across files with identifiers". Combine with coverage report? Combine the coverage reports' per-line info? (Where we have coverage reporting; something else elsewhere)

Additional context

Priorities

Add :+1: to issues you find important.

roberth commented 4 months ago

Did a small amount of research:

Functional tests

Performance matters, so we want to log efficiently.

When logging is enabled, do not create child processes (ie use echo/printf). Do not reopen the report file, but use a file descriptor. Set CLOEXEC, e.g.: exec 3>&-.

Report format

JUnit XML looks suitable. Open questions:

Tooling