testing: migrate placeholders.sh
Change-Id: Iad6a6f53dac23cc5e49961571dd4c0545d616d7e
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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 ]]
|
||||
";
|
||||
}
|
||||
'
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user