mirror of
https://github.com/NixOS/nix.git
synced 2025-11-10 20:46:01 +01:00
Give unit tests access to a $HOME directory
Also, don't try to access cache.nixos.org in the libstore unit tests.
This commit is contained in:
parent
6bf997e0bd
commit
01388b3e78
5 changed files with 18 additions and 38 deletions
|
|
@ -60,6 +60,7 @@ test(
|
|||
env : {
|
||||
'_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data',
|
||||
'NIX_CONFIG': 'extra-experimental-features = flakes',
|
||||
'HOME': meson.current_build_dir() / 'test-home',
|
||||
},
|
||||
protocol : 'gtest',
|
||||
)
|
||||
|
|
|
|||
|
|
@ -56,18 +56,14 @@ mkMesonExecutable (finalAttrs: {
|
|||
{
|
||||
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}
|
||||
export NIX_CONFIG="extra-experimental-features = flakes"
|
||||
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
|
||||
touch $out
|
||||
''
|
||||
);
|
||||
(''
|
||||
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
|
||||
export NIX_CONFIG="extra-experimental-features = flakes"
|
||||
export HOME="$TMPDIR/home"
|
||||
mkdir -p "$HOME"
|
||||
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
|
||||
touch $out
|
||||
'');
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue