diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 7b42b4943..f24432d02 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -99,7 +99,6 @@ functional_tests_scripts = [ 'eval-store.sh', 'derivation-json.sh', 'import-derivation.sh', - 'placeholders.sh', 'ssh-relay.sh', 'build.sh', 'output-normalization.sh', diff --git a/tests/functional/placeholders.sh b/tests/functional/placeholders.sh deleted file mode 100644 index cd1bb7bc2..000000000 --- a/tests/functional/placeholders.sh +++ /dev/null @@ -1,20 +0,0 @@ -source common.sh - -clearStore - -nix-build --no-out-link -E ' - with import ./config.nix; - - mkDerivation { - name = "placeholders"; - outputs = [ "out" "bin" "dev" ]; - buildCommand = " - echo foo1 > $out - echo foo2 > $bin - echo foo3 > $dev - [[ $(cat ${placeholder "out"}) = foo1 ]] - [[ $(cat ${placeholder "bin"}) = foo2 ]] - [[ $(cat ${placeholder "dev"}) = foo3 ]] - "; - } -' diff --git a/tests/functional2/store/test_placeholders.py b/tests/functional2/store/test_placeholders.py new file mode 100644 index 000000000..72d4ba27c --- /dev/null +++ b/tests/functional2/store/test_placeholders.py @@ -0,0 +1,27 @@ +from pathlib import Path +from testlib.fixtures.file_helper import with_files +from testlib.utils import get_global_asset +from testlib.fixtures.nix import Nix + + +@with_files({"config.nix": get_global_asset("config.nix")}) +def test_placeholders(nix: Nix): + expr = """ + with import ./config.nix; + + mkDerivation { + name = "placeholders"; + outputs = [ "out" "bin" "dev" ]; + buildCommand = " + echo foo1 > $out + echo foo2 > $bin + echo foo3 > $dev + [[ $(cat ${placeholder "out"}) = foo1 ]] + [[ $(cat ${placeholder "bin"}) = foo2 ]] + [[ $(cat ${placeholder "dev"}) = foo3 ]] + "; + } + """ + + result = Path(nix.nix_build(["-E", expr]).run().ok().stdout_plain) + assert result.read_text() == "foo1\n"