Skip to content

Should passthru.tests be an attrset? #290492

@l0b0

Description

@l0b0

Describe the bug

At current master:

  • There are 19978 evaluable top-level packages:

    pkgs = import <nixpkgs> {}
    evaluable = pkg: (builtins.tryEval pkg).success
    evaluablePkgs = pkgs.lib.filterAttrs (_name: pkg: evaluable pkg) pkgs
    builtins.length (builtins.attrNames evaluablePkgs)
    
  • 2144 of these have passthru.tests:

    hasTests = pkg: (pkg.passthru or {}) ? tests
    testedPkgs = pkgs.lib.filterAttrs (_name: pkg: hasTests pkg) evaluablePkgs
    builtins.length (builtins.attrNames testedPkgs)
    
  • 2138 of these evaluate:

    testable =  pkg: (builtins.tryEval pkg.passthru.tests).success
    testablePkgs = pkgs.lib.filterAttrs (_name: pkg: testable pkg) testedPkgs
    builtins.length (builtins.attrNames testablePkgs)
    
  • 2081 of these are attrlists:

    builtins.length (builtins.attrNames (pkgs.lib.filterAttrs (_name: pkg: builtins.isAttrs pkg.passthru.tests) testablePkgs))
    
  • 57 (2.7%) of these are lists:

    builtins.length (builtins.attrNames (pkgs.lib.filterAttrs (_name: pkg: builtins.isList pkg.passthru.tests) testablePkgs))
    

The packages where passthru.tests is a list:

[
  "betterbird-unwrapped",
  "docker-client",
  "firefox-beta-unwrapped",
  "firefox-devedition-unwrapped",
  "firefox-esr-115-unwrapped",
  "firefox-esr-unwrapped",
  "firefox-unwrapped",
  "floorp-unwrapped",
  "jre17_minimal",
  "jre_minimal",
  "librewolf-unwrapped",
  "linux",
  "linux-libre",
  "linux-rt",
  "linux-rt_5_10",
  "linux-rt_5_15",
  "linux-rt_5_4",
  "linux-rt_6_1",
  "linux-rt_latest",
  "linux_4_19",
  "linux_4_19_hardened",
  "linux_5_10",
  "linux_5_10_hardened",
  "linux_5_15",
  "linux_5_15_hardened",
  "linux_5_4",
  "linux_5_4_hardened",
  "linux_6_1",
  "linux_6_1_hardened",
  "linux_6_5",
  "linux_6_5_hardened",
  "linux_6_6",
  "linux_6_6_hardened",
  "linux_6_7",
  "linux_6_7_hardened",
  "linux_hardened",
  "linux_latest",
  "linux_latest-libre",
  "linux_lqx",
  "linux_rpi0",
  "linux_rpi02w",
  "linux_rpi1",
  "linux_rpi2",
  "linux_rpi3",
  "linux_rpi4",
  "linux_testing",
  "linux_xanmod",
  "linux_xanmod_latest",
  "linux_xanmod_stable",
  "linux_zen",
  "raylib",
  "thunderbird-unwrapped",
  "xulrunner",
  "zfs",
  "zfsStable",
  "zfsUnstable",
  "zfs_2_1"
]

Would it be possible to convert these to attrsets, and enforce that passthru.tests should be an attrset, for ease of development?

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: enhancementAdd something new or improve an existing system.0.kind: questionRequests for a specific question to be answered2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md9.needs: community feedbackThis needs feedback from more community members.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions