aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/tests
AgeCommit message (Collapse)Author
2021-04-05Merge branch 'master' into path-infoJohn Ericson
2021-03-26Fix some typosEelco Dolstra
Fixes #4671.
2021-03-16Fix Nix to properly work with stores using a scoped IPv6 addressMaximilian Bosch
According to RFC4007[1], IPv6 addresses can have a so-called zone_id separated from the actual address with `%` as delimiter. In contrast to Nix 2.3, the version on `master` doesn't recognize it as such: $ nix ping-store --store ssh://root@fe80::1%18 --experimental-features nix-command warning: 'ping-store' is a deprecated alias for 'store ping' error: --- Error ----------------------------------------------------------------- nix don't know how to open Nix store 'ssh://root@fe80::1%18' I modified the IPv6 match-regex accordingly to optionally detect this part of the address. As we don't seem to do anything special with it, I decided to leave it as part of the URL for now. Fixes #4490 [1] https://tools.ietf.org/html/rfc4007
2021-02-25Merge remote-tracking branch 'upstream/master' into path-infoJohn Ericson
2021-01-21Improve error formattingEelco Dolstra
Changes: * The divider lines are gone. These were in practice a bit confusing, in particular with --show-trace or --keep-going, since then there were multiple lines, suggesting a start/end which wasn't the case. * Instead, multi-line error messages are now indented to align with the prefix (e.g. "error: "). * The 'description' field is gone since we weren't really using it. * 'hint' is renamed to 'msg' since it really wasn't a hint. * The error is now printed *before* the location info. * The 'name' field is no longer printed since most of the time it wasn't very useful since it was just the name of the exception (like EvalError). Ideally in the future this would be a unique, easily googleable error ID (like rustc). * "trace:" is now just "…". This assumes error contexts start with something like "while doing X". Example before: error: --- AssertionError ---------------------------------------------------------------------------------------- nix at: (7:7) in file: /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/default.nix 6| 7| x = assert false; 1; | ^ 8| assertion 'false' failed ----------------------------------------------------- show-trace ----------------------------------------------------- trace: while evaluating the attribute 'x' of the derivation 'hello-2.10' at: (192:11) in file: /home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/make-derivation.nix 191| // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) { 192| name = "${attrs.pname}-${attrs.version}"; | ^ 193| } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) { Example after: error: assertion 'false' failed at: (7:7) in file: /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/default.nix 6| 7| x = assert false; 1; | ^ 8| … while evaluating the attribute 'x' of the derivation 'hello-2.10' at: (192:11) in file: /home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/make-derivation.nix 191| // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) { 192| name = "${attrs.pname}-${attrs.version}"; | ^ 193| } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) {
2021-01-08Fix testsEelco Dolstra
2020-12-22Fix testsEelco Dolstra
2020-11-16filterANSIEscapes(): Handle UTF-8 charactersEelco Dolstra
2020-10-30Fix testEelco Dolstra
2020-10-15Add missing include for MAX_PATHJohn Ericson
And remove one that we didn't actually need to add
2020-10-07Use PathReferences more widelyJohn Ericson
2020-09-16fixup! Add a default value for the settingsregnat
2020-08-31Merge remote-tracking branch 'origin/master' into markdownEelco Dolstra
2020-08-25Fix testsEelco Dolstra
2020-08-24Fix testsEelco Dolstra
2020-07-26libutil/logging: extend `internal-json` logger to make it more machine-readableMaximilian Bosch
The new error-format is pretty nice from a UX point-of-view, however it's fairly hard to parse the output e.g. for editor plugins such as vim-ale[1] that use `nix-instantiate --parse` to determine syntax errors in Nix expression files. This patch extends the `internal-json` logger by adding the fields `line`, `column` and `file` to easily locate an error in a file and the field `raw_msg` which contains the error-message itself without code-lines and additional helpers. An exemplary output may look like this: ``` [nix-shell]$ ./inst/bin/nix-instantiate ~/test.nix --log-format minimal {"action":"msg","column":1,"file":"/home/ma27/test.nix","level":0,"line":4,"raw_msg":"syntax error, unexpected IF, expecting $end","msg":"<full error-msg with code-lines etc>"} ``` [1] https://github.com/dense-analysis/ale
2020-07-06revamp trace code and testBen Burdette
2020-07-02move showTrace to new loggerSettingsBen Burdette
2020-07-01spacingBen Burdette
2020-07-01non-pos trace testBen Burdette
2020-06-30fix tests with the 'from string' changeBen Burdette
2020-06-30Merge branch 'master' into add-traceBen Burdette
2020-06-30invalid pos checkBen Burdette
2020-06-29showTrace flag in loggersBen Burdette
2020-06-25showTrace flag for ErrorInfo; showTrace test.Ben Burdette
2020-06-24add trace test; error formatting refinementsBen Burdette
2020-06-23use plain errPos instead of nixCode; fix testsBen Burdette
2020-06-23re-add Pos origin in testsBen Burdette
2020-06-22with normaltxt, elide yellow color code instead of canceling it; use ↵Ben Burdette
normaltxt on plain_string hintfmt
2020-06-19tidying upBen Burdette
2020-06-19fmt -> hintfmt testBen Burdette
2020-06-19too few, too many argsBen Burdette
2020-06-19add hintfmt testBen Burdette
2020-06-19Merge remote-tracking branch 'upstream/master' into no-hash-type-unknownJohn Ericson
2020-06-19Merge pull request #3669 from gilligan/add-compression-testsEelco Dolstra
Add compression unit tests
2020-06-18Revert the `enum struct` changeJohn Ericson
Not a regular git revert as there have been many merges and things.
2020-06-18Merge branch 'enum-class' into no-hash-type-unknownJohn Ericson
2020-06-18Merge remote-tracking branch 'upstream/master' into enum-classJohn Ericson
2020-06-16Fix logging unit testsTobias Pflug
2020-06-15Merge branch 'errors-phase-2' of https://github.com/bburdette/nixEelco Dolstra
2020-06-12Merge pull request #3670 from gilligan/add-pool-testsEelco Dolstra
Add tests for pool.hh
2020-06-11Merge remote-tracking branch 'upstream/master' into errors-phase-2Ben Burdette
2020-06-10Add tests for pool.hhTobias Pflug
2020-06-08Add compression unit testsTobias Pflug
2020-06-07set verbosity levelsBen Burdette
2020-06-06Add tests for logging.hhTobias Pflug
2020-06-03libutils/hash: remove default encodingzimbatm
This will make it easier to reason about the hash encoding and switch to SRI everywhere where possible.
2020-06-02Remove `hashingWithUnknownAlgoExits`John Ericson
A valid hash type must be provided now. The hash itself can still be invalid, but that doesn't cause an `abort()`.
2020-06-02Merge remote-tracking branch 'upstream/master' into no-hash-type-unknownJohn Ericson
2020-06-02Remove `HashType::Unknown`John Ericson
Instead, `Hash` uses `std::optional<HashType>`. In the future, we may also make `Hash` itself require a known hash type, encoraging people to use `std::optional<Hash>` instead.