diff --git a/tests/functional/meson.build b/tests/functional/meson.build index efaf33954..7b71cac4c 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -103,7 +103,6 @@ functional_tests_scripts = [ 'selfref-gc.sh', 'db-migration.sh', 'bash-profile.sh', - 'pass-as-file.sh', 'store-ping.sh', 'flakes/show.sh', 'path-from-hash-part.sh', diff --git a/tests/functional/pass-as-file.sh b/tests/functional/pass-as-file.sh deleted file mode 100644 index 2c0bc5031..000000000 --- a/tests/functional/pass-as-file.sh +++ /dev/null @@ -1,18 +0,0 @@ -source common.sh - -clearStore - -outPath=$(nix-build --no-out-link -E " -with import ./config.nix; - -mkDerivation { - name = \"pass-as-file\"; - passAsFile = [ \"foo\" ]; - foo = [ \"xyzzy\" ]; - builder = builtins.toFile \"builder.sh\" '' - [ \"\$(basename \$fooPath)\" = .attr-1bp7cri8hplaz6hbz0v4f0nl44rl84q1sg25kgwqzipzd1mv89ic ] - [ \"\$(cat \$fooPath)\" = xyzzy ] - touch \$out - ''; -} -") diff --git a/tests/functional2/build/test_pass_as_file.py b/tests/functional2/build/test_pass_as_file.py new file mode 100644 index 000000000..6ea193a58 --- /dev/null +++ b/tests/functional2/build/test_pass_as_file.py @@ -0,0 +1,26 @@ +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset +from testlib.fixtures.file_helper import File, with_files + + +@with_files( + { + "config.nix": get_global_asset("config.nix"), + "default.nix": File(""" + with import ./config.nix; + + mkDerivation { + name = "pass-as-file"; + passAsFile = [ "foo" ]; + foo = [ "xyzzy" ]; + builder = builtins.toFile "builder.sh" '' + [ "$(basename $fooPath)" = .attr-1bp7cri8hplaz6hbz0v4f0nl44rl84q1sg25kgwqzipzd1mv89ic ] + [ "$(cat $fooPath)" = xyzzy ] + touch $out + ''; + } + """), + } +) +def test_pass_as_file(nix: Nix): + nix.nix_build([]).run().ok()