tests: make enableBig an option

This makes it possible to identify the test as big in the test file
itself. It also seems like a more natural way to control the test
running.
This commit is contained in:
Robert Helgesson 2022-01-02 10:22:50 +01:00
parent adaea605db
commit 5f00024e75
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
7 changed files with 151 additions and 144 deletions

13
tests/big-test.nix Normal file
View file

@ -0,0 +1,13 @@
{ lib, ... }:
{
options.test.enableBig = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to enable <quote>big</quote> tests. These are tests that require
more resources than typical tests. For example, tests that depend on large
packages or tests that take long to run.
'';
};
}

View file

@ -26,7 +26,9 @@ let
# unnecessary rebuilds of the tests.
manual.manpages.enable = false;
imports = [ ./asserts.nix ./stubs.nix ];
imports = [ ./asserts.nix ./big-test.nix ./stubs.nix ];
test.enableBig = enableBig;
}
];
@ -55,6 +57,7 @@ import nmt {
./modules/programs/browserpass
./modules/programs/dircolors
./modules/programs/direnv
./modules/programs/emacs
./modules/programs/feh
./modules/programs/fish
./modules/programs/gh
@ -101,6 +104,7 @@ import nmt {
] ++ lib.optionals isLinux [
./modules/config/i18n
./modules/i18n/input-method
./modules/misc/debug
./modules/misc/gtk
./modules/misc/numlock
./modules/misc/pam
@ -109,6 +113,7 @@ import nmt {
./modules/misc/xsession
./modules/programs/abook
./modules/programs/autorandr
./modules/programs/firefox
./modules/programs/foot
./modules/programs/getmail
./modules/programs/gnome-terminal
@ -152,10 +157,5 @@ import nmt {
./modules/services/xsettingsd
./modules/systemd
./modules/targets-linux
] ++ lib.optionals enableBig [
./modules/programs/emacs
] ++ lib.optionals (enableBig && isLinux) [
./modules/misc/debug
./modules/programs/firefox
]);
}

View file

@ -1,5 +1,6 @@
{
debug = { pkgs, config, lib, ... }: {
debug = { pkgs, config, lib, ... }:
lib.mkIf config.test.enableBig {
home.enableDebugInfo = true;
home.packages = with pkgs; [ curl gdb ];

View file

@ -10,7 +10,7 @@ let
emacsBin = "${config.programs.emacs.finalPackage}/bin/emacs";
in {
in lib.mkIf config.test.enableBig {
programs.emacs = {
enable = true;
package = pkgs.emacs-nox;

View file

@ -2,8 +2,7 @@
with lib;
{
config = {
lib.mkIf config.test.enableBig {
programs.firefox = {
enable = true;
enableGnomeExtensions = true;
@ -34,5 +33,4 @@ with lib;
configuration using 'programs.firefox.package' instead. You can refer to
its example for how to do this.
''];
};
}

View file

@ -2,8 +2,7 @@
with lib;
{
config = {
lib.mkIf config.test.enableBig {
programs.firefox = {
enable = true;
profiles.basic.isDefault = true;
@ -19,8 +18,7 @@ with lib;
bookmarks = {
wikipedia = {
keyword = "wiki";
url =
"https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
};
"kernel.org" = { url = "https://www.kernel.org"; };
};
@ -67,5 +65,4 @@ with lib;
$bookmarksFile \
${./profile-settings-expected-bookmarks.html}
'';
};
}

View file

@ -2,8 +2,7 @@
with lib;
{
config = {
lib.mkIf config.test.enableBig {
home.stateVersion = "19.09";
programs.firefox.enable = true;
@ -27,5 +26,4 @@ with lib;
home-path/bin/firefox \
MOZ_APP_LAUNCHER
'';
};
}