diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-09-08 15:34:04 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-09-08 15:38:56 +0200 |
commit | 75baee8523f62b75a0cf350a8360ce8f3e3c3695 (patch) | |
tree | 610aec923c7345af5c93c38427e3d4498a2aabb6 /nixos | |
parent | 7ffbe5174f0b349396571031a7a3d8ddfb08cd41 (diff) | |
download | nixlib-75baee8523f62b75a0cf350a8360ce8f3e3c3695.tar nixlib-75baee8523f62b75a0cf350a8360ce8f3e3c3695.tar.gz nixlib-75baee8523f62b75a0cf350a8360ce8f3e3c3695.tar.bz2 nixlib-75baee8523f62b75a0cf350a8360ce8f3e3c3695.tar.lz nixlib-75baee8523f62b75a0cf350a8360ce8f3e3c3695.tar.xz nixlib-75baee8523f62b75a0cf350a8360ce8f3e3c3695.tar.zst nixlib-75baee8523f62b75a0cf350a8360ce8f3e3c3695.zip |
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.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/lib/testing.nix | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix index 61b214bfba8c..b177146a56b1 100644 --- a/nixos/lib/testing.nix +++ b/nixos/lib/testing.nix @@ -157,9 +157,7 @@ rec { ${coreutils}/bin/mkdir -p $TMPDIR cd $TMPDIR - $origBuilder $origArgs - - exit $? + exec $origBuilder $origArgs ''; testScript = '' @@ -172,9 +170,20 @@ rec { ''; vmRunCommand = writeText "vm-run" '' + xchg=vm-state-client/xchg ${coreutils}/bin/mkdir $out - ${coreutils}/bin/mkdir -p vm-state-client/xchg - export > vm-state-client/xchg/saved-env + ${coreutils}/bin/mkdir -p $xchg + + 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}' ${testDriver}/bin/nixos-test-driver ${vm.config.system.build.vm}/bin/run-*-vm ''; # */ |