summary refs log tree commit diff
path: root/lib/tests
Commit message (Collapse)AuthorAge
* Merge pull request #147077 from Infinisil/updateAttrPathsRobert Hensing2022-03-19
|\ | | | | Introduce `lib.updateManyAttrsByPath`
| * lib.attrsets: Introduce updateManyAttrsByPathSilvan Mosberger2022-03-18
| |
| * lib.lists: Use builtins.groupBy for lib.groupBySilvan Mosberger2022-03-18
| | | | | | | | | | builtins.groupBy is much more performant. It was introduced in https://github.com/NixOS/nix/pull/5715
| * lib.attrsets: Introduce showAttrPathSilvan Mosberger2022-03-18
| |
* | Merge pull request #161158 from a-m-joseph/mips64el-support-first-stepsJohn Ericson2022-03-17
|\ \ | | | | | | mips64el support
| * | lib/systems: add mips64el definitionsAdam Joseph2022-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MIPS has a large space of {architecture,abi,endianness}; this commit adds all of them to lib/systems/platforms.nix so we can be done with it. Currently lib/systems/inspect.nix has a single "isMips" predicate, which is a bit ambiguous now that we will have both mips32 and mips64 support, with the latter having two ABIs. Let's add four new predicates (isMips32, isMips64, isMips64n32, and isMips64n64) and treat the now-ambiguous isMips as deprecated in favor of the more-specific predicates. These predicates are used mainly for enabling/disabling target-specific workarounds, and it is extremely rare that a platform-specific workaround is needed, and both mips32 and mips64 need exactly the same workaround. The separate predicates (isMips64n32 and isMips64n64) for ABI distinctions are, unfortunately, useful. Boost's user-scheduled threading (used by nix) does does not currently supports mips64n32, which is a very desirable ABI on routers since they rarely have more than 2**32 bytes of DRAM.
* | | Merge pull request #156533 from ↵Silvan Mosberger2022-03-16
|\ \ \ | |/ / |/| | | | | | | | hercules-ci/issue-146882-transparent-submodule-options lib.modules: Let module declare options directly in bare submodule
| * | lib/tests/modules: Add test case for duplicate option error file locationRobert Hensing2022-03-07
| | |
| * | lib.modules: Make option injection work when shorthandOnlyDefinesConfigRobert Hensing2022-03-03
| | |
| * | lib.modules: Improve option-is-prefix error messageRobert Hensing2022-03-03
| | |
| * | lib.modules: Let module declare options directly in bare submoduleRobert Hensing2022-03-03
| |/ | | | | | | | | | | | | | | | | | | ... where a bare submodule is an option that has a type like `submoduleWith x`, as opposed to `attrsOf (submoduleWith x)`. This makes migration unnecessary when introducing a freeform type in an existing option tree. Closes #146882
* / lib.types.optionType: Only merge when necessaryRobert Hensing2022-03-10
|/
* lib.modules: Use types.optionType for _module.freeformTypeSilvan Mosberger2022-03-01
| | | | | | | | | | | | | This ensures that the module file locations are propagated to the freeform type, which makes it so that submodules in freeform types now have their declaration location shown in the manual, fixing https://github.com/NixOS/nixpkgs/issues/132085. In addition, this also newly allows freeformTypes to be declared multiple times and all declarations being merged together according to normal option merging. This also removes some awkwardness regarding the type of `freeformType`
* lib.types: Introduce `types.optionType`Silvan Mosberger2022-03-01
| | | | | | This type correctly merges multiple option types together while also annotating them with file information. In a future commit this will be used for `_module.freeformType`
* lib/types: Introduce types.raw for unprocessed valuesSilvan Mosberger2022-02-22
|
* lib/tests: Add tests for emptyValueSilvan Mosberger2022-02-17
|
* lib: fix flake checkzimbatm2021-12-13
| | | | | | | | | | | | | | | | | | | | `builtins.currentSystem` is not available in pure eval. For this particular test, we don't really care since it's all about generating .drv files. Fixes the following error: $ nix flake check warning: unknown flake output 'lib' error: attribute 'currentSystem' missing at /nix/store/8wvnlbjxlr90kq2qa6d9zjpj8rqkilr5-source/lib/tests/misc.nix:499:73: 498| let 499| deriv = derivation { name = "test"; builder = "/bin/sh"; system = builtins.currentSystem; }; | ^ 500| in { (use '--show-trace' to show detailed location informat
* Merge pull request #144022 from hercules-ci/lib-modules-optimize-unmatchedDefnsSilvan Mosberger2021-12-07
|\ | | | | lib/modules: Short-circuit unmatchedDefns when configs is empty
| * lib/tests/modules: Test non-strictness some moreRobert Hensing2021-11-03
| | | | | | | | | | Doesn't seem to have been a problem actually, but now it won't regress.
* | lib/tests: Use standard test syntaxVictor Engmark2021-11-26
| | | | | | | | For consistency.
* | lib/tests: Anchor config output regexesVictor Engmark2021-11-26
| | | | | | | | Strengthens the tests by making sure the whole line is matched.
* | lib/tests: Set hardening pragmasVictor Engmark2021-11-26
| | | | | | | | | | | | | | | | | | | | | | | | Makes any programming errors more likely to show up early. Non-obvious changes because of this: - Ignore the `evalConfig` result in `reportFailure`; we're not checking it at that point. - Pre-increment `$fail` and `$pass` to make sure the arithmetic doesn't result in a zero, which would result in a non-zero exit code for the expression.
* | lib/tests: Don't return non-zero values from checksVictor Engmark2021-11-26
| | | | | | | | The exit codes aren't used for anything.
* | lib/tests: Avoid assigning an array to a stringVictor Engmark2021-11-26
| | | | | | | | As per <https://github.com/koalaman/shellcheck/wiki/SC2124>.
* | lib/tests: Remove redundant semicolonsVictor Engmark2021-11-26
| |
* | lib/tests: Clarify assignmentVictor Engmark2021-11-26
| | | | | | | | The extra equal sign was confusing, and doesn't seem to be relevant.
* | lib/tests: Use correct shebang lineVictor Engmark2021-11-26
| | | | | | | | | | The script uses plenty of non-POSIX features, such as referencing `$BASH_SOURCE`.
* | lib/tests: Quote variable referencesVictor Engmark2021-11-26
| |
* | lib/tests: `export` separately from assignmentVictor Engmark2021-11-26
| | | | | | | | | | Avoids hiding the exit code from the assignment. See <https://github.com/koalaman/shellcheck/wiki/SC2155>.
* | modules: Add moduleType to module argumentsRobert Hensing2021-11-22
| |
* | lib/tests/sources: update to Nix 2.4 cli syntaxBernardo Meurer2021-11-09
| |
* | lib/tests/modules.sh: update to Nix 2.4 syntaxBernardo Meurer2021-11-09
| |
* | lib.evalModules: Add extendModules and type to resultRobert Hensing2021-11-01
|/ | | | | | | Allows the simultaneous construction of top-level invocations and submodule types. This helps structure configuration systems integration code.
* Merge pull request #140284 from Infinisil/types-anything-lambdasSilvan Mosberger2021-10-05
|\ | | | | lib/types: Make types.anything merge functions
| * lib/types: Make types.anything merge functionsSilvan Mosberger2021-10-02
| | | | | | | | | | Previously it would give an error if there were multiple function definitions.
* | Merge pull request #140136 from rnhmjoj/matrix-idsMichele Guerini Rocco2021-10-03
|\ \ | | | | | | maintainers/maintainers-list: add Matrix IDs
| * | lib/tests/maintainers: add matrix optionrnhmjoj2021-10-01
| | |
* | | lib: add function escapeXMLRobert Helgesson2021-10-03
|/ / | | | | | | | | Given a string, this function returns a string that can be inserted verbatim in an XML document.
* | Merge pull request #131205 from Ma27/showdefs-overflowLinus Heckemann2021-09-29
|\ \ | |/ |/| lib/modules: improve errors for `options`/`config`-mixups
| * lib/generators: move limit detection into `withRecursion`Maximilian Bosch2021-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | | As suggested in #131205. Now it's possible to pretty-print a value with `lib.generators` like this: with lib.generators; toPretty { } (withRecursion { depthLimit = 10; } /* arbitrarily complex value */) Also, this can be used for any other pretty-printer now if needed.
| * lib/generators/toPretty: add evaluation-limitMaximilian Bosch2021-08-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When having e.g. recursive attr-set, it cannot be printed which is solved by Nix itself like this: $ nix-instantiate --eval -E 'let a.b = 1; a.c = a; in builtins.trace a 1' trace: { b = 1; c = <CYCLE>; } 1 However, `generators.toPretty` tries to evaluate something until it's done which can result in a spurious `stack-overflow`-error: $ nix-instantiate --eval -E 'with import <nixpkgs/lib>; generators.toPretty { } (mkOption { type = types.str; })' error: stack overflow (possible infinite recursion) Those attr-sets are in fact rather common, one example is shown above, a `types.<type>`-declaration is such an example. By adding an optional `depthLimit`-argument, `toPretty` will stop evaluating as soon as the limit is reached: $ nix-instantiate --eval -E 'with import ./Projects/nixpkgs-update-int/lib; generators.toPretty { depthLimit = 2; } (mkOption { type = types.str; })' |xargs -0 echo -e "{ _type = \"option\"; type = { _type = \"option-type\"; check = <function>; deprecationMessage = null; description = \"string\"; emptyValue = { }; functor = { binOp = <unevaluated>; name = <unevaluated>; payload = <unevaluated>; type = <unevaluated>; wrapped = <unevaluated>; }; getSubModules = null; getSubOptions = <function>; merge = <function>; name = \"str\"; nestedTypes = { }; substSubModules = <function>; typeMerge = <function>; }; }" Optionally, it's also possible to let `toPretty` throw an error if the limit is exceeded.
* | lib/systems: add minimal s390x-linux cross-compile supportSergei Trofimovich2021-09-09
|/ | | | | | | | | | | Tested basic functionality as: $ nix-build --arg crossSystem '{ config = "s390x-unknown-linux-gnu"; }' -A re2c $ file ./result/bin/re2c $ ./result/bin/re2c: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), dynamically linked, interpreter ...-gnu-2.33-50/lib/ld64.so.1, for GNU/Linux 2.6.32, not stripped $ qemu-s390x ./result/bin/re2c --version re2c 2.2
* treewide: runCommandNoCC -> runCommandRobert Hensing2021-08-15
| | | | This has been synonymous for ~5y.
* Merge pull request #131267 from blaggacao/fix-functionArgsSilvan Mosberger2021-08-04
|\ | | | | lib: fix functionArgs for functors
| * lib: fix functionArgs for functorsDavid Arnold2021-08-03
| | | | | | | | | | | | `functionArgs` should give valid results on functions that have been identified with `lib.isFunction` instead of erroring out.
* | lib.systems: add m68k-netbsd supportAlyssa Ross2021-08-01
|/ | | | | | | m68k was recently added for Linux and none, but NetBSD also supports m68k. Nothing will build yet, but I want to make sure we at least encode the existence of NetBSD support for every applicable architecture we support for other operating systems.
* Initial implementation of s390 cross-compileBen Siraphob2021-07-25
|
* Initial implementation of m68k cross-compileBen Siraphob2021-07-24
|
* lib/tests/sources.sh: initRobert Hensing2021-05-29
|
* Revert "lib/tests: Add type deprecation tests"Robert Hensing2021-05-05
| | | | This reverts commit 8b957e3b301d748e6fbbed806d82bd9d4b9d4ac4.