Run unit tests with wine

Fix #10547

The tests do not all run successfully, but that is a separate issue.
This commit is contained in:
John Ericson 2024-07-21 12:57:49 -04:00
parent dc6dbbc1a5
commit eea63d5f99
5 changed files with 46 additions and 20 deletions

View file

@ -1,4 +1,5 @@
{ lib
, buildPackages
, stdenv
, mkMesonDerivation
, releaseTools
@ -81,17 +82,21 @@ mkMesonDerivation (finalAttrs: {
passthru = {
tests = {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
} (lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
'' + ''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-expr-tests
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
'';
'');
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
};
})

View file

@ -1,4 +1,5 @@
{ lib
, buildPackages
, stdenv
, mkMesonDerivation
, releaseTools
@ -79,17 +80,21 @@ mkMesonDerivation (finalAttrs: {
passthru = {
tests = {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
} (lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
'' + ''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-fetchers-tests
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
'';
'');
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
};
})

View file

@ -1,4 +1,5 @@
{ lib
, buildPackages
, stdenv
, mkMesonDerivation
, releaseTools
@ -79,17 +80,21 @@ mkMesonDerivation (finalAttrs: {
passthru = {
tests = {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
} (lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
'' + ''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-flake-tests
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
'';
'');
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
};
})

View file

@ -1,4 +1,5 @@
{ lib
, buildPackages
, stdenv
, mkMesonDerivation
, releaseTools
@ -92,17 +93,22 @@ mkMesonDerivation (finalAttrs: {
../../functional/derivation
];
};
in runCommand "${finalAttrs.pname}-run" {} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
in runCommand "${finalAttrs.pname}-run" {
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
} (lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
'' + ''
export _NIX_TEST_UNIT_DATA=${data + "/unit/libstore/data"}
nix-store-tests
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
'';
'');
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
};
})

View file

@ -1,4 +1,5 @@
{ lib
, buildPackages
, stdenv
, mkMesonDerivation
, releaseTools
@ -80,17 +81,21 @@ mkMesonDerivation (finalAttrs: {
passthru = {
tests = {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
} (lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
'' + ''
export _NIX_TEST_UNIT_DATA=${./data}
nix-util-tests
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
'';
'');
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
};
})