git.iko.soy/typeable/nixpkgs
on master help sign in
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>

commit8bbf1dc80e92df4374fc97dbc03bfee07bf67ff1 authoraszlig <aszlig@redmoonstudios.org> dateMon 15 Dec 2014, 19:17 (12 years ago) parentd85fabd
1 file changed+11−2
nixos/tests/virtualbox.nix+11−2
nixos/tests/virtualbox.nix+11−2
@@ -60,6 +60,12 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let
6060 ];
6161 };
6262
63+ mkLog = logfile: tag: let
64+ rotated = map (i: "${logfile}.${toString i}") (range 1 9);
65+ all = concatMapStringsSep " " (f: "\"${f}\"") ([logfile] ++ rotated);
66+ logcmd = "tail -F ${all} 2> /dev/null | logger -t \"${tag}\"";
67+ in "$machine->execute(ru '${logcmd} & disown');";
68+
6369 testVM = vmName: vmScript: let
6470 cfg = (import ../lib/eval-config.nix {
6571 system = "i686-linux";
@@ -166,7 +172,7 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let
166172 description = "VirtualBox Test Machine Log";
167173 serviceConfig.StandardInput = "socket";
168174 serviceConfig.StandardOutput = "syslog";
169− serviceConfig.SyslogIdentifier = "vbox-${name}";
175+ serviceConfig.SyslogIdentifier = "GUEST-${name}";
170176 serviceConfig.ExecStart = "${pkgs.coreutils}/bin/cat";
171177 };
172178 });
@@ -195,8 +201,9 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let
195201 vbm("storageattach ${name} ${diskFlags}");
196202 vbm("sharedfolder add ${name} ${sharedFlags}");
197203 vbm("sharedfolder add ${name} ${nixstoreFlags}");
198− vbm("showvminfo ${name} >&2");
199204 cleanup_${name};
205+
206+ ${mkLog "$HOME/VirtualBox VMs/${name}/Logs/VBox.log" "HOST-${name}"}
200207 }
201208
202209 sub destroyVM_${name} {
@@ -314,6 +321,8 @@ in {
314321
315322 $machine->waitForX;
316323
324+ ${mkLog "$HOME/.config/VirtualBox/VBoxSVC.log" "HOST-SVC"}
325+
317326 createVM_simple;
318327
319328 subtest "simple-gui", sub {