lib/testing.nix: remove workaround

svn path=/nixos/trunk/; revision=22719
This commit is contained in:
Rob Vermaas 2010-07-23 13:59:50 +00:00
parent 21e62884e7
commit 5dab679f9f
1 changed files with 8 additions and 42 deletions

View File

@ -113,55 +113,21 @@ rec {
vms = vms =
buildVirtualNetwork { nodes = { client = machine; } ; }; buildVirtualNetwork { nodes = { client = machine; } ; };
# ugly workaround, until we figure out why some fs actions work properly inside
# the vm. (e.g. unlink gives access denied over smb in qemu). note that the function
# now only works for derivations that lead to a directory in the store, not a file.
buildrunner = writeText "vm-build" '' buildrunner = writeText "vm-build" ''
source $1 source $1
origout=$out
out=$TMPDIR$out
echo "--------------------------------"
echo "Creating $out"
echo "--------------------------------"
${coreutils}/bin/mkdir -p $out
echo "--------------------------------"
echo "Linking $origout to $out "
echo "--------------------------------"
${coreutils}/bin/ln -s $out $origout
echo "--------------------------------"
echo "Creating $TMPDIR"
echo "--------------------------------"
${coreutils}/bin/mkdir -p $TMPDIR ${coreutils}/bin/mkdir -p $TMPDIR
cd $TMPDIR
echo "--------------------------------"
echo "Running builder" $origBuilder $origArgs
echo "--------------------------------"
$origBuilder $origArgs echo "Exit code:" $?
echo "--------------------------------"
echo "Removing link $origout"
echo "--------------------------------"
${coreutils}/bin/rm -vf $origout
echo "--------------------------------"
echo "Creating $origout"
echo "--------------------------------"
${coreutils}/bin/mkdir -p $origout
echo "--------------------------------"
echo "Copying $out/* to $origout/"
echo "--------------------------------"
${coreutils}/bin/cp -Rv $out/* $origout/
out=$origout
''; '';
testscript = '' testscript = ''
startAll; startAll;
${preBuild} ${preBuild}
print STDERR $client->mustSucceed("source ${buildrunner} /hostfs".$client->stateDir."/saved-env"); print STDERR $client->mustSucceed("env -i ${pkgs.bash}/bin/bash ${buildrunner} /hostfs".$client->stateDir."/saved-env");
${postBuild} ${postBuild}
''; '';
@ -179,7 +145,7 @@ rec {
builder = "${bash}/bin/sh"; builder = "${bash}/bin/sh";
args = ["-e" vmRunCommand]; args = ["-e" vmRunCommand];
origArgs = attrs.args; origArgs = attrs.args;
origBuilder = attrs.builder; origBuilder = attrs.builder;
}); });
runInMachineWithX = { require ? [], ...}@args : runInMachineWithX = { require ? [], ...}@args :