nixos/tests/virtualbox: Improve logging.

This also makes showvminfo obsolete, as we get the same information from
the hosts log.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2014-12-15 19:17:38 +01:00
parent d85fabd68c
commit 8bbf1dc80e
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961

View File

@ -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 {