1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00
Commit graph

2618 commits

Author SHA1 Message Date
Eelco Dolstra 83d5b32803 Add test case for NARs with duplicate directory entries
This test was made by @puckipedia.
2024-09-05 16:41:15 +02:00
John Ericson c7ec33605e Meson misc things
Meson-ify a few things, scripts, completions, etc. Should make our Meson
build complete except for docs.

Co-Authored-By: Qyriad <qyriad@qyriad.me>
Co-Authored-By: eldritch horrors <pennae@lix.systems>
2024-08-27 10:19:55 -04:00
John Ericson a97a08411c More support for std::filepath in libnixutil
We're not replacing `Path` in exposed definitions in many cases, but
just adding alternatives. This will allow us to "top down" change `Path`
to `std::fileysystem::path`, and then we can remove the `Path`-using
utilities which will become unused.

Also add some test files which we forgot to include in the libutil unit
tests `meson.build`.

Co-Authored-By: siddhantCodes <siddhantk232@gmail.com>
2024-08-26 17:23:56 -04:00
Robert Hensing 88998fae74
Merge pull request #11304 from hercules-ci/repl-doc-functor
`:doc`: support `__functor`
2024-08-26 17:20:37 +02:00
tomberek 96a2ddab27
Merge pull request #10910 from hercules-ci/c-api-nix_clear_err
C API: `nix_clear_err`
2024-08-26 10:50:26 -04:00
tomberek 3b6e24f66c
Merge pull request #11346 from mjgallag/nix-profile-daemon-set-u
nix-daemon.sh profile script: operate under `set -u` in bash
2024-08-26 10:49:31 -04:00
tomberek 440de80d34
Merge pull request #11021 from hercules-ci/issue-11010
Fix SSH invocation when local SHELL misbehaves
2024-08-26 10:40:51 -04:00
Eelco Dolstra 9ff0b55d4e Add a VM test for fsync-store-paths
Based on https://github.com/squalus/nix-durability-tests/blob/master/flake.nix.
2024-08-22 15:34:19 +02:00
Eelco Dolstra 9243457cb2 Fix umount failure
Fixes

```
    umount: /tmp/nix-shell.i3xRwX/nix-test/local-overlay-store/delete-refs/stores/merged-store/nix/store: filesystem was unmounted, but failed to update userspace mount table.
make: *** [mk/lib.mk:93: tests/functional/local-overlay-store/delete-refs.sh.test] Error 16
```

in a dev shell.

Note: this previously worked before we didn't have umount in the dev
shell, so we got /run/wrappers/bin/umount.
2024-08-19 17:07:22 +02:00
Robert Hensing 2f0db04da0 tests.installer: Load profile with -o unset
Tested with an ubuntu case. Might need revision depending on what hydra
thinks of the rest.
2024-08-19 16:41:40 +02:00
Robert Hensing 9385383347 Revert "Remove unit tests from old build system"
`make check` was reverted too soon. The hacking guide wasn't brought
up to date with the new workflow, and it's not clear how to use
meson for everything.

This reverts commit 6f3045c2a2.
2024-08-19 15:18:02 +02:00
tomberek 1c5ad159d6
Merge pull request #10980 from kjeremy/flake-show-description
nix flake show: add the description if it exists
2024-08-18 16:31:44 -04:00
Robert Hensing c458598647
Merge pull request #11297 from shivaraj-bh/flake-apps-description
`nix flake show`: Support `meta` attribute for `apps`
2024-08-17 13:12:01 +02:00
shivaraj-bh 2ab93fd5fd nix flake check: Add functional tests for apps and formatter 2024-08-17 15:50:06 +05:30
Robert Hensing d4aa7d5dc7 Use nixosTest.quickBuild behavior by default
This wasn't the default behaviour because:

> We don't enable this by default to avoid the mostly unnecessary work of
> performing an additional build of the package in cases where we build
> the package normally anyway, such as in our pre-merge CI.

Since we have a componentized build, we've solved the duplication.

In the new situation, building both with and without unit tests
isn't any slow than just a build with unit tests, so there's no
point in using the unit-tested build anymore.

By using the otherwise untested build, we reduce the minimum build
time towards the NixOS test, at no cost.

If you want to run all tests, build all attributes.
2024-08-16 21:25:48 -04:00
Robert Hensing a03bb4455c Fix SSH invocation when local SHELL misbehaves
Setting it to /bin/sh will make it more predictable when users have
their favorite shell in SHELL, which might not behave as expected.
For instance, a bad rc file could send something to stdout before
our LocalCommand gets to write "started".

This may help https://github.com/NixOS/nix/issues/11010
2024-08-16 15:53:30 +02:00
Robert Hensing 72a4d1f52d Add :doc support for __functor 2024-08-15 13:04:34 +02:00
John Ericson b41cc1a755 Make wrapper derivation
This ensures just `nix build`-ing the flake doesn't forget to run all
tests. One can still specifiy specific attributes to just build one
thing.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-08-14 18:04:38 -04:00
John Ericson 6f3045c2a2 Remove unit tests from old build system
Now that we can run all tests with Meson, we want developers making code
changes to use it.

(Only the manual needs to be built with the build system, and that will
change shortly.)

This reverts commit b0bc2a97bf.
2024-08-14 16:38:00 -04:00
John Ericson 34fe2478a2 Build Functional tests with Meson
Co-Authored-By: Qyriad <qyriad@qyriad.me>
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-08-14 15:35:40 -04:00
Bryan Honof cc9fe4dee7
Fix a few shellcheck tests
Ref nixos/nix#10795
2024-08-14 15:16:06 +02:00
Robert Hensing 18485d2d53
Merge pull request #11188 from lf-/jade/kill-int-overflow
Ban integer overflow in the Nix language
2024-08-11 04:24:16 +02:00
Jeremy Kolb abbaba9122 Use the window size for the entire length 2024-08-08 14:47:57 -04:00
John Ericson 6c861b9c51 Factor out lookupExecutable and other PATH improvments
This ended up motivating a good deal of other infra improvements in
order to get Windows right:

- `OsString` to complement `std::filesystem::path`

- env var code for working with the underlying `OsString`s

- Rename `PATHNG_LITERAL` to `OS_STR`

- `NativePathTrait` renamed to `OsPathTrait`, given a character template
  parameter until #9205 is complete.

Split `tests.cc` matching split of `util.{cc,hh}` last year.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-08-07 18:12:58 -04:00
John Ericson 9d2d4d11e6 Split tests, organize more string functions
The test split matches PR #8920, so the utility files and tests files
are once again to 1-1. The string changes continues what was started in
PR #11093.
2024-08-05 12:50:13 -04:00
John Ericson 1fce591cbc
Merge pull request #11255 from DeterminateSystems/test-s3-binary-cache-store
Add a VM test for S3BinaryCacheStore
2024-08-05 11:12:08 -05:00
Jeremy Kolb 930818bb1d Account for total length of 80 2024-08-05 11:02:56 -04:00
Jeremy Kolb f22cf1fd38 Handle long strings, embedded new lines and empty descriptions 2024-08-05 11:02:55 -04:00
Jeremy Kolb 59b6aafadb add tests 2024-08-05 11:02:55 -04:00
Eelco Dolstra 2950f9e18a Add a VM test for S3BinaryCacheStore
Fixes #11238.
2024-08-05 11:48:50 +02:00
tomberek ea1f87ecda
Merge pull request #11145 from rhendric/rhendric/parser-lalr
Make parser LALR, conflict-free
2024-08-04 03:59:10 -04:00
Valentin Gagarin db5bacb637
reword documentation on nix-path config option (#7772)
* docs: unify documentation on search paths

- put all the information on search path semantics into `builtins.findFile`
- put all the information on determining the value of `builtins.nixPath` into the
  `nix-path` setting

  maybe `builtins.nixPath` is a better place for this, but those bits
  can still be moved around now that it's all next to each other.
- link to the syntax page for lookup paths from all places that are
  concerned with it
- add or clarify examples
- add a test verifying a claim from documentation
2024-07-31 21:41:26 +02:00
Eelco Dolstra ed0934b884
Merge pull request #11140 from DeterminateSystems/protocol-features
WorkerProto: Support fine-grained protocol feature negotiation
2024-07-31 17:47:38 +02:00
Jade Lovelace 7b6622d733 language: cleanly ban integer overflows
This also bans various sneaking of negative numbers from the language
into unsuspecting builtins as was exposed while auditing the
consequences of changing the Nix language integer type to a newtype.

It's unlikely that this change comprehensively ensures correctness when
passing integers out of the Nix language and we should probably add a
checked-narrowing function or something similar, but that's out of scope
for the immediate change.

During the development of this I found a few fun facts about the
language:
- You could overflow integers by converting from unsigned JSON values.
- You could overflow unsigned integers by converting negative numbers
  into them when going into Nix config, into fetchTree, and into flake
  inputs.

  The flake inputs and Nix config cannot actually be tested properly
  since they both ban thunks, however, we put in checks anyway because
  it's possible these could somehow be used to do such shenanigans some
  other way.

Note that Lix has banned Nix language integer overflows since the very
first public beta, but threw a SIGILL about them because we run with
-fsanitize=signed-overflow -fsanitize-undefined-trap-on-error in
production builds. Since the Nix language uses signed integers, overflow
was simply undefined behaviour, and since we defined that to trap, it
did.

Trapping on it was a bad UX, but we didn't even entirely notice
that we had done this at all until it was reported as a bug a couple of
months later (which is, to be fair, that flag working as intended), and
it's got enough production time that, aside from code that is IMHO buggy
(and which is, in any case, not in nixpkgs) such as
https://git.lix.systems/lix-project/lix/issues/445, we don't think
anyone doing anything reasonable actually depends on wrapping overflow.

Even for weird use cases such as doing funny bit crimes, it doesn't make
sense IMO to have wrapping behaviour, since two's complement arithmetic
overflow behaviour is so *aggressively* not what you want for *any* kind
of mathematics/algorithms. The Nix language exists for package
management, a domain where bit crimes are already only dubiously in
scope to begin with, and it makes a lot more sense for that domain for
the integers to never lose precision, either by throwing errors if they
would, or by being arbitrary-precision.

Fixes: https://github.com/NixOS/nix/issues/10968
Original-CL: https://gerrit.lix.systems/c/lix/+/1596

Change-Id: I51f253840c4af2ea5422b8a420aa5fafbf8fae75
2024-07-30 18:13:05 -07:00
Jade Lovelace e28cb67d41 libutil: add checked arithmetic tools
This is in preparation for adding checked arithmetic to the evaluator.

Change-Id: I6e115ce8f5411feda1706624977a4dcd5efd4d13
2024-07-30 18:13:05 -07:00
Pino Toscano a1ccf60613 tests: define fallback PATH_MAX
Few filesystem-related tests rely on PATH_MAX for buffers, and PATH_MAX
is optional in POSIX (and not available on the Hurd). To make them build
and pass, provide a fallback definition of PATH_MAX in case not
available.

Ideally speaking, the tests ought to not unconditionally rely on
PATH_MAX, do alternative strategies (e.g. dynamically allocate buffers,
expand them as needed, etc); OTOH this is test code, so it would be more
work that what it would be worth, so IMHO the define fallback is good
enough.
2024-07-30 05:34:34 +02:00
Eelco Dolstra 0b96c586e0
Merge pull request #11195 from DeterminateSystems/tarball-roots
Improve handling of tarballs that don't consist of a single top-level directory
2024-07-29 16:58:59 +02:00
Eelco Dolstra 7c18b4d060 Don't dereference top-level regular files
Since this yielded an empty directory as far back as Nix 2.3, we don't
really need special handling for executables vs non-executables.
2024-07-29 14:34:02 +02:00
Eelco Dolstra e0012b97ab Split tarball-specific logic from GitFileSystemObjectSink 2024-07-29 14:26:25 +02:00
Robert Hensing 7c5a0b06a4 tests/nixos/remote-builds: Wait for multi-user
This should make the test more robust, considering the strange hang
in https://hydra.nixos.org/build/267517233/nixlog/8

`builder` seems to have reached `multi-user.target` before the
SSH connection was established, but this seems to be coincidental.
This does tell us that enforcing this has a minimal cost in terms
of runtime.

Waiting for `multi-user.target` on the client is honestly paranoid,
but flaky tests are very bad for productivity.
2024-07-27 13:08:30 +02:00
Robert Hensing f4464873f5 tests/nixos/remote-builds: Print hello world to stderr
Trying to learn more about enigmatic spurious hang at
https://hydra.nixos.org/build/267517233/nixlog/8
- builder1 seems to have started properly
- ssh connection and session are established
- ssh client doesn't exit or client.succeed does not return
  for some reason.

Seeing the stdout on the console might give a tiny bit more info.
2024-07-27 13:01:56 +02:00
Robert Hensing 861bd102a6
Merge pull request #11167 from NixOS/repl-test-rejiggle
Fix repl test for `buildReadlineNoMarkdown`
2024-07-27 00:55:57 +02:00
Eelco Dolstra 5e83c0427f Fix test 2024-07-26 20:46:07 +02:00
Eelco Dolstra 06b686b62d Handle tarballs that don't consist of a single top-level directory
Fixes #4785 (top-level directories are no longer merged into one).

Fixes #10983 (top-level non-directories are no longer discarded).
2024-07-26 20:24:58 +02:00
Ryan Hendrickson 6e3b9e6a4d parser.y: eliminate conflicts 2024-07-25 15:48:58 -04:00
Robert Hensing 6ec123ad6b
Merge pull request #11131 from rhendric/rhendric/pipe-operators
libexpr: experimental pipe operators
2024-07-25 16:58:43 +02:00
Robert Hensing 76f04b4146
Merge pull request #11111 from NixOS/grep-safety-AGAIN
Grep newline safety
2024-07-25 16:30:33 +02:00
Robert Hensing baa28159d3
Update tests/functional/test-infra.sh
Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
2024-07-25 15:38:02 +02:00
John Ericson 36252fed6b
Merge pull request #11176 from obsidiansystems/flake-test-group
Put flake functional tests in their own group
2024-07-25 02:41:11 -04:00
Robert Hensing 6662c9012d
Merge pull request #11177 from obsidiansystems/skip-exit-code
Change skipped test error code from 99 to 77
2024-07-25 06:59:18 +02:00