mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 06:30:28 +00:00
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:
parent
adaea605db
commit
5f00024e75
7 changed files with 151 additions and 144 deletions
13
tests/big-test.nix
Normal file
13
tests/big-test.nix
Normal 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.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -26,7 +26,9 @@ let
|
||||||
# unnecessary rebuilds of the tests.
|
# unnecessary rebuilds of the tests.
|
||||||
manual.manpages.enable = false;
|
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/browserpass
|
||||||
./modules/programs/dircolors
|
./modules/programs/dircolors
|
||||||
./modules/programs/direnv
|
./modules/programs/direnv
|
||||||
|
./modules/programs/emacs
|
||||||
./modules/programs/feh
|
./modules/programs/feh
|
||||||
./modules/programs/fish
|
./modules/programs/fish
|
||||||
./modules/programs/gh
|
./modules/programs/gh
|
||||||
|
@ -101,6 +104,7 @@ import nmt {
|
||||||
] ++ lib.optionals isLinux [
|
] ++ lib.optionals isLinux [
|
||||||
./modules/config/i18n
|
./modules/config/i18n
|
||||||
./modules/i18n/input-method
|
./modules/i18n/input-method
|
||||||
|
./modules/misc/debug
|
||||||
./modules/misc/gtk
|
./modules/misc/gtk
|
||||||
./modules/misc/numlock
|
./modules/misc/numlock
|
||||||
./modules/misc/pam
|
./modules/misc/pam
|
||||||
|
@ -109,6 +113,7 @@ import nmt {
|
||||||
./modules/misc/xsession
|
./modules/misc/xsession
|
||||||
./modules/programs/abook
|
./modules/programs/abook
|
||||||
./modules/programs/autorandr
|
./modules/programs/autorandr
|
||||||
|
./modules/programs/firefox
|
||||||
./modules/programs/foot
|
./modules/programs/foot
|
||||||
./modules/programs/getmail
|
./modules/programs/getmail
|
||||||
./modules/programs/gnome-terminal
|
./modules/programs/gnome-terminal
|
||||||
|
@ -152,10 +157,5 @@ import nmt {
|
||||||
./modules/services/xsettingsd
|
./modules/services/xsettingsd
|
||||||
./modules/systemd
|
./modules/systemd
|
||||||
./modules/targets-linux
|
./modules/targets-linux
|
||||||
] ++ lib.optionals enableBig [
|
|
||||||
./modules/programs/emacs
|
|
||||||
] ++ lib.optionals (enableBig && isLinux) [
|
|
||||||
./modules/misc/debug
|
|
||||||
./modules/programs/firefox
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,26 @@
|
||||||
{
|
{
|
||||||
debug = { pkgs, config, lib, ... }: {
|
debug = { pkgs, config, lib, ... }:
|
||||||
home.enableDebugInfo = true;
|
lib.mkIf config.test.enableBig {
|
||||||
home.packages = with pkgs; [ curl gdb ];
|
home.enableDebugInfo = true;
|
||||||
|
home.packages = with pkgs; [ curl gdb ];
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
[ -L $TESTED/home-path/lib/debug/curl ] \
|
[ -L $TESTED/home-path/lib/debug/curl ] \
|
||||||
|| fail "Debug-symbols for pkgs.curl should exist in \`/home-path/lib/debug'!"
|
|| fail "Debug-symbols for pkgs.curl should exist in \`/home-path/lib/debug'!"
|
||||||
|
|
||||||
#source $TESTED/home-path/etc/profile.d/hm-session-vars.sh
|
#source $TESTED/home-path/etc/profile.d/hm-session-vars.sh
|
||||||
#[[ "$NIX_DEBUG_INFO_DIRS" =~ /lib/debug$ ]] \
|
#[[ "$NIX_DEBUG_INFO_DIRS" =~ /lib/debug$ ]] \
|
||||||
#|| fail "Invalid NIX_DEBUG_INFO_DIRS!"
|
#|| fail "Invalid NIX_DEBUG_INFO_DIRS!"
|
||||||
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
||||||
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
'NIX_DEBUG_INFO_DIRS=.*/lib/debug'
|
'NIX_DEBUG_INFO_DIRS=.*/lib/debug'
|
||||||
|
|
||||||
# We need to override NIX_DEBUG_INFO_DIRS here as $HOME evalutes to the home
|
# We need to override NIX_DEBUG_INFO_DIRS here as $HOME evalutes to the home
|
||||||
# of the user who executes this testcase :/
|
# of the user who executes this testcase :/
|
||||||
{ echo quit | PATH="$TESTED/home-path/bin''${PATH:+:}$PATH" NIX_DEBUG_INFO_DIRS=$TESTED/home-path/lib/debug \
|
{ echo quit | PATH="$TESTED/home-path/bin''${PATH:+:}$PATH" NIX_DEBUG_INFO_DIRS=$TESTED/home-path/lib/debug \
|
||||||
gdb curl 2>&1 | \
|
gdb curl 2>&1 | \
|
||||||
grep 'Reading symbols from ${builtins.storeDir}/'; \
|
grep 'Reading symbols from ${builtins.storeDir}/'; \
|
||||||
} || fail "Failed to read debug symbols from curl in gdb"
|
} || fail "Failed to read debug symbols from curl in gdb"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ let
|
||||||
|
|
||||||
emacsBin = "${config.programs.emacs.finalPackage}/bin/emacs";
|
emacsBin = "${config.programs.emacs.finalPackage}/bin/emacs";
|
||||||
|
|
||||||
in {
|
in lib.mkIf config.test.enableBig {
|
||||||
programs.emacs = {
|
programs.emacs = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.emacs-nox;
|
package = pkgs.emacs-nox;
|
||||||
|
|
|
@ -2,37 +2,35 @@
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
{
|
lib.mkIf config.test.enableBig {
|
||||||
config = {
|
programs.firefox = {
|
||||||
programs.firefox = {
|
enable = true;
|
||||||
enable = true;
|
enableGnomeExtensions = true;
|
||||||
enableGnomeExtensions = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(self: super: {
|
|
||||||
firefox-unwrapped = pkgs.runCommandLocal "firefox-0" {
|
|
||||||
meta.description = "I pretend to be Firefox";
|
|
||||||
passthru.gtk3 = null;
|
|
||||||
} ''
|
|
||||||
mkdir -p "$out"/{bin,lib}
|
|
||||||
touch "$out/bin/firefox"
|
|
||||||
chmod 755 "$out/bin/firefox"
|
|
||||||
'';
|
|
||||||
|
|
||||||
chrome-gnome-shell =
|
|
||||||
pkgs.runCommandLocal "dummy-chrome-gnome-shell" { } ''
|
|
||||||
mkdir -p $out/lib/mozilla/native-messaging-hosts
|
|
||||||
touch $out/lib/mozilla/native-messaging-hosts/dummy
|
|
||||||
'';
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
test.asserts.warnings.expected = [''
|
|
||||||
Using 'programs.firefox.enableGnomeExtensions' has been deprecated and
|
|
||||||
will be removed in the future. Please change to overriding the package
|
|
||||||
configuration using 'programs.firefox.package' instead. You can refer to
|
|
||||||
its example for how to do this.
|
|
||||||
''];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(self: super: {
|
||||||
|
firefox-unwrapped = pkgs.runCommandLocal "firefox-0" {
|
||||||
|
meta.description = "I pretend to be Firefox";
|
||||||
|
passthru.gtk3 = null;
|
||||||
|
} ''
|
||||||
|
mkdir -p "$out"/{bin,lib}
|
||||||
|
touch "$out/bin/firefox"
|
||||||
|
chmod 755 "$out/bin/firefox"
|
||||||
|
'';
|
||||||
|
|
||||||
|
chrome-gnome-shell =
|
||||||
|
pkgs.runCommandLocal "dummy-chrome-gnome-shell" { } ''
|
||||||
|
mkdir -p $out/lib/mozilla/native-messaging-hosts
|
||||||
|
touch $out/lib/mozilla/native-messaging-hosts/dummy
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
test.asserts.warnings.expected = [''
|
||||||
|
Using 'programs.firefox.enableGnomeExtensions' has been deprecated and
|
||||||
|
will be removed in the future. Please change to overriding the package
|
||||||
|
configuration using 'programs.firefox.package' instead. You can refer to
|
||||||
|
its example for how to do this.
|
||||||
|
''];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,70 +2,67 @@
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
{
|
lib.mkIf config.test.enableBig {
|
||||||
config = {
|
programs.firefox = {
|
||||||
programs.firefox = {
|
enable = true;
|
||||||
enable = true;
|
profiles.basic.isDefault = true;
|
||||||
profiles.basic.isDefault = true;
|
|
||||||
|
|
||||||
profiles.test = {
|
profiles.test = {
|
||||||
id = 1;
|
id = 1;
|
||||||
settings = { "general.smoothScroll" = false; };
|
settings = { "general.smoothScroll" = false; };
|
||||||
};
|
|
||||||
|
|
||||||
profiles.bookmarks = {
|
|
||||||
id = 2;
|
|
||||||
settings = { "general.smoothScroll" = false; };
|
|
||||||
bookmarks = {
|
|
||||||
wikipedia = {
|
|
||||||
keyword = "wiki";
|
|
||||||
url =
|
|
||||||
"https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
|
|
||||||
};
|
|
||||||
"kernel.org" = { url = "https://www.kernel.org"; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
profiles.bookmarks = {
|
||||||
(self: super: {
|
id = 2;
|
||||||
firefox-unwrapped = pkgs.runCommand "firefox-0" {
|
settings = { "general.smoothScroll" = false; };
|
||||||
meta.description = "I pretend to be Firefox";
|
bookmarks = {
|
||||||
preferLocalBuild = true;
|
wikipedia = {
|
||||||
passthru.gtk3 = null;
|
keyword = "wiki";
|
||||||
} ''
|
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
|
||||||
mkdir -p "$out"/{bin,lib}
|
};
|
||||||
touch "$out/bin/firefox"
|
"kernel.org" = { url = "https://www.kernel.org"; };
|
||||||
chmod 755 "$out/bin/firefox"
|
};
|
||||||
'';
|
};
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
nmt.script = ''
|
|
||||||
assertFileRegex \
|
|
||||||
home-path/bin/firefox \
|
|
||||||
MOZ_APP_LAUNCHER
|
|
||||||
|
|
||||||
assertDirectoryExists home-files/.mozilla/firefox/basic
|
|
||||||
|
|
||||||
assertFileContent \
|
|
||||||
home-files/.mozilla/firefox/test/user.js \
|
|
||||||
${./profile-settings-expected-user.js}
|
|
||||||
|
|
||||||
bookmarksUserJs=$(normalizeStorePaths \
|
|
||||||
home-files/.mozilla/firefox/bookmarks/user.js)
|
|
||||||
|
|
||||||
assertFileContent \
|
|
||||||
$bookmarksUserJs \
|
|
||||||
${./profile-settings-expected-bookmarks-user.js}
|
|
||||||
|
|
||||||
bookmarksFile="$(sed -n \
|
|
||||||
'/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \
|
|
||||||
$TESTED/home-files/.mozilla/firefox/bookmarks/user.js)"
|
|
||||||
|
|
||||||
assertFileContent \
|
|
||||||
$bookmarksFile \
|
|
||||||
${./profile-settings-expected-bookmarks.html}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(self: super: {
|
||||||
|
firefox-unwrapped = pkgs.runCommand "firefox-0" {
|
||||||
|
meta.description = "I pretend to be Firefox";
|
||||||
|
preferLocalBuild = true;
|
||||||
|
passthru.gtk3 = null;
|
||||||
|
} ''
|
||||||
|
mkdir -p "$out"/{bin,lib}
|
||||||
|
touch "$out/bin/firefox"
|
||||||
|
chmod 755 "$out/bin/firefox"
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileRegex \
|
||||||
|
home-path/bin/firefox \
|
||||||
|
MOZ_APP_LAUNCHER
|
||||||
|
|
||||||
|
assertDirectoryExists home-files/.mozilla/firefox/basic
|
||||||
|
|
||||||
|
assertFileContent \
|
||||||
|
home-files/.mozilla/firefox/test/user.js \
|
||||||
|
${./profile-settings-expected-user.js}
|
||||||
|
|
||||||
|
bookmarksUserJs=$(normalizeStorePaths \
|
||||||
|
home-files/.mozilla/firefox/bookmarks/user.js)
|
||||||
|
|
||||||
|
assertFileContent \
|
||||||
|
$bookmarksUserJs \
|
||||||
|
${./profile-settings-expected-bookmarks-user.js}
|
||||||
|
|
||||||
|
bookmarksFile="$(sed -n \
|
||||||
|
'/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \
|
||||||
|
$TESTED/home-files/.mozilla/firefox/bookmarks/user.js)"
|
||||||
|
|
||||||
|
assertFileContent \
|
||||||
|
$bookmarksFile \
|
||||||
|
${./profile-settings-expected-bookmarks.html}
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,30 +2,28 @@
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
{
|
lib.mkIf config.test.enableBig {
|
||||||
config = {
|
home.stateVersion = "19.09";
|
||||||
home.stateVersion = "19.09";
|
|
||||||
|
|
||||||
programs.firefox.enable = true;
|
programs.firefox.enable = true;
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(self: super: {
|
(self: super: {
|
||||||
firefox-unwrapped = pkgs.runCommand "firefox-0" {
|
firefox-unwrapped = pkgs.runCommand "firefox-0" {
|
||||||
meta.description = "I pretend to be Firefox";
|
meta.description = "I pretend to be Firefox";
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
passthru.gtk3 = null;
|
passthru.gtk3 = null;
|
||||||
} ''
|
} ''
|
||||||
mkdir -p "$out"/{bin,lib}
|
mkdir -p "$out"/{bin,lib}
|
||||||
touch "$out/bin/firefox"
|
touch "$out/bin/firefox"
|
||||||
chmod 755 "$out/bin/firefox"
|
chmod 755 "$out/bin/firefox"
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileRegex \
|
assertFileRegex \
|
||||||
home-path/bin/firefox \
|
home-path/bin/firefox \
|
||||||
MOZ_APP_LAUNCHER
|
MOZ_APP_LAUNCHER
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue