Commit Graph

23 Commits

Author SHA1 Message Date
Yueh-Shun Li
7950a226f6
tests.trivial-builders.references: specify as empty set instead of null on non-Linux
Please Nix CI (OfBorg) with empty set instead of null on non-linux platforms,
where NixOS tests are not supported.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-12-09 13:08:10 +08:00
Yueh-Shun Li
9fba2b0fd7 tests.trivial-builders.references: add ShamrockLee as a maintainer 2023-12-08 09:28:47 +00:00
Yueh-Shun Li
1f4e8f3fad tests.trivial-buildrs.references: move expression files into trivial-builders/test/references/ 2023-12-08 09:27:48 +00:00
Yueh-Shun Li
79a1e9d729 tests.trivial-builders.references: refactor expression
Define package `testScriptBin` that contains the substituted test script.
* Add an `installCheckPhase` to check the result script with ShellCheck.
* Passthru as `references.testScriptBin` to run the
  (substituted) test script directly (without VM).
* Drop the logic in build script that detects if
  it is run in the Nix sandbox.
* Inline sample application; drop invoke-*.nix.

Format expressions.
* Format with `nixpkgs-fmt`.
* Use multi-line style of set patterns.

Call the samples with `callPackage`.
* Rename `sample` -> `samples`.
* Take individual packages / build helpers directly from the
  set pattern.
* Define `cleanSamples` to filter out overriders such as `<pkg>.override`.
  added by `callPackage`.

Passthru samples and invocation results for easier debugging.
* Passthru samples, references, directReferences
* Provide tests.trivial-builders.writeStringReferencesToFile with such
  samples argument.
2023-12-07 22:28:30 +00:00
Shamrock Lee
1d56e7909d trivial-builders/test/references-test.sh: lint with ShellCheck 2023-11-30 17:16:05 +08:00
con-f-use
0f3fa9e6ef writeShellApplication: exclude shell checks 2023-10-15 12:10:50 +02:00
Robert Hensing
0dd3989cef tests.trivial-builders.writeTextFile: Test meta.mainProgram logic 2023-07-26 18:45:54 +02:00
Robert Hensing
a6aabd9d28 tests.trivial-builders.references: Only run where supported 2023-07-26 18:22:34 +02:00
Robert Hensing
89bdfd4687 trivial-builders: Move test list closer 2023-07-26 18:22:33 +02:00
Robert Hensing
d1dc8384ca writeCBin: Add meta.mainProgram
... and add tests.
2023-07-26 18:22:26 +02:00
Naïm Favier
e6f19ea429
writeTextFile: chmod before checkPhase
Set the executable bit before running the check phase, so that the check
phase can run the script to test its behaviour.

This aligns with what `concatTextFile` is doing.

Also use explicit `if` statements so that we don't silently ignore
`chmod` failures.
2023-03-29 14:06:45 +02:00
Adam Joseph
1a657f18f7 trivial-builders/test/references.nix: fix eval
The command

```
nix-build -A tests.trivial-builders.references --show-trace
```

fails eval with

```
in job ‘nixpkgs.tests.trivial-builders.references’:
error: The option `meta.description' does not exist. Definition values:
       - In `makeTest parameters': "Run the Nixpkgs trivial builders tests"
```

because `meta.description` and `meta.license` are not valid for
`nixosTest`s (they are valid for `mkDerivation` of course).

This has been causing Hydra eval failures:

  https://hydra.nixos.org/jobset/nixos/pr-209870-gcc-external-bootstrap#tabs-errors

Let's fix eval by removing these attributes.
2023-03-17 20:56:20 -07:00
Bernardo Meurer
43bf542ccd
tests.trivial-builders.linkFarm: init 2022-11-15 11:47:36 -05:00
Robert Hensing
ae172a2bb4 treewide: nixosTest -> testers.nixosTest 2022-05-09 14:16:06 +02:00
K900
7e3c503257 build-support/writeTextFile: add test for weird file names 2022-03-10 13:30:46 +03:00
polykernel
4a9d9928dc nixos/nix-daemon: use structural settings
The `nix.*` options, apart from options for setting up the
daemon itself, currently provide a lot of setting mappings
for the Nix daemon configuration. The scope of the mapping yields
convience, but the line where an option is considered essential
is blurry. For instance, the `extra-sandbox-paths` mapping is
provided without its primary consumer, and the corresponding
`sandbox-paths` option is also not mapped.

The current system increases the maintenance burden as maintainers have to
closely follow upstream changes. In this case, there are two state versions
of Nix which have to be maintained collectively, with different options
avaliable.

This commit aims to following the standard outlined in RFC 42[1] to
implement a structural setting pattern. The Nix configuration is encoded
at its core as key-value pairs which maps nicely to attribute sets, making
it feasible to express in the Nix language itself. Some existing options are
kept such as `buildMachines` and `registry` which present a simplified interface
to managing the respective settings. The interface is exposed as `nix.settings`.

Legacy configurations are mapped to their corresponding options under `nix.settings`
for backwards compatibility.

Various options settings in other nixos modules and relevant tests have been
updated to use structural setting for consistency.

The generation and validation of the configration file has been modified to
use `writeTextFile` instead of `runCommand` for clarity. Note that validation
is now mandatory as strict checking of options has been pushed down to the
derivation level due to freeformType consuming unmatched options. Furthermore,
validation can not occur when cross-compiling due to current limitations.

A new option `publicHostKey` was added to the `buildMachines`
submodule corresponding to the base64 encoded public host key settings
exposed in the builder syntax. The build machine generation was subsequently
rewritten to use `concatStringsSep` for better performance by grouping
concatenations.

[1] - https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md
2022-01-26 21:04:50 -05:00
Pasquale
86e2880d11
tests.concat: added empty case 2022-01-04 23:14:50 +01:00
Pasquale
5187d2cd8f
concatText: test now works 2021-12-30 13:12:34 +01:00
Pasquale
1bc5179d1e
concatText: add test 2021-12-02 21:55:23 +01:00
Robert Hensing
51f7c15df9 test.trivial-builders: Add test cases, fix test runner, rename
The writeStringReferencesToFile didn't handle non-unique references
to the same path correctly.
2021-11-01 00:06:03 +01:00
talyz
aa22fa9c0b trivial-builders: Add writeStringReferencesToFile
Add writeStringReferencesToFile, a builder which extracts a string's
references to derivations and paths and writes them to a text file,
removing the input string itself from the dependency graph. This is
useful when you want to make a derivation depend on the string's
references, but not its content (to avoid unnecessary rebuilds, for
example).
2021-10-28 12:55:01 +02:00
Robert Hensing
c38c5dba10 tests.trivial: Add emptyFile, emptyDirectory to samples 2021-06-12 17:29:27 +02:00
Robert Hensing
35406647fd tests.trivial: Avoid evaluation and ${pkgs.path} dep
> There is an issue in the test added by #123111.
> [it] introduces a dependency on the contents of nixpkgs,
> making every change evaluate with a different hash.
2021-05-19 01:06:09 +02:00