1 # This needs to be run in a NixOS test, because Hydra cannot do IFD.
3 pkgs = import ../../.. { };
10 inherit (pkgs.lib) escapeShellArg;
13 runCommand name { } ''
14 actualOutput="$(${escapeShellArg "${test}/bin/test"})"
15 if [ "$(${escapeShellArg "${test}/bin/test"})" != ${escapeShellArg output} ]; then
16 echo >&2 "mismatched output: expected \""${escapeShellArg output}"\", got \"$actualOutput\""
21 oldDependency = writeShellScriptBin "dependency" ''
22 echo "got old dependency"
24 oldDependency-ca = oldDependency.overrideAttrs { __contentAddressed = true; };
25 newDependency = writeShellScriptBin "dependency" ''
26 echo "got new dependency"
28 newDependency-ca = newDependency.overrideAttrs { __contentAddressed = true; };
29 basic = writeShellScriptBin "test" ''
30 ${oldDependency}/bin/dependency
32 basic-ca = writeShellScriptBin "test" ''
33 ${oldDependency-ca}/bin/dependency
35 transitive = writeShellScriptBin "test" ''
38 weirdDependency = writeShellScriptBin "dependency" ''
39 echo "got weird dependency"
42 oldDependency1 = writeShellScriptBin "dependency1" ''
43 echo "got old dependency 1"
45 newDependency1 = writeShellScriptBin "dependency1" ''
46 echo "got new dependency 1"
48 oldDependency2 = writeShellScriptBin "dependency2" ''
49 ${oldDependency1}/bin/dependency1
50 echo "got old dependency 2"
52 newDependency2 = writeShellScriptBin "dependency2" ''
53 ${oldDependency1}/bin/dependency1
54 echo "got new dependency 2"
56 deep = writeShellScriptBin "test" ''
57 ${oldDependency2}/bin/dependency2
61 replacedependency-basic = mkCheckOutput "replacedependency-basic" (replaceDependency {
63 inherit oldDependency newDependency;
64 }) "got new dependency";
66 replacedependency-basic-old-ca = mkCheckOutput "replacedependency-basic" (replaceDependency {
68 oldDependency = oldDependency-ca;
69 inherit newDependency;
70 }) "got new dependency";
72 replacedependency-basic-new-ca = mkCheckOutput "replacedependency-basic" (replaceDependency {
74 inherit oldDependency;
75 newDependency = newDependency-ca;
76 }) "got new dependency";
78 replacedependency-transitive = mkCheckOutput "replacedependency-transitive" (replaceDependency {
80 inherit oldDependency newDependency;
81 }) "got new dependency";
83 replacedependency-weird =
84 mkCheckOutput "replacedependency-weird"
87 inherit oldDependency;
88 newDependency = weirdDependency;
94 replacedependencies-precedence = mkCheckOutput "replacedependencies-precedence" (replaceDependencies
97 replacements = [ { inherit oldDependency newDependency; } ];
98 cutoffPackages = [ oldDependency ];
100 ) "got new dependency";
102 replacedependencies-self = mkCheckOutput "replacedependencies-self" (replaceDependencies {
106 inherit oldDependency;
107 newDependency = oldDependency;
110 }) "got old dependency";
112 replacedependencies-deep-order1 =
113 mkCheckOutput "replacedependencies-deep-order1"
114 (replaceDependencies {
118 oldDependency = oldDependency1;
119 newDependency = newDependency1;
122 oldDependency = oldDependency2;
123 newDependency = newDependency2;
129 got new dependency 2'';
131 replacedependencies-deep-order2 =
132 mkCheckOutput "replacedependencies-deep-order2"
133 (replaceDependencies {
137 oldDependency = oldDependency2;
138 newDependency = newDependency2;
141 oldDependency = oldDependency1;
142 newDependency = newDependency1;
148 got new dependency 2'';