mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
Revert "tests: Allow to test multiple derivations in a single test derivation"
This reverts commit 71126bfebe
.
This commit is contained in:
parent
9688ef723f
commit
c52ba67856
2 changed files with 25 additions and 66 deletions
|
@ -7,7 +7,7 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
fetchTests = import ./fetch-tests.nix;
|
fetchTests = import ./fetch-tests.nix;
|
||||||
test-derivation = import ./test-derivation.nix { inherit pkgs makeNixvimWithModule lib; };
|
test-derivation = import ./test-derivation.nix { inherit pkgs makeNixvimWithModule; };
|
||||||
inherit (test-derivation) mkTestDerivationFromNixvimModule;
|
inherit (test-derivation) mkTestDerivationFromNixvimModule;
|
||||||
|
|
||||||
# List of files containing configurations
|
# List of files containing configurations
|
||||||
|
|
|
@ -1,63 +1,40 @@
|
||||||
{
|
{ pkgs, makeNixvimWithModule, ... }:
|
||||||
pkgs,
|
|
||||||
lib ? pkgs.lib,
|
|
||||||
makeNixvimWithModule,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
let
|
||||||
# Create a nix derivation from a nixvim executable.
|
# Create a nix derivation from a nixvim executable.
|
||||||
# The build phase simply consists in running the provided nvim binary.
|
# The build phase simply consists in running the provided nvim binary.
|
||||||
mkTestDerivationFromNvim =
|
mkTestDerivationFromNvim =
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
nvim ? null,
|
nvim,
|
||||||
tests ? [ ],
|
|
||||||
dontRun ? false,
|
dontRun ? false,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
# At least one of these should be undefined
|
|
||||||
assert lib.assertMsg (tests == [ ] || nvim == null) "Both nvim & tests can't be supplied";
|
|
||||||
let
|
|
||||||
nvimAsList = lib.optional (nvim != null) {
|
|
||||||
derivation = nvim;
|
|
||||||
inherit name dontRun;
|
|
||||||
};
|
|
||||||
|
|
||||||
testList = tests ++ nvimAsList;
|
|
||||||
in
|
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
inherit name;
|
inherit name;
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgs.docker-client ];
|
nativeBuildInputs = [
|
||||||
|
nvim
|
||||||
|
pkgs.docker-client
|
||||||
|
];
|
||||||
|
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
# We need to set HOME because neovim will try to create some files
|
# We need to set HOME because neovim will try to create some files
|
||||||
#
|
#
|
||||||
# Because neovim does not return an exitcode when quitting we need to check if there are
|
# Because neovim does not return an exitcode when quitting we need to check if there are
|
||||||
# errors on stderr
|
# errors on stderr
|
||||||
buildPhase = lib.optionalString (!dontRun) (
|
buildPhase =
|
||||||
''
|
if !dontRun then
|
||||||
mkdir -p .cache/nvim
|
''
|
||||||
''
|
mkdir -p .cache/nvim
|
||||||
+ lib.concatStringsSep "\n" (
|
|
||||||
builtins.map (
|
|
||||||
{
|
|
||||||
derivation,
|
|
||||||
name,
|
|
||||||
dontRun ? false,
|
|
||||||
}:
|
|
||||||
lib.optionalString (!dontRun) ''
|
|
||||||
echo "Running test for ${name}"
|
|
||||||
|
|
||||||
output=$(HOME=$(realpath .) ${lib.getExe derivation} -mn --headless "+q" 2>&1 >/dev/null)
|
output=$(HOME=$(realpath .) nvim -mn --headless "+q" 2>&1 >/dev/null)
|
||||||
if [[ -n $output ]]; then
|
if [[ -n $output ]]; then
|
||||||
echo "ERROR: $output"
|
echo "ERROR: $output"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
''
|
''
|
||||||
) testList
|
else
|
||||||
)
|
'''';
|
||||||
);
|
|
||||||
|
|
||||||
# If we don't do this nix is not happy
|
# If we don't do this nix is not happy
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -71,35 +48,17 @@ let
|
||||||
{
|
{
|
||||||
name ? "nixvim-check",
|
name ? "nixvim-check",
|
||||||
pkgs ? pkgs,
|
pkgs ? pkgs,
|
||||||
module ? null,
|
module,
|
||||||
tests ? [ ],
|
|
||||||
extraSpecialArgs ? { },
|
extraSpecialArgs ? { },
|
||||||
dontRun ? false,
|
dontRun ? false,
|
||||||
}:
|
}:
|
||||||
# At least one of these should be undefined
|
|
||||||
assert lib.assertMsg (tests == [ ] || module == null) "Both module & tests can't be supplied";
|
|
||||||
let
|
let
|
||||||
moduleAsList = lib.optional (module != null) { inherit module name; };
|
nvim = makeNixvimWithModule {
|
||||||
moduleList = tests ++ moduleAsList;
|
inherit pkgs module extraSpecialArgs;
|
||||||
testDerivations = builtins.map (
|
_nixvimTests = true;
|
||||||
{
|
};
|
||||||
module,
|
|
||||||
name,
|
|
||||||
dontRun ? false,
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
derivation = makeNixvimWithModule {
|
|
||||||
inherit pkgs module extraSpecialArgs;
|
|
||||||
_nixvimTests = true;
|
|
||||||
};
|
|
||||||
inherit name dontRun;
|
|
||||||
}
|
|
||||||
) moduleList;
|
|
||||||
in
|
in
|
||||||
mkTestDerivationFromNvim {
|
mkTestDerivationFromNvim { inherit name nvim dontRun; };
|
||||||
inherit name dontRun;
|
|
||||||
tests = testDerivations;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit mkTestDerivationFromNvim mkTestDerivationFromNixvimModule;
|
inherit mkTestDerivationFromNvim mkTestDerivationFromNixvimModule;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue