meta.tests: rename into passthru.tests

Nix currently rejects derivations in `meta` values. This works around
that limitation by using `passthru` instead.

Closes https://github.com/NixOS/nixpkgs/issues/50230
This commit is contained in:
Léo Gaspard 2018-11-11 22:55:23 +09:00
parent cae5598611
commit 2986ce16a8
No known key found for this signature in database
GPG key ID: 8A55848B6090F9CF
5 changed files with 20 additions and 14 deletions

View file

@ -255,6 +255,17 @@ meta.platforms = stdenv.lib.platforms.linux;
<varname>tests</varname>
</term>
<listitem>
<warning>
<para>
This attribute is special in that it is not actually under the
<literal>meta</literal> attribute set but rather under the
<literal>passthru</literal> attribute set. This is due to a current
limitation of Nix, and will change as soon as Nixpkgs will be able to
depend on a new enough version of Nix. See
<link xlink:href="https://github.com/NixOS/nix/issues/2532">the relevant
issue</link> for more details.
</para>
</warning>
<para>
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
@ -269,7 +280,7 @@ meta.platforms = stdenv.lib.platforms.linux;
{ /* ... */, nixosTests }:
{
# ...
meta.tests = {
passthru.tests = {
basic-functionality-and-dovecot-integration = nixosTests.opensmtpd;
};
}

View file

@ -2,7 +2,7 @@
# The return value of this function will be an attrset with arbitrary depth and
# the `anything` returned by callTest at its test leafs.
# The tests not supported by `system` will be replaced with `{}`, so that
# `meta.tests` can contain links to those without breaking on architectures
# `passthru.tests` can contain links to those without breaking on architectures
# where said tests are unsupported.
# Example callTest that just extracts the derivation from the test:
# callTest = t: t.test;

View file

@ -68,11 +68,8 @@ stdenv.mkDerivation rec {
description = "Open source IMAP and POP3 email server written with security primarily in mind";
maintainers = with stdenv.lib.maintainers; [ peti rickynils fpletz ];
platforms = stdenv.lib.platforms.unix;
# https://github.com/NixOS/nixpkgs/issues/50230 must be resolved before
# this can be enabled.
#
# tests = {
# opensmtpd-interaction = nixosTests.opensmtpd;
# };
};
passthru.tests = {
opensmtpd-interaction = nixosTests.opensmtpd;
};
}

View file

@ -61,11 +61,8 @@ stdenv.mkDerivation rec {
license = licenses.isc;
platforms = platforms.linux;
maintainers = with maintainers; [ rickynils obadz ekleog ];
# https://github.com/NixOS/nixpkgs/issues/50230 must be resolved before
# this can be enabled.
#
# tests = {
# basic-functionality-and-dovecot-interaction = nixosTests.opensmtpd;
# };
};
passthru.tests = {
basic-functionality-and-dovecot-interaction = nixosTests.opensmtpd;
};
}

View file

@ -166,6 +166,7 @@ let
hydraPlatforms = listOf str;
broken = bool;
# TODO: refactor once something like Profpatsch's types-simple will land
# This is currently dead code due to https://github.com/NixOS/nix/issues/2532
tests = attrsOf (mkOptionType {
name = "test";
check = x: x == {} || ( # Accept {} for tests that are unsupported