Merge pull request #278687 from keanuk/check-by-name-multiple-failures

nixpkgs-check-by-name test that fails multiple validity checks
This commit is contained in:
Silvan Mosberger 2024-01-17 21:39:37 +01:00 committed by GitHub
commit a64d9bf4fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 29 additions and 5 deletions

View file

@ -73,7 +73,7 @@ Tests are declared in [`./tests`](./tests) as subdirectories imitating Nixpkgs w
- `default.nix`:
Always contains
```nix
import ../mock-nixpkgs.nix { root = ./.; }
import <test-nixpkgs> { root = ./.; }
```
which makes
```

View file

@ -106,6 +106,10 @@ fn check_nix_file(
let root = Root::parse(&contents);
if let Some(error) = root.errors().first() {
// NOTE: There's now another Nixpkgs CI check to make sure all changed Nix files parse
// correctly, though that uses mainline Nix instead of rnix, so it doesn't give the same
// errors. In the future we should unify these two checks, ideally moving the other CI
// check into this tool as well and checking for both mainline Nix and rnix.
return Ok(NixpkgsProblem::CouldNotParseNix {
relative_package_dir: relative_package_dir.to_path_buf(),
subpath: subpath.to_path_buf(),

View file

@ -0,0 +1,13 @@
pkgs/by-name/A: Invalid directory name "A", must be at most 2 ASCII characters consisting of a-z, 0-9, "-" or "_".
pkgs/by-name/A/fo@: Invalid package directory name "fo@", must be ASCII characters consisting of a-z, A-Z, 0-9, "-" or "_".
pkgs/by-name/A/fo@: Path foo is a symlink which cannot be resolved: No such file or directory (os error 2).
pkgs/by-name/A/fo@: Path package.nix is a symlink pointing to a path outside the directory of that package.
pkgs/by-name/aa: This is a file, but it should be a directory.
pkgs/by-name/ba/bar: This path is a file, but it should be a directory.
pkgs/by-name/ba/baz: "package.nix" must be a file.
pkgs/by-name/ba/foo: Incorrect directory location, should be pkgs/by-name/fo/foo instead.
pkgs/by-name/ba/foo: File package.nix at line 2 contains the path expression "/bar" which cannot be resolved: No such file or directory (os error 2).
pkgs/by-name/ba/foo: File package.nix at line 3 contains the path expression "../." which may point outside the directory of that package.
pkgs/by-name/ba/foo: File package.nix at line 4 contains the nix search path expression "<nixpkgs>" which may point outside the directory of that package.
pkgs/by-name/ba/foo: File package.nix at line 5 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package.
pkgs/by-name/fo/foo: Missing required "package.nix" file.

View file

@ -0,0 +1 @@
../../../../someDrv.nix

View file

@ -0,0 +1,6 @@
{ someDrv }: someDrv // {
escapeAbsolute = /bar;
escapeRelative = ../.;
nixPath = <nixpkgs>;
pathWithSubexpr = ./${"test"};
}

View file

@ -0,0 +1 @@
{ someDrv }: someDrv

View file

@ -1 +0,0 @@
pkgs/by-name/aa/aa: File invalid.nix could not be parsed by rnix: unexpected token at 28..29

View file

@ -1 +0,0 @@
this is not a valid nix file!

View file

@ -1 +1 @@
pkgs/by-name/fo/foo: Path foo.nix is a symlink which cannot be resolved: No such file or directory (os error 2).
pkgs/by-name/fo/foo: Path foo is a symlink which cannot be resolved: No such file or directory (os error 2).