the test is for the map that usually wraps it though because it's the
bit we're interested in replacing, and it has custom serializer code.
Change-Id: If77a236dfca738b646ed2b7a5c65515dad6b7295
the old protocols are largely untested, mostly unused, and have design
problems that make the RPC transition a lot harder, if not impossible.
in theory we could ship a transparent protocol-converting proxy that'd
isolate the daemon itself from old protocol versions, but that's a lot
of code to maintain for presumably little gain or even no gain at all.
Change-Id: I4c3f3bb34d39044f6aeb07c10caaf13b8340a220
All changes are uniform and done with the same script, so checking only
some should suffice. For that reason, any tests involving multiple files
or custom CLI flags are not included in this commit.
Change-Id: Ib2d0e08937b56e241d99771a58aad34ed3ad308a
The current `RelativeTo` design is both more complex and more confusing
than necessary. Its four variants are now reduced to only two. They are
now also represented as different classes, to better communicate the
difference in semantics and also intent.
Change-Id: Ia60fc7a2dfa0f62bdef90dde347fd8603fd3fbf9
Previously, paths not being deleted by gcDeleteSpecific would result in
(a) hardlinks not being cleaned up, and
(b) statistics not being reported correctly.
By throwing the error later, we fix both of these problems.
Change-Id: I8019f3e10d9f22e81ea87bb26b77f04ebc888a19
By default, xfail tests will always "pass" when the test fails,
disrecsarding any restrictions put on them via their parameters.
By enabling the `xfail_strict` option, xfails won't pass anymore when
the failstate is different from what is described in their parameters.
Change-Id: Ifea6e27d716d91f60210e6ba24175074fa39c304
Remote binary caches support `write-nar-listing` options where they create a `HASH.ls` file for quick indexing without having to download the nar.
This commit makes experimental `nix store ls` attempt to read these files instead of downloading the full nar.
The difference is very obvious with large packages like stellarium:
nix store ls --store "https://cache.nixos.org" /nix/store/ijpvwgs9zamqaax5dy2cd0kxgz7lr7an-stellarium-25.1 -R
Change-Id: I6a37e0788b3a91c319331a8de69c51daf3efa955
Add Documentation for usage and development within functional2
including common fixtures and where to find them
This is done to make the migration from functional easier and give devs
a reference for how one writes tests
Change-Id: I6ee73e654d245fd4ad43e495d1172e406313cb23
This creates a framework similar to the old lang.sh from functional.
Some notable changes:
- instead of having a .flags file, a test.toml can declare flags
- additionally the test.toml can also declare extra files and multiple
runners for the given input file.
- there won't be any old tests hanging around anymore which weren't
deleted properly in the installation
- all files for a single test are defined decleratively and there won't
be any residues
Tests can be placed within the functional2/lang folder
most migrations should be rather clean
Implements: #825
Change-Id: I5f9149903ec5b078008969a4ae77305417c11475
Currently, tests are marked as "passed" when golden files are updated.
With this change, the tests are marked as skipped instead.
Additionally finally introduces tests to check if the snapshot behaves
as expected
Change-Id: I438eed70e0b94d561e99cc1e0363092809da827e
Add utils for general-use functions and paths
Additionally introduces a pytest_command fixture, which creates a
testing environment for pytest within the tmp_path. This allows for
encapsulated testing of our frameworks (i.e. snapshot, lang etc)
Change-Id: Ic0a5bc4bfc0b0bfbac15bc51dd4a94fae6ee6f26
allow to pass absolute paths or similar Path entries to declaration of
files instead of just string paths relative to the requesting file
Change-Id: I616da6abbb73d1d63ead370e9ae37a401d85f42d
Due to how meson works with the current justfile options, it is not
possible to pass additional arguments into the functional2 test
suit/pytest.
Due to that, it isn't possilbe to narrow down what tests to execute or
add output options or similar.
This commit adds an additional recipe, calling pytest directly ensuring
arguments are handed through
Change-Id: I3748d1cd5fddc16b11fff11c0f1a77195e37c837
The first auto-GC request would not be registered as a waiter due to a logic
error. As a result, if that request was synchronous (as happens during
evaluation) it would be stuck forever waiting on a promise that will never be
fulfilled.
Register also the first request properly so that it is notified and unblocked
again when the GC has finished. Also add a test verifying that auto-GC
triggering during evaluation will not get stuck.
Fixes: https://git.lix.systems/lix-project/lix/issues/844
Change-Id: I157afdc737415261e48d6d01d46c586a2927a1ad
The custom subcommand test fixture used to replace the environment
with PATH prepended with the directory of the subcommand.
This caused the tests to fail on darwin with auto-allocate-uids
enabled, as the dynamic users aren't added to the user database
inside the sandbox, as opposed to linux.
Other environments were unaffected because the build user is a real user
with a database entry and HOME set.
Update the environment instead, also preserving hermetic env
created earlier by NixCommand constructor.
Change-Id: I7e59fd69ff13d1d395316d857b63a356e1648159
The experimental `nix eval` command already supports a `--raw` flag.
This commit implements the same flag for the stable nix-instantiate command.
Until now instructions and scripts that didn't want to rely on experimental
features had to use workarounds such as:
nix-instantiate --eval <something> | tr -d \"
(which also undesirably also removes double quotation marks within the string), or
nix-instantiate --eval <something> | jq -j
(which undesirably depends on another package).
Co-authored-by: Raito Bezarius <raito@lix.systems>
Co-authored-by: Silvan Mosberger <silvan.mosberger@tweag.io>
Change-Id: Iced9a80ee7edd60af2385c5193485f1774175339
`fetchGit` has been modified a long time ago to use fetchTree, however,
we don't care about `lastModified` because we are not in a flake
context, this hack introduces a `git-locked` type of input that only
cares about `narHash` being present. This is needed to avoid fetching
the remote repo each time `fetchGit` is evaluated whith the result
present in the store.
Change-Id: I521c6fcccf8cf12945594f205d7fd4c8c2cf89e9
The coerce integer feature was not rebased before merge and we do not
have a merge queue, hence, after merge, the HEAD was in a broken state.
We take a commitment to invest into a merge queue now and do a fixup
here.
Change-Id: Ied9410690b542359859ab5f597f22ebceb857305
Signed-off-by: Raito Bezarius <raito@lix.systems>
When assigning an a value to NIX_GET_COMPLETIONS that could not be
parsed as an integer lix would just crash, as the value was directly
passed to stoi, without handling the return value.
This change switches the parsing to use string2Int and throws an
exception if the return value is empty.
The behaviour of lix is slightly changed through, as the value of the
variable was previously parsed to an int and then assigned to a variable
of size_t.
This change in behaviour can only be observed in cases where the
value of NIX_GET_COMPLETIONS is chosen so when it overflows it would
be valid index of the provided arguments again.
Through this change the variable is parsed as a size_t and negative
values are rejected.
Change-Id: Idf7c5740274c6e07d5bb13d7e2ed32764bfc27f8
When using completion, the number of the word for which the shell
requests completion is provided in the environment variable
`NIX_GET_COMPLETIONS`. When the number smaller than 1 is or larger
than the number of arguments nix coredumps as a assert is violated.
This change removes the assert and instead throws an exception informing
the user that their autocomplete is most likely misconfigured.
Change-Id: I821719e470e576b6f63c06beb097338b53d183e0
This introduces a new (demanded?) feature for coercing integers in
interpolation arguments under the experimental feature
`coerce-integers`.
This feature is being introduced behind an *experimental feature flag*
due to the cautious approach we're taking. The codebase has a track
record of revealing unexpected behaviors, often in subtle ways, so we
want to give this sufficient time and exposure before making it stable.
To remove the experimental flag, we want to see **at least two releases
or six months of real-world usage -- whichever is longer** -- that
demonstrate strong confidence the feature doesn't introduce regressions
or unintended side effects. If that level of confidence is reached,
we'll proceed to stabilize it.
Change-Id: I825904719eeba8f0e2a93cd6b93cfe6cebd7d827
Signed-off-by: Raito Bezarius <raito@lix.systems>
To print completions lix created a Finally object containing the actual function,
so the function was executed by the destructor of the class.
Unfortunately aborting autocomplete by sending a SIGINT signal
(i.E. by pressing C-c) leads to an exception, that finally cant return or eat,
when throwing its own exception.
To avoid crashing when using auto complete let the function "mainWrapped" execute
the autocomplete code directly before returning.
This avoids creating the "Finally" object and instead moves the codeblock next to
the check to return when "arg.completions" is called.
Change-Id: Id333a60ad43c6095e8866f6953af78d51fd43b64
When calling completion on a nix command containing the word
"--help" nix would first return the entire help page for the
command and then the result of the completion resulting in unusable
output.
By moving the check whether to return when completions were requested
before the check whether help was requested wrappedMain returns
without wrongly printing documentation.
Change-Id: Iedb37434a3ff101f15985319a9a3bcb3f8195796
with_env now overrides the environment, similar to with_stdin
an additional function update_env was created to mirror the prior
functionality of with_env, updating the env
This was changed as previously it was impossible to delete variables
from the env
replaced the code of .ok() with a call to .expect, to remove the code
duplication
Change-Id: I83933893c7f2ccfdc7bd4933b7592b475c435e76
Currently the Command and CommandResult classes are mixed into the nix
fixture file.
This commit moves them out into their own lib file, to make it more
obvious that they can be used standalone for other applications too
Additionally improved documentation of said classes
and bumped log level of stdout and err on unexpected exitcodes, as it is
within an error context
Change-Id: If2d554acde86fd54f2445fc46453f06923af5fe9
That file was written once in 2008 and never updated since, and let's
just say that a lot of things have changed since
Change-Id: I66b0c87ecbba6ca653470966c9514edb21882ca3
Each `inputFromAttrs` is roughly the same function in each class, we
check that the attributes given are correct (in term of keys and other
types) then we coppy the attributes. Instead of having the same code
copied in 10 places, set it in the parent class and specify what is
specific per child class.
Change-Id: If9aecb76cff1e28a1ef6668d83d825686cce8353
Due to nix-store making its paths read-only, pytest was unable to remove
the test files and hence the entire temporary directory, screaming all
over the place in stderr about that, getting worse for each test run.
By making the nix fixture first yield nix and then, after the test
finished running, changing the file permissions to include read on all
files and directories within the temp folder, pytest is able to properly
remove old test runs again
Additionally added more clear instructions for file deletion to the
pytest configuration
Change-Id: Ia7e3d195665968ac80a57d0e525691b28be7f503
Due to https://git.lix.systems/lix-project/lix/issues/832 , Lix 2.93.0
fails to build on Darwin without overrides. Until the root cause has
been determined and fixed, build without LTO.
Change-Id: I4db5eb294d8f19e5a366b1e19efa5a327b3e2e78
It was introduced back in 2013, was disabled in 2014 again for dubious
reasons and according to horrors is unsound anyways and can never really
work.
It was the only disabled test, so I removed the "infrastructure" for
that in the test runner as well. functional2/lang will have much better
ways for skipping tests anyways
Change-Id: Icb8697fb85221e3206fb64cb917c03607ef278a7
Back in the days, this used to be the modus operandi, but then, still
many but less years ago, Eelco came along and changed it to passing in
the actual file. Of course, no motivation was provided, and it was only
done on half of the test runners for some reason, leaving us to wonder
what the true intentions of this code are …
Anyways, with this commit now everything standardises on passing in the
file by path instead of via stdin. Motivation:
- We need to `sed` out the path anyways for various other reasons,
including import tests and path value tests
- Given that, the presumed primary motivation for using stdin in the
first place becomes moot
- Bonus points for giving better error messages, especially in tests
that involve multiple input files
Change-Id: Ic6de1ec24f4c4d3c05e33d1ee053614784677513