aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-03-16Prioritize testing in the maintainers process docsJohn Ericson
PRs that don't increase our ongoing obligations (i.e. by adding new features) but do increase test coverage of existing features are good things to merge for the health of the project, and thus good to prioritize.
2023-03-16Merge pull request #8057 from obsidiansystems/slight-test-cleanupJohn Ericson
Cleanup test skipping
2023-03-16Cleanup test skippingJohn Ericson
- Try not to put cryptic "99" in many places Factor out `exit 99` into `skipTest` function - Alows make sure skipping a test is done with a reason `skipTest` takes a mandatory argument - Separate pure conditionals vs side-effectful test skipping. "require daemon" already had this, but "sandbox support" did not.
2023-03-16Merge pull request #8049 from edolstra/unexpected-eofEelco Dolstra
Fix "unexpected EOF" errors on macOS
2023-03-16Merge pull request #8053 from DeterminateSystems/fix-structuredattrs-sandboxEelco Dolstra
LocalDerivationGoal: set NIX_ATTRS_*_FILE correctly for sandboxed builds
2023-03-16LocalDerivationGoal: set NIX_ATTRS_*_FILE correctly for sandboxed buildsLinus Heckemann
2023-03-15Merge pull request #7750 from obsidiansystems/no-args-prepareJohn Ericson
Make command infra less stateful and more regular
2023-03-15Make command infra less stateful and more regularJohn Ericson
Already, we had classes like `BuiltPathsCommand` and `StorePathsCommand` which provided alternative `run` virtual functions providing the implementation with more arguments. This was a very nice and easy way to make writing command; just fill in the virtual functions and it is fairly clear what to do. However, exception to this pattern were `Installable{,s}Command`. These two classes instead just had a field where the installables would be stored, and various side-effecting `prepare` and `load` machinery too fill them in. Command would wish out those fields. This isn't so clear to use. What this commit does is make those command classes like the others, with richer `run` functions. Not only does this restore the pattern making commands easier to write, it has a number of other benefits: - `prepare` and `load` are gone entirely! One command just hands just hands off to the next. - `useDefaultInstallables` because `defaultInstallables`. This takes over `prepare` for the one case that needs it, and provides enough flexiblity to handle `nix repl`'s idiosyncratic migration. - We can use `ref` instead of `std::shared_ptr`. The former must be initialized (so it is like Rust's `Box` rather than `Option<Box>`, This expresses the invariant that the installable are in fact initialized much better. This is possible because since we just have local variables not fields, we can stop worrying about the not-yet-initialized case. - Fewer lines of code! (Finally I have a large refactor that makes the number go down not up...) - `nix repl` is now implemented in a clearer way. The last item deserves further mention. `nix repl` is not like the other installable commands because instead working from once-loaded installables, it needs to be able to load them again and again. To properly support this, we make a new superclass `RawInstallablesCommand`. This class has the argument parsing and completion logic, but does *not* hand off parsed installables but instead just the raw string arguments. This is exactly what `nix repl` needs, and allows us to instead of having the logic awkwardly split between `prepare`, `useDefaultInstallables,` and `load`, have everything right next to each other. I think this will enable future simplifications of that argument defaulting logic, but I am saving those for a future PR --- best to keep code motion and more complicated boolean expression rewriting separate steps. The "diagnostic ignored `-Woverloaded-virtual`" pragma helps because C++ doesn't like our many `run` methods. In our case, we don't mind the shadowing it all --- it is *intentional* that the derived class only provides a `run` method, and doesn't call any of the overridden `run` methods. Helps with https://github.com/NixOS/rfcs/pull/134
2023-03-15Merge pull request #7690 from ShamrockLee/nix-hash-sriJohn Ericson
nix-hash: support base-64 and SRI format
2023-03-16nix-hash: support base-64 and SRI formatYueh-Shun Li
Add the --base64 and --sri flags for the Base64 and SRI format output. Add the --base16 flag to explicitly specify the hexadecimal format. Add the --to-base64 and --to-sri flag to convert a hash to the above mentioned format.
2023-03-15Merge pull request #8050 from figsoda/allrefsEelco Dolstra
respect allRefs=1 when using `nix flake prefetch`
2023-03-16test/hash.sh: add to-base32 test for nix hashYueh-Shun Li
2023-03-16tests/hash.sh: try: Use FORMAT_FLAG instead of EXTRAYueh-Shun Li
Do not rely on the "multiple format flag specified" behavior. Explicitly test without the format flag / with the --base16 flag.
2023-03-15respect allRefs=1 when using `nix flake prefetch`figsoda
2023-03-15Remove a variable in LocalDerivationGoalEelco Dolstra
2023-03-15Change builderOut from Pipe to AutoCloseFDEelco Dolstra
2023-03-15Remove "unexpected EOF" retry hackEelco Dolstra
2023-03-15Move pseudoterminal slave open to childEelco Dolstra
Hopefully this fixes "unexpected EOF" failures on macOS (#3137, #3605, #7242, #7702). The problem appears to be that under some circumstances, macOS discards the output written to the slave side of the pseudoterminal. Hence the parent never sees the "sandbox initialized" message from the child, even though it succeeded. The conditions are: * The child finishes very quickly. That's why this bug is likely to trigger in nix-env tests, since that uses a builtin builder. Adding a short sleep before the child exits makes the problem go away. * The parent has closed its duplicate of the slave file descriptor. This shouldn't matter, since the child has a duplicate as well, but it does. E.g. moving the close to the bottom of startBuilder() makes the problem go away. However, that's not a solution because it would make Nix hang if the child dies before sending the "sandbox initialized" message. * The system is under high load. E.g. "make installcheck -j16" makes the issue pretty reproducible, while it's very rare under "make installcheck -j1". As a fix/workaround, we now open the pseudoterminal slave in the child, rather than the parent. This removes the second condition (i.e. the parent no longer needs to close the slave fd) and I haven't been able to reproduce the "unexpected EOF" with this.
2023-03-14Simplify commonChildInit()Eelco Dolstra
2023-03-14Merge pull request #7989 from sysedwinistrator/flake-compat-sha256-mrThéophane Hufschmitt
add flake-compat to flake.nix and use sha256 in default.nix
2023-03-13Merge pull request #8033 from lbodor/stop-adding-dot-to-nix-dev-env-pathRobert Hensing
`print-dev-env`: stop inadvertently adding `.` to `PATH`
2023-03-13Merge pull request #6338 from Artturin/labelerValentin Gagarin
add labeler workflow
2023-03-13add labeler workflowArtturin
2023-03-14Use $TEST_ROOTlbodor
2023-03-13Merge pull request #8036 from Freed-Wu/patch-1Valentin Gagarin
2023-03-13Merge pull request #8040 from NixOS/macos-warningEelco Dolstra
Fix macOS warning
2023-03-13Merge pull request #7486 from fricklerhandwerk/doc-referenceEelco Dolstra
reword definition of "reference"
2023-03-13Merge pull request #7534 from fricklerhandwerk/maintainers-goalsValentin Gagarin
add objectives and tasks for Nix team
2023-03-13Merge pull request #8037 from edolstra/fix-make-cleanEelco Dolstra
make clean: Delete vars-and-functions.sh
2023-03-13Fix macOS warningEelco Dolstra
2023-03-13make clean: Delete vars-and-functions.shEelco Dolstra
2023-03-13Fix a typo of values.mdwzy
2023-03-13print-dev-env: test the case when PATH is emptylbodor
2023-03-12print-dev-env: stop inadvertently adding . to PATHlbodor
2023-03-10Merge pull request #7896 from obsidiansystems/doxygenJohn Ericson
Generate API docs with Doxygen
2023-03-10Generate API docs with DoxygenJohn Ericson
The motivation is as stated in issue #7814: even though the the C++ API is internal and unstable, people still want it to be well documented for sake of learning, code review, and other purposes that aren't predicated on it being stable. Fixes #7814 Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-03-10Merge pull request #7928 from serokell/doc-includesValentin Gagarin
Documentation: process `#include` directives
2023-03-10Merge pull request #8015 from tweag/progress-during-nix-copyThéophane Hufschmitt
Display progress when running copyPaths (nix copy)
2023-03-09Merge pull request #8020 from edolstra/no-such-processEelco Dolstra
Make findRuntimeRoots() more resilient to disappearing processes
2023-03-09Make findRuntimeRoots() more resilient to disappearing processesEelco Dolstra
I saw this random failure in https://hydra.nixos.org/build/211811692: error: opening /proc/15307/fd: No such process while running nix-collect-garbage in a readfile-context.sh. This is because we're not handling ESRCH errors reading /proc/<pid>/fd. So just move the read inside the try/catch where we do handle it.
2023-03-09Merge pull request #8019 from edolstra/fix-read-from-stdinEelco Dolstra
Fix another uninitialized variable
2023-03-09Fix another uninitialized variableEelco Dolstra
https://hydra.nixos.org/build/211811494
2023-03-09Display progress when running copyPaths (nix copy)Alexander Bantyev
`nix copy` operations did not show progress. This is quite confusing. Add a `progressSink` which displays the progress during `copyPaths`, pretty much copied from `copyStorePath`. Fixes https://github.com/NixOS/nix/issues/8000
2023-03-09Merge pull request #8012 from NixOS/revert-7725-check-coro-gcEelco Dolstra
Revert "Disable GC during coroutine execution + test"
2023-03-08Merge pull request #5754 from obsidiansystems/harden-tests-set-uThéophane Hufschmitt
Harden tests' bash
2023-03-08Revert "Disable GC during coroutine execution + test"Théophane Hufschmitt
2023-03-08Merge pull request #8005 from edolstra/run-installcheckEelco Dolstra
Run 'make installcheck' again
2023-03-08Harden tests' bashJohn Ericson
Use `set -u` and `set -o pipefail` to catch accidental mistakes and failures more strongly. - `set -u` catches the use of undefined variables - `set -o pipefail` catches failures (like `set -e`) earlier in the pipeline. This makes the tests a bit more robust. It is nice to read code not worrying about these spurious success paths (via uncaught) errors undermining the tests. Indeed, I caught some bugs doing this. There are a few tests where we run a command that should fail, and then search its output to make sure the failure message is one that we expect. Before, since the `grep` was the last command in the pipeline the exit code of those failing programs was silently ignored. Now with `set -o pipefail` it won't be, and we have to do something so the expected failure doesn't accidentally fail the test. To do that we use `expect` and a new `expectStderr` to check for the exact failing exit code. See the comments on each for why. `grep -q` is replaced with `grepQuiet`, see the comments on that function for why. `grep -v` when we just want the exit code is replaced with `grepInverse, see the comments on that function for why. `grep -q -v` together is, surprise surprise, replaced with `grepQuietInverse`, which is both combined. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-03-08Run 'make installcheck' againEelco Dolstra
This was failing because the check for the existence of the 'installcheck' target failed silently, so the whole phase got skipped. It works by running 'make -n installcheck 2> /dev/null', which however barfs with /nix/store/039g378vc3pc3dvi9dzdlrd0i4q93qwf-binutils-2.39/bin/ld.gold: error: cannot open tests/plugins/plugintest.o: No such file or directory Fixes #8004.
2023-03-08Merge pull request #8007 from edolstra/fix-coverageEelco Dolstra
Fix coverage job