runInMachine: Support passAsFile
We need to rewrite attributes passed via files to their location in /tmp/xchg in the VM. Otherwise functions like runCommand don't work.
This commit is contained in:
parent
7ffbe5174f
commit
75baee8523
|
@ -157,9 +157,7 @@ rec {
|
||||||
${coreutils}/bin/mkdir -p $TMPDIR
|
${coreutils}/bin/mkdir -p $TMPDIR
|
||||||
cd $TMPDIR
|
cd $TMPDIR
|
||||||
|
|
||||||
$origBuilder $origArgs
|
exec $origBuilder $origArgs
|
||||||
|
|
||||||
exit $?
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
|
@ -172,9 +170,20 @@ rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
vmRunCommand = writeText "vm-run" ''
|
vmRunCommand = writeText "vm-run" ''
|
||||||
|
xchg=vm-state-client/xchg
|
||||||
${coreutils}/bin/mkdir $out
|
${coreutils}/bin/mkdir $out
|
||||||
${coreutils}/bin/mkdir -p vm-state-client/xchg
|
${coreutils}/bin/mkdir -p $xchg
|
||||||
export > vm-state-client/xchg/saved-env
|
|
||||||
|
for i in $passAsFile; do
|
||||||
|
i2=''${i}Path
|
||||||
|
_basename=$(${coreutils}/bin/basename ''${!i2})
|
||||||
|
${coreutils}/bin/cp ''${!i2} $xchg/$_basename
|
||||||
|
eval $i2=/tmp/xchg/$_basename
|
||||||
|
${coreutils}/bin/ls -la $xchg
|
||||||
|
done
|
||||||
|
unset i i2 _basename
|
||||||
|
|
||||||
|
export > $xchg/saved-env
|
||||||
export tests='${testScript}'
|
export tests='${testScript}'
|
||||||
${testDriver}/bin/nixos-test-driver ${vm.config.system.build.vm}/bin/run-*-vm
|
${testDriver}/bin/nixos-test-driver ${vm.config.system.build.vm}/bin/run-*-vm
|
||||||
''; # */
|
''; # */
|
||||||
|
|
Loading…
Reference in New Issue