mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
[Backport release-25.05] lib/tests/test-with-nix: run misc.nix and fetchers.nix tests in the derivation (#434761)
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
# Throws an error if any of our lib tests fail.
|
||||
|
||||
let
|
||||
tests = [
|
||||
"misc"
|
||||
"systems"
|
||||
];
|
||||
all = builtins.concatLists (map (f: import (./. + "/${f}.nix")) tests);
|
||||
in
|
||||
if all == [ ] then null else throw (builtins.toJSON all)
|
||||
@@ -145,6 +145,11 @@ let
|
||||
inherit expected;
|
||||
};
|
||||
|
||||
dummyDerivation = derivation {
|
||||
name = "name";
|
||||
builder = "builder";
|
||||
system = "system";
|
||||
};
|
||||
in
|
||||
|
||||
runTests {
|
||||
@@ -782,18 +787,8 @@ runTests {
|
||||
};
|
||||
|
||||
testSplitStringsDerivation = {
|
||||
expr = take 3 (
|
||||
strings.splitString "/" (derivation {
|
||||
name = "name";
|
||||
builder = "builder";
|
||||
system = "system";
|
||||
})
|
||||
);
|
||||
expected = [
|
||||
""
|
||||
"nix"
|
||||
"store"
|
||||
];
|
||||
expr = lib.dropEnd 1 (strings.splitString "/" dummyDerivation);
|
||||
expected = strings.splitString "/" builtins.storeDir;
|
||||
};
|
||||
|
||||
testSplitVersionSingle = {
|
||||
@@ -841,7 +836,7 @@ runTests {
|
||||
in
|
||||
{
|
||||
storePath = isStorePath goodPath;
|
||||
storePathDerivation = isStorePath (import ../.. { system = "x86_64-linux"; }).hello;
|
||||
storePathDerivation = isStorePath dummyDerivation;
|
||||
storePathAppendix = isStorePath "${goodPath}/bin/python";
|
||||
nonAbsolute = isStorePath (concatStrings (tail (stringToCharacters goodPath)));
|
||||
asPath = isStorePath (/. + goodPath);
|
||||
@@ -926,7 +921,7 @@ runTests {
|
||||
};
|
||||
|
||||
testHasInfixDerivation = {
|
||||
expr = hasInfix "hello" (import ../.. { system = "x86_64-linux"; }).hello;
|
||||
expr = hasInfix "name" dummyDerivation;
|
||||
expected = true;
|
||||
};
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}"
|
||||
{
|
||||
buildInputs = [
|
||||
(import ./check-eval.nix)
|
||||
(import ./fetchers.nix)
|
||||
(import ../path/tests {
|
||||
inherit pkgs;
|
||||
})
|
||||
@@ -71,6 +69,12 @@ pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}"
|
||||
echo "Running lib/tests/systems.nix"
|
||||
[[ $(nix-instantiate --eval --strict lib/tests/systems.nix | tee /dev/stderr) == '[ ]' ]];
|
||||
|
||||
echo "Running lib/tests/misc.nix"
|
||||
[[ $(nix-instantiate --eval --strict lib/tests/misc.nix | tee /dev/stderr) == '[ ]' ]];
|
||||
|
||||
echo "Running lib/tests/fetchers.nix"
|
||||
[[ $(nix-instantiate --eval --strict lib/tests/fetchers.nix | tee /dev/stderr) == '[ ]' ]];
|
||||
|
||||
mkdir $out
|
||||
echo success > $out/${nix.version}
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user