From 8bbf1dc80e92df4374fc97dbc03bfee07bf67ff1 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 15 Dec 2014 19:17:38 +0100 Subject: [PATCH] nixos/tests/virtualbox: Improve logging. This also makes showvminfo obsolete, as we get the same information from the hosts log. Signed-off-by: aszlig --- nixos/tests/virtualbox.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nixos/tests/virtualbox.nix b/nixos/tests/virtualbox.nix index 1c4765e15f1..e4c3de146e9 100644 --- a/nixos/tests/virtualbox.nix +++ b/nixos/tests/virtualbox.nix @@ -60,6 +60,12 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let ]; }; + mkLog = logfile: tag: let + rotated = map (i: "${logfile}.${toString i}") (range 1 9); + all = concatMapStringsSep " " (f: "\"${f}\"") ([logfile] ++ rotated); + logcmd = "tail -F ${all} 2> /dev/null | logger -t \"${tag}\""; + in "$machine->execute(ru '${logcmd} & disown');"; + testVM = vmName: vmScript: let cfg = (import ../lib/eval-config.nix { system = "i686-linux"; @@ -166,7 +172,7 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let description = "VirtualBox Test Machine Log"; serviceConfig.StandardInput = "socket"; serviceConfig.StandardOutput = "syslog"; - serviceConfig.SyslogIdentifier = "vbox-${name}"; + serviceConfig.SyslogIdentifier = "GUEST-${name}"; serviceConfig.ExecStart = "${pkgs.coreutils}/bin/cat"; }; }); @@ -195,8 +201,9 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let vbm("storageattach ${name} ${diskFlags}"); vbm("sharedfolder add ${name} ${sharedFlags}"); vbm("sharedfolder add ${name} ${nixstoreFlags}"); - vbm("showvminfo ${name} >&2"); cleanup_${name}; + + ${mkLog "$HOME/VirtualBox VMs/${name}/Logs/VBox.log" "HOST-${name}"} } sub destroyVM_${name} { @@ -314,6 +321,8 @@ in { $machine->waitForX; + ${mkLog "$HOME/.config/VirtualBox/VBoxSVC.log" "HOST-SVC"} + createVM_simple; subtest "simple-gui", sub {