summary refs log tree commit diff
path: root/lib/testing.nix
diff options
context:
space:
mode:
authorRob Vermaas <rob.vermaas@gmail.com>2010-04-29 12:45:22 +0000
committerRob Vermaas <rob.vermaas@gmail.com>2010-04-29 12:45:22 +0000
commita4516ec98a4b89c41f6669d290b4791bcab692fc (patch)
tree0d95f61723c8ad76154958a8b30b9ad6370615c4 /lib/testing.nix
parent310eefffe7a3fbd8054eb79f3a6569c4d0635112 (diff)
downloadnixpkgs-a4516ec98a4b89c41f6669d290b4791bcab692fc.tar
nixpkgs-a4516ec98a4b89c41f6669d290b4791bcab692fc.tar.gz
nixpkgs-a4516ec98a4b89c41f6669d290b4791bcab692fc.tar.bz2
nixpkgs-a4516ec98a4b89c41f6669d290b4791bcab692fc.tar.lz
nixpkgs-a4516ec98a4b89c41f6669d290b4791bcab692fc.tar.xz
nixpkgs-a4516ec98a4b89c41f6669d290b4791bcab692fc.tar.zst
nixpkgs-a4516ec98a4b89c41f6669d290b4791bcab692fc.zip
workaround for some fs problems experienced by some tests of webdsl/crawljax. also added require argument to runinmachinewithx function
svn path=/nixos/trunk/; revision=21423
Diffstat (limited to 'lib/testing.nix')
-rw-r--r--lib/testing.nix17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/testing.nix b/lib/testing.nix
index ca0b7297251..3a33ca69f08 100644
--- a/lib/testing.nix
+++ b/lib/testing.nix
@@ -104,15 +104,29 @@ rec {
   , machine
   , preBuild ? ""
   , postBuild ? ""
+  , ...
   }:
     let
       vms =
         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" ''
         source $1
+        oldout=$out
+        out=$TMPDIR$out
+        ${coreutils}/bin/mkdir -p $out
+        ${coreutils}/bin/mkdir -p $oldout
+        ${coreutils}/bin/ln -s $out $oldout
+
         ${coreutils}/bin/mkdir -p $TMPDIR
         exec $origBuilder $origArgs 
+
+        ${coreutils}/bin/rm -v $oldout
+        ${coreutils}/bin/cp -Rv $out/* $oldout/
+        out=$oldout 
       '';
 
       testscript = ''
@@ -139,11 +153,12 @@ rec {
         origBuilder = attrs.builder;
       });
 
-  runInMachineWithX = args :
+  runInMachineWithX = { require ? [], ...}@args :
     let
       client =
         { config, pkgs, ... }:
         {
+          inherit require;
           virtualisation.memorySize = 1024;
           services.xserver.enable = true;
           services.xserver.displayManager.slim.enable = false;