aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2024-05-31build: fix static linking with a hackQyriad
This causes libstore, libexpr, libfetchers, and libutil to be linked with -Wl,--whole-archive to executables, when building statically. libstore for the store backends, libexpr for the primops, libfetchers for the fetcher backends I assume(?), and libutil for the nix::logger initializer (which notably shows in pre-main constructors when HOME is not owned by the user. cursed.). This workaround should be removed when #359 is fixed. Fixes #306. Change-Id: Ie9ef0154e09a6ed97920ee8ab23810ca5e2de84c
2024-05-31Merge changes Ifcb0d310,I664366b8,Ibe7cf546 into mainjade
* changes: gitignore: delete 90% of it build-time: remove 20% more by PCH'ing C++ stdlib shellHook: make it actually run
2024-05-31libstore/build: copy ca-certificates tooAlois Wohlschlager
In b469c6509ba616da6df8a27e4ccb205a877c66c9, the ca-certificates file was missed. It should be copied too so that we don't end up bind-mounting a broken symlink. Change-Id: Ic9b292d602eb94b0e78f77f2a27a19d24665783c
2024-05-30build-time: remove 20% more by PCH'ing C++ stdlibJade Lovelace
It seems like someone implemented precompiled headers a long time ago and then it never got ported to meson or maybe didn't work at all. This is, however, blessedly easy to simply implement. I went looking for `#define` that could affect the result of precompiling the headers, and as far as I can tell we aren't doing any of that, so this should truly just be free build time savings. Previous state: Compilation (551 times): Parsing (frontend): 1302.1 s Codegen & opts (backend): 956.3 s New state: **** Time summary: Compilation (567 times): Parsing (frontend): 1123.0 s Codegen & opts (backend): 1078.1 s I wonder if the "regression" in codegen time is just doing the PCH operation a few times, because meson does it per-target. Change-Id: I664366b8069bab4851308b3a7571bea97ac64022
2024-05-30Merge "Revert "tests/filetransfer: reënable on Darwin"" into mainjade
2024-05-30Revert "tests/filetransfer: reënable on Darwin"jade
This reverts commit 285bc67318e2ee4b69b13eb0b8e7b202fc287c51. Reason for revert: https://git.lix.systems/lix-project/lix/issues/364 For some reason this broke `main` even though the change we are reverting passed CI! Mysterious, haunted, etc. Needs more debugging, let's turn it off for now. Change-Id: Ica4819d61cd35b83eb52985bfcb657e858f025a9
2024-05-30Merge "tests/filetransfer: reënable on Darwin" into mainjade
2024-05-29tests/filetransfer: reënable on DarwinJade Lovelace
Since we put __darwinAllowLocalNetworking in our derivation in I752b81c85ebeaab4e582ac01c239d69d65580f37, this stuff will just work fine. I checked our derivation works on the darwin community builder. Change-Id: I40e3a801d6bb38efede79af4aded65c1e1f57cec
2024-05-30libutil/args: warn on unknown settings after parsing all flagsCole Helbling
Upstream change: https://github.com/NixOS/nix/pull/10701 Change-Id: Icf271df57ec529dd8c64667d1ef9f6dbf02d33d3
2024-05-30Merge changes from topic "libutil-split" into mainjade
* changes: util.hh: Delete remaining file and clean up headers util.hh: Move nativeSystem to local-derivation-goal.cc util.hh: Move stuff to types.hh util.cc: Delete remaining file util.{hh,cc}: Move ignoreException to error.{hh,cc} util.{hh,cc}: Split out namespaces.{hh,cc} util.{hh,cc}: Split out users.{hh,cc} util.{hh,cc}: Split out strings.{hh,cc} util.{hh,cc}: Split out unix-domain-socket.{hh,cc} util.{hh,cc}: Split out child.{hh,cc} util.{hh,cc}: Split out current-process.{hh,cc} util.{hh,cc}: Split out processes.{hh,cc} util.{hh,cc}: Split out file-descriptor.{hh,cc} util.{hh,cc}: Split out file-system.{hh,cc} util.{hh,cc}: Split out terminal.{hh,cc} util.{hh,cc}: Split out environment-variables.{hh,cc}
2024-05-29Merge "tests: fix functional-timeout" into mainMario Rodas
2024-05-29libstore: fix http abuses no longer workingeldritch horrors
while refactoring the curl wrapper we inadvertently broken the immutable flake protocol, because the immutable flake protocol accumulates headers across the entire redirect chain instead of using only the headers given in the final response of the chain. this is a problem because Some Known Providers Of Flake Infrastructure set rel=immutable link headers only in the penultimate entry of the redirect chain, and curl does not regard it as worth returning to us via its response header enumeration mechanisms. fixes https://git.lix.systems/lix-project/lix/issues/358 Change-Id: I645c3932b465cde848bd6a3565925a1e3cbcdda0
2024-05-29util.hh: Delete remaining file and clean up headersTom Hubrecht
Change-Id: Ic1f68e6af658e94ef7922841dd3ad4c69551ef56
2024-05-29util.{hh,cc}: Split out strings.{hh,cc}Tom Hubrecht
Change-Id: I4f642d1046d56b5db26f1b0296ee16a0e02d444a
2024-05-29util.{hh,cc}: Split out processes.{hh,cc}Tom Hubrecht
Change-Id: I39280dc40ca3f7f9007bc6c898ffcf760e2238b7
2024-05-29util.{hh,cc}: Split out file-descriptor.{hh,cc}Tom Hubrecht
Change-Id: I0dd0f9a9c2003fb887e076127e7f825fd3289c76
2024-05-29util.{hh,cc}: Split out file-system.{hh,cc}Tom Hubrecht
Change-Id: Ifa89a529e7e34e7291eca87d802d2f569cf2493e
2024-05-29util.{hh,cc}: Split out terminal.{hh,cc}Tom Hubrecht
Change-Id: I9de2296b4012d50f540124001d54d6ca3be4c6da
2024-05-28util.{hh,cc}: Split out environment-variables.{hh,cc}Tom Hubrecht
Change-Id: Icff0aa33fda5147bd5dbe256a0b9d6a6c8a2c3f6
2024-05-28tests: fix functional-timeoutMario Rodas
grepQuietInvert is a typo introduced by c11836126b5. The test functional-timeout was failing silently because Bash considered the command-not-found error as truthy. Change-Id: Ic13829d02ec55d6ecd63a0f4d34ec0d32379609f
2024-05-25Merge "libstore/build: always enable seccomp filtering and ↵alois31
no-new-privileges" into main
2024-05-24libstore/build: always enable seccomp filtering and no-new-privilegesAlois Wohlschlager
Seccomp filtering and the no-new-privileges functionality improve the security of the sandbox, and have been enabled by default for a long time. In https://git.lix.systems/lix-project/lix/issues/265 it was decided that they should be enabled unconditionally. Accordingly, remove the allow-new-privileges (which had weird behavior anyway) and filter-syscall settings, and force the security features on. Syscall filtering can still be enabled at build time to support building on architectures libseccomp doesn't support. Change-Id: Iedbfa18d720ae557dee07a24f69b2520f30119cb
2024-05-24libfetchers: log fetches by URL just before they happenQyriad
Addresses but does not close #305, as we still need an indicator for frozen fetches. Change-Id: Iba34ad42dc1c8772f7da249b90fe794b041bbf73
2024-05-24Merge "nixos/tests: enable remoteBuilds tests against Nix 2.18" into mainPierre Bourdon
2024-05-23Merge changes I462a8cf0,I3b0bcea3,I2acd56e7,Ifc149764,I9e2ef170 into mainQyriad
* changes: docs: linkify nix3-build mention in nix-build.md build: make internal-api-docs PHONY cleanup lookupFileArg add docstring to lookupFileArg add libcmd test for lookupFileArg
2024-05-23packaging: rename nixexpr -> lixexpr and so onJade Lovelace
This breaks downstreams linking to us on purpose to make sure that if someone is linking to Lix they're doing it on purpose and crucially not mixing up Nix and Lix versions in compatibility code. We still need to fix the internal includes to follow the same schema so we can drop the single-level include system entirely. However, this requires a little more effort. This adds pkg-config for libfetchers and config.h. Migration path: expr.hh -> lix/libexpr/expr.hh nix/config.h -> lix/config.h To apply this migration automatically, remove all `<nix/>` from includes, so: `#include <nix/expr.hh>` -> `#include <expr.hh>`. Then, the correct paths will be resolved from the tangled mess, and the clang-tidy automated fix will work. Then run the following for out of tree projects: ``` lix_root=$HOME/lix (cd $lix_root/clang-tidy && nix develop -c 'meson setup build && ninja -C build') run-clang-tidy -checks='-*,lix-fixincludes' -load=$lix_root/clang-tidy/build/liblix-clang-tidy.so -p build/ -fix src ``` Related: https://git.lix.systems/lix-project/nix-eval-jobs/pulls/5 Fixes: https://git.lix.systems/lix-project/lix/issues/279 Change-Id: I7498e903afa6850a731ef8ce77a70da6b2b46966
2024-05-23add libcmd test for lookupFileArgQyriad
Change-Id: I9e2ef170ffe916f902daec8b5630d29434c5d5f2
2024-05-23nixos/tests: enable remoteBuilds tests against Nix 2.18Pierre Bourdon
Fixes #321. Change-Id: I60812aec9f9b68ab742413835c581d3b53432b9b
2024-05-18Merge "derived-path: refuse built derived path with a non-derivation base" ↵Pierre Bourdon
into main
2024-05-18Deprecate the online flake registries and vendor the default registryjulia
Fixes #183, #110, #116. The default flake-registry option becomes 'vendored', and refers to a vendored flake-registry.json file in the install path. Vendored copy of the flake-registry is from github:NixOS/flake-registry at commit 9c69f7bd2363e71fe5cd7f608113290c7614dcdd. Change-Id: I752b81c85ebeaab4e582ac01c239d69d65580f37
2024-05-17derived-path: refuse built derived path with a non-derivation basePierre Bourdon
Example: /nix/store/dr53sp25hyfsnzjpm8mh3r3y36vrw3ng-neovim-0.9.5^out This is nonsensical since selecting outputs can only be done for a buildable derivation, not for a realised store path. The build worker side of things ends up crashing with an assertion when trying to handle such malformed paths. Change-Id: Ia3587c71fe3da5bea45d4e506e1be4dd62291ddf
2024-05-16Allow enabling core dumps from builds for nix & child processesmidnightveil
Fixes https://git.lix.systems/lix-project/lix/issues/268 Change-Id: I3f1b0ddf064f891cca8b53229c5c31c74cea3d9f
2024-05-15Merge "nix3-build: show all FOD errors with `--keep-going`" into mainMaximilian Bosch
2024-05-15nix3-build: show all FOD errors with `--keep-going`Maximilian Bosch
Basically I'd expect the same behavior as with `nix-build`, i.e. with `--keep-going` the hash-mismatch error of each failing fixed-output derivation is shown. The approach is derived from `Store::buildPaths` (`entry-point.cc`): instead of throwing the first build-result, check if there are any build errors and if so, display all of them and throw after that. Unfortunately, the BuildResult struct doesn't have an `ErrorInfo` (there's a FIXME for that at least), so I have to construct my own here. This is a rather cheap bugfix and I decided against touching too many parts of libstore for that (also I don't know if that's in line with the ongoing refactoring work). Closes https://git.lix.systems/lix-project/lix/issues/302 Change-Id: I378ab984fa271e6808c6897c45e0f070eb4c6fac
2024-05-12tests: don't build test plugin shared libs on static buildsPierre Bourdon
This changes the way plugins.sh is excluded to remove the need for BUILD_SHARED_LIBS along the way. Change-Id: I19fe55b4a37c49a11fffa61c8a3be7e8d1a51b4d
2024-05-12Merge "libstore: Fix sandbox=relaxed" into mainArtemis Tosini
2024-05-11filetransfer: unit test content-encoding handlingPierre Bourdon
Very basic behavior test to ensure that gzip data gets internally decompressed by the file transfer pipeline. Change a std::string_view return value in the test harness to std::string. I wouldn't call myself a C++ beginner and I still managed to shoot myself in the foot like three times with the lifetime managements there (e.g. [&] { return an_std_string; } ends up with a dangling string_view!). Change-Id: I1360750d4181ce1ca2a3aa4dc0e97e131351c469
2024-05-10libstore: de-callback-ify FileTransfereldritch horrors
also add a few more tests for exception propagation behavior. using packaged_tasks and futures (which only allow a single call to a few of their methods) introduces error paths that weren't there before. Change-Id: I42ca5236f156fefec17df972f6e9be45989cf805
2024-05-08nix3-eval: don't elide top-level errorsQyriad
Fixes #276. Change-Id: I83e71beb5c35d6f3b10a4186caa5e52a2f95b510
2024-05-08libstore: Fix sandbox=relaxedThéophane Hufschmitt
The fix for the Darwin vulnerability in ecdbc3b207eaec1a2cafd2a0d494bcbabdd60a11 also broke setting `__sandboxProfile` when `sandbox=relaxed` or `sandbox=false`. This cppnix change fixes `sandbox=relaxed` and adds a suitable test. Co-Authored-By: Artemis Tosini <lix@artem.ist> Co-Authored-By: Eelco Dolstra <edolstra@gmail.com> Change-Id: I40190f44f3e1d61846df1c7b89677c20a1488522
2024-05-07remove the autoconf+Make buildsystemQyriad
We're not using it anymore. Any leftover bugs in the Meson buildsystem are now just bugs. Closes #249. Change-Id: I0465a0c37ae819f94d40e7829f5bff046aa63d73
2024-05-07Merge changes Icf26010a,Ib6161567 into mainNikodem Rabuliński
* changes: Always initialize curl in parent process on darwin Fix failing darwin tests
2024-05-07libutil: de-callback-ify computeClosureeldritch horrors
only two users of this function exist. only one used it in a way that even bears resemblance to asynchronicity, and even that one didn't do it right. fully async and parallel computation would have only worked if any getEdgesAsync never calls the continuation it receives itself, only from more derived callbacks running on other threads. calling it directly would cause the decoupling promise to be awaited immediately *on the original thread*, completely negating all nice async effects. Change-Id: I0aa640950cf327533a32dee410105efdabb448df
2024-05-06Fix failing darwin testsNikodem Rabuliński
Some tests were failing on darwin, if the auto-allocate-uids featrure was enabled. This was because AAU on darwin works by setuid-ing as a non-existent user, so the tests that were relying on `whoami` were failing. In the case of trusted-users we fall back to printing the user id, which is already handled gracefully in the daemon code - i.e. when a user does not exist or for some other reason looking up their username is not possible, the daemon falls back to searching for their uid inside the trusted-users list. When whoami is used to print the username for other purpose, we default to printing nixbld. Change-Id: Ib61615677565098cb5fbf5e26a946ef427c58caf
2024-05-05filetransfer: abort transfer on receiver exceptioneldritch horrors
not doing this will cause transfers that had their readers disappear to linger. with lingering transfers the curl thread can't shut down, which will cause nix itself to not shut down until the transfer finishes some other way (most likely network timeouts). also add a new test for this. Change-Id: Id2401b3ac85731c824db05918d4079125be25b57
2024-05-05Merge "tests/flakes/follow-paths: test that warning about non-existent input ↵Maximilian Bosch
works recursively" into main
2024-05-04Fix /etc/group having desynced IDs from the actual UID in the sandboxJade Lovelace
This was found when `logrotate.conf` failed to build in a NixOS system with: /nix/store/26zdl4pyw5qazppj8if5lm8bjzxlc07l-coreutils-9.3/bin/id: cannot find name for group ID 30000 This was surprising because it seemed to mean that /etc/group was busted in the sandbox. Indeed it was: root:x:0: nixbld:!:100: nogroup:x:65534: We diagnosed this to sandboxUid() being called before usingUserNamespace() was called, in setting up /etc/group inside the sandbox. This code desperately needs refactoring. We also moved the /etc/group code to be with the /etc/passwd code, but honestly this code is all spaghetti'd all over the place and needs some more serious tidying than we did here. We also moved some checks to be earlier to improve locality with where the things they are checking come from. Change-Id: Ie29798771f3593c46ec313a32960fa955054aceb
2024-05-04Merge "tests: actually run mercurial tests" into mainMaximilian Bosch
2024-05-04tests: actually run mercurial testsMaximilian Bosch
The binary to check for is called hg not hq. Change-Id: I812a30f9347d5bf0573cdacc3fc887960887ee92
2024-05-04Merge "Revert "Revert "Merge pull request #6621 from Kha/nested-follows""" ↵Maximilian Bosch
into main