Loading pkgs/build-support/src-only/tests.nix +64 −14 Original line number Diff line number Diff line { runCommand, srcOnly, hello, emptyDirectory, glibc, stdenv, testers, }: let emptySrc = srcOnly emptyDirectory; glibcSrc = srcOnly glibc; # It can be invoked in a number of ways. Let's make sure they're equivalent. glibcSrcDrvAttrs = srcOnly glibc.drvAttrs; # glibcSrcFreeform = # ???; helloSrc = srcOnly hello; helloSrcDrvAttrs = srcOnly hello.drvAttrs; # The srcOnly <drv> invocation leaks a lot of attrs into the srcOnly derivation, # so for comparing with the freeform invocation, we need to make a selection. # Otherwise, we'll be comparing against whatever attribute the fancy hello drv # has. helloDrvSimple = stdenv.mkDerivation { inherit (hello) name pname version src patches ; }; helloDrvSimpleSrc = srcOnly helloDrvSimple; helloDrvSimpleSrcFreeform = srcOnly { inherit (helloDrvSimple) name pname version src patches stdenv ; }; in runCommand "srcOnly-tests" { } '' runCommand "srcOnly-tests" { moreTests = [ (testers.testEqualDerivation "glibcSrcDrvAttrs == glibcSrc" glibcSrcDrvAttrs glibcSrc) # (testers.testEqualDerivation # "glibcSrcFreeform == glibcSrc" # glibcSrcFreeform # glibcSrc) (testers.testEqualDerivation "helloSrcDrvAttrs == helloSrc" helloSrcDrvAttrs helloSrc) (testers.testEqualDerivation "helloDrvSimpleSrcFreeform == helloDrvSimpleSrc" helloDrvSimpleSrcFreeform helloDrvSimpleSrc ) ]; } '' # Test that emptySrc is empty if [ -n "$(ls -A ${emptySrc})" ]; then echo "emptySrc is not empty" Loading Loading
pkgs/build-support/src-only/tests.nix +64 −14 Original line number Diff line number Diff line { runCommand, srcOnly, hello, emptyDirectory, glibc, stdenv, testers, }: let emptySrc = srcOnly emptyDirectory; glibcSrc = srcOnly glibc; # It can be invoked in a number of ways. Let's make sure they're equivalent. glibcSrcDrvAttrs = srcOnly glibc.drvAttrs; # glibcSrcFreeform = # ???; helloSrc = srcOnly hello; helloSrcDrvAttrs = srcOnly hello.drvAttrs; # The srcOnly <drv> invocation leaks a lot of attrs into the srcOnly derivation, # so for comparing with the freeform invocation, we need to make a selection. # Otherwise, we'll be comparing against whatever attribute the fancy hello drv # has. helloDrvSimple = stdenv.mkDerivation { inherit (hello) name pname version src patches ; }; helloDrvSimpleSrc = srcOnly helloDrvSimple; helloDrvSimpleSrcFreeform = srcOnly { inherit (helloDrvSimple) name pname version src patches stdenv ; }; in runCommand "srcOnly-tests" { } '' runCommand "srcOnly-tests" { moreTests = [ (testers.testEqualDerivation "glibcSrcDrvAttrs == glibcSrc" glibcSrcDrvAttrs glibcSrc) # (testers.testEqualDerivation # "glibcSrcFreeform == glibcSrc" # glibcSrcFreeform # glibcSrc) (testers.testEqualDerivation "helloSrcDrvAttrs == helloSrc" helloSrcDrvAttrs helloSrc) (testers.testEqualDerivation "helloDrvSimpleSrcFreeform == helloDrvSimpleSrc" helloDrvSimpleSrcFreeform helloDrvSimpleSrc ) ]; } '' # Test that emptySrc is empty if [ -n "$(ls -A ${emptySrc})" ]; then echo "emptySrc is not empty" Loading