mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-14 05:29:20 +03:00
nixos/lib/testing/run: expose rawTestDerivation
For `testBuildFailure` and similar functions, we need a full blown derivation and not a lazy one. This is an internal option for test framework developers.
This commit is contained in:
parent
d4d7550108
commit
a0dc17bd57
1 changed files with 28 additions and 18 deletions
|
@ -16,6 +16,15 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
rawTestDerivation = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
description = mdDoc ''
|
||||||
|
Unfiltered version of `test`, for troubleshooting the test framework and `testBuildFailure` in the test framework's test suite.
|
||||||
|
This is not intended for general use. Use `test` instead.
|
||||||
|
'';
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
|
|
||||||
test = mkOption {
|
test = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
# TODO: can the interactive driver be configured to access the network?
|
# TODO: can the interactive driver be configured to access the network?
|
||||||
|
@ -29,25 +38,26 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
rawTestDerivation = hostPkgs.stdenv.mkDerivation {
|
||||||
|
name = "vm-test-run-${config.name}";
|
||||||
|
|
||||||
|
requiredSystemFeatures = [ "kvm" "nixos-test" ];
|
||||||
|
|
||||||
|
buildCommand = ''
|
||||||
|
mkdir -p $out
|
||||||
|
|
||||||
|
# effectively mute the XMLLogger
|
||||||
|
export LOGFILE=/dev/null
|
||||||
|
|
||||||
|
${config.driver}/bin/nixos-test-driver -o $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru = config.passthru;
|
||||||
|
|
||||||
|
meta = config.meta;
|
||||||
|
};
|
||||||
test = lib.lazyDerivation { # lazyDerivation improves performance when only passthru items and/or meta are used.
|
test = lib.lazyDerivation { # lazyDerivation improves performance when only passthru items and/or meta are used.
|
||||||
derivation = hostPkgs.stdenv.mkDerivation {
|
derivation = config.rawTestDerivation;
|
||||||
name = "vm-test-run-${config.name}";
|
|
||||||
|
|
||||||
requiredSystemFeatures = [ "kvm" "nixos-test" ];
|
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
mkdir -p $out
|
|
||||||
|
|
||||||
# effectively mute the XMLLogger
|
|
||||||
export LOGFILE=/dev/null
|
|
||||||
|
|
||||||
${config.driver}/bin/nixos-test-driver -o $out
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru = config.passthru;
|
|
||||||
|
|
||||||
meta = config.meta;
|
|
||||||
};
|
|
||||||
inherit (config) passthru meta;
|
inherit (config) passthru meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue