mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Merge 02e5588bf9
into f9afc1e68c
This commit is contained in:
commit
261e35c2d8
5 changed files with 18 additions and 38 deletions
|
@ -60,6 +60,7 @@ test(
|
||||||
env : {
|
env : {
|
||||||
'_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data',
|
'_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data',
|
||||||
'NIX_CONFIG': 'extra-experimental-features = flakes',
|
'NIX_CONFIG': 'extra-experimental-features = flakes',
|
||||||
|
'HOME': meson.current_build_dir() / 'test-home',
|
||||||
},
|
},
|
||||||
protocol : 'gtest',
|
protocol : 'gtest',
|
||||||
)
|
)
|
||||||
|
|
|
@ -56,18 +56,14 @@ mkMesonExecutable (finalAttrs: {
|
||||||
{
|
{
|
||||||
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
|
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
|
||||||
}
|
}
|
||||||
(
|
(''
|
||||||
lib.optionalString stdenv.hostPlatform.isWindows ''
|
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
|
||||||
export HOME="$PWD/home-dir"
|
export NIX_CONFIG="extra-experimental-features = flakes"
|
||||||
mkdir -p "$HOME"
|
export HOME="$TMPDIR/home"
|
||||||
''
|
mkdir -p "$HOME"
|
||||||
+ ''
|
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
|
||||||
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
|
touch $out
|
||||||
export NIX_CONFIG="extra-experimental-features = flakes"
|
'');
|
||||||
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
|
|
||||||
touch $out
|
|
||||||
''
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ test(
|
||||||
this_exe,
|
this_exe,
|
||||||
env : {
|
env : {
|
||||||
'_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data',
|
'_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data',
|
||||||
|
'HOME': meson.current_build_dir() / 'test-home',
|
||||||
},
|
},
|
||||||
protocol : 'gtest',
|
protocol : 'gtest',
|
||||||
)
|
)
|
||||||
|
|
|
@ -28,10 +28,6 @@ TEST_F(nix_api_store_test, nix_store_get_uri)
|
||||||
|
|
||||||
TEST_F(nix_api_util_context, nix_store_get_storedir_default)
|
TEST_F(nix_api_util_context, nix_store_get_storedir_default)
|
||||||
{
|
{
|
||||||
if (nix::getEnv("HOME").value_or("") == "/homeless-shelter") {
|
|
||||||
// skipping test in sandbox because nix_store_open tries to create /nix/var/nix/profiles
|
|
||||||
GTEST_SKIP();
|
|
||||||
}
|
|
||||||
nix_libstore_init(ctx);
|
nix_libstore_init(ctx);
|
||||||
Store * store = nix_store_open(ctx, nullptr, nullptr);
|
Store * store = nix_store_open(ctx, nullptr, nullptr);
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
|
@ -136,10 +132,6 @@ TEST_F(nix_api_store_test, nix_store_real_path)
|
||||||
|
|
||||||
TEST_F(nix_api_util_context, nix_store_real_path_relocated)
|
TEST_F(nix_api_util_context, nix_store_real_path_relocated)
|
||||||
{
|
{
|
||||||
if (nix::getEnv("HOME").value_or("") == "/homeless-shelter") {
|
|
||||||
// Can't open default store from within sandbox
|
|
||||||
GTEST_SKIP();
|
|
||||||
}
|
|
||||||
auto tmp = nix::createTempDir();
|
auto tmp = nix::createTempDir();
|
||||||
std::string storeRoot = tmp + "/store";
|
std::string storeRoot = tmp + "/store";
|
||||||
std::string stateDir = tmp + "/state";
|
std::string stateDir = tmp + "/state";
|
||||||
|
@ -179,13 +171,7 @@ TEST_F(nix_api_util_context, nix_store_real_path_relocated)
|
||||||
|
|
||||||
TEST_F(nix_api_util_context, nix_store_real_path_binary_cache)
|
TEST_F(nix_api_util_context, nix_store_real_path_binary_cache)
|
||||||
{
|
{
|
||||||
if (nix::getEnv("HOME").value_or("") == "/homeless-shelter") {
|
Store * store = nix_store_open(ctx, nix::fmt("file://%s/binary-cache", nix::createTempDir()).c_str(), nullptr);
|
||||||
// TODO: override NIX_CACHE_HOME?
|
|
||||||
// skipping test in sandbox because narinfo cache can't be written
|
|
||||||
GTEST_SKIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
Store * store = nix_store_open(ctx, "https://cache.nixos.org", nullptr);
|
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
ASSERT_NE(store, nullptr);
|
ASSERT_NE(store, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -73,17 +73,13 @@ mkMesonExecutable (finalAttrs: {
|
||||||
{
|
{
|
||||||
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
|
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
|
||||||
}
|
}
|
||||||
(
|
(''
|
||||||
lib.optionalString stdenv.hostPlatform.isWindows ''
|
export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"}
|
||||||
export HOME="$PWD/home-dir"
|
export HOME="$TMPDIR/home"
|
||||||
mkdir -p "$HOME"
|
mkdir -p "$HOME"
|
||||||
''
|
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
|
||||||
+ ''
|
touch $out
|
||||||
export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"}
|
'');
|
||||||
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
|
|
||||||
touch $out
|
|
||||||
''
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue