diff options
author | Artturin <Artturin@artturin.com> | 2022-12-11 13:31:50 +0200 |
---|---|---|
committer | Artturin <Artturin@artturin.com> | 2022-12-12 21:39:56 +0200 |
commit | 9cb5662187377146daf2b2abd54f4bce9ab59343 (patch) | |
tree | 8e05d8406fe241e54649aed7d92be05beb065ccc /pkgs/test/stdenv | |
parent | 84a7cadfd2d419b00148b5b826568c5ba59b93d5 (diff) |
tests: move stdenv hook tests to stdenv.hooks
Diffstat (limited to 'pkgs/test/stdenv')
-rw-r--r-- | pkgs/test/stdenv/default.nix | 6 | ||||
-rw-r--r-- | pkgs/test/stdenv/hooks.nix | 35 |
2 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/test/stdenv/default.nix b/pkgs/test/stdenv/default.nix index 0a29f91ce0491..c9653b324eb97 100644 --- a/pkgs/test/stdenv/default.nix +++ b/pkgs/test/stdenv/default.nix @@ -95,6 +95,9 @@ let in { + # tests for hooks in `stdenv.defaultNativeBuildInputs` + hooks = lib.recurseIntoAttrs (import ./hooks.nix { stdenv = bootStdenv; }); + test-env-attrset = testEnvAttrset { name = "test-env-attrset"; stdenv' = bootStdenv; }; test-prepend-append-to-var = testPrependAndAppendToVar { @@ -114,6 +117,9 @@ in }; structuredAttrsByDefault = lib.recurseIntoAttrs { + + hooks = lib.recurseIntoAttrs (import ./hooks.nix { stdenv = bootStdenvStructuredAttrsByDefault; }); + test-cc-wrapper-substitutions = ccWrapperSubstitutionsTest { name = "test-cc-wrapper-substitutions-structuredAttrsByDefault"; stdenv' = bootStdenvStructuredAttrsByDefault; diff --git a/pkgs/test/stdenv/hooks.nix b/pkgs/test/stdenv/hooks.nix new file mode 100644 index 0000000000000..f63ca054e0838 --- /dev/null +++ b/pkgs/test/stdenv/hooks.nix @@ -0,0 +1,35 @@ +{ stdenv }: + +# ordering should match defaultNativeBuildInputs + +{ + move-docs = stdenv.mkDerivation { + name = "test-move-docs"; + buildCommand = '' + mkdir -p $out/{man,doc,info} + touch $out/{man,doc,info}/foo + cat $out/{man,doc,info}/foo + + _moveToShare + + (cat $out/share/{man,doc,info}/foo 2>/dev/null && echo "man,doc,info were moved") || (echo "man,doc,info were not moved" && exit 1) + ''; + }; + make-symlinks-relative = stdenv.mkDerivation { + name = "test-make-symlinks-relative"; + buildCommand = '' + mkdir -p $out/{bar,baz} + source1="$out/bar/foo" + destination1="$out/baz/foo" + echo foo > $source1 + ln -s $source1 $destination1 + echo "symlink before patching: $(readlink $destination1)" + + _makeSymlinksRelative + + echo "symlink after patching: $(readlink $destination1)" + ([[ -e $destination1 ]] && echo "symlink isn't broken") || (echo "symlink is broken" && exit 1) + ([[ $(readlink $destination1) == "../bar/foo" ]] && echo "absolute symlink was made relative") || (echo "symlink was not made relative" && exit 1) + ''; + }; +} |