From 02e1f00ffdd0c1a74fbc0be5f314b8921b0c9165 Mon Sep 17 00:00:00 2001 From: Léo Gaspard Date: Sat, 4 Aug 2018 12:18:28 +0900 Subject: dovecot, opensmtpd: add link to test in `meta.tests` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rationale --------- Currently, tests are hard to discover. For instance, someone updating `dovecot` might not notice that the interaction of `dovecot` with `opensmtpd` is handled in the `opensmtpd.nix` test. And even for someone updating `opensmtpd`, it requires manual work to go check in `nixos/tests` whether there is actually a test, especially given not so many packages in `nixpkgs` have tests and this is thus most of the time useless. Finally, for the reviewer, it is much easier to check that the “Tested via one or more NixOS test(s)” has been checked if the file modified already includes the list of relevant tests. Implementation -------------- Currently, this commit only adds the metadata in the package. Each element of the `meta.tests` attribute is a derivation that, when it builds successfully, means the test has passed (ie. following the same convention as NixOS tests). Future Work ----------- In the future, the tools could be made aware of this `meta.tests` attribute, and for instance a `--with-tests` could be added to `nix-build` so that it also builds all the tests. Or a `--without-tests` to build without all the tests. @Profpatsch described in his NixCon talk such systems. Another thing that would help in the future would be the possibility to reasonably easily have cross-derivation nix tests without the whole NixOS VM stack. @7c6f434c already proposed such a system. This RFC currently handles none of these concerns. Only the addition of `meta.tests` as metadata to be used by maintainers to remember to run relevant tests. --- doc/meta.xml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'doc') diff --git a/doc/meta.xml b/doc/meta.xml index 496b32916552..51c7b2dfc88f 100644 --- a/doc/meta.xml +++ b/doc/meta.xml @@ -250,6 +250,61 @@ meta.platforms = stdenv.lib.platforms.linux; + + + tests + + + + An attribute set with as values tests. A test is a derivation, which + builds successfully when the test passes, and fails to build otherwise. A + derivation that is a test requires some meta elements + to be defined: needsVMSupport (automatically filled-in + for NixOS tests) and timeout. + + + The NixOS tests are available as nixosTests in + parameters of derivations. For instance, the OpenSMTPD derivation + includes lines similar to: + +{ /* ... */, nixosTests }: +{ + # ... + meta.tests = { + basic-functionality-and-dovecot-integration = nixosTests.opensmtpd; + }; +} + + + + + + + timeout + + + + A timeout (in seconds) for building the derivation. If the derivation + takes longer than this time to build, it can fail due to breaking the + timeout. However, all computers do not have the same computing power, + hence some builders may decide to apply a multiplicative factor to this + value. When filling this value in, try to keep it approximately + consistent with other values already present in + nixpkgs. + + + + + + needsVMSupport + + + + A boolan that states whether the derivation requires build-time support + for Virtual Machine to build successfully. + + + hydraPlatforms -- cgit 1.4.1