git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/tests/vbox: Make shutdown less noisy

Using waitUntilSucceeds for testing whether the shutdown signalling files have vanished is quite noisy because it prints two lines for every try. This is now fixed with a while loop on the guest VM which does the same check but with only one output for the command that's executed and another one when the conditions are met. Signed-off-by: aszlig <aszlig@redmoonstudios.org>

commit562c7f56f0526c2353b99246370a3d17f40ec148 authoraszlig <aszlig@redmoonstudios.org> dateTue 13 Sep 2016, 14:52 (10 years ago) parente19aa38
1 file changed+6−3
nixos/tests/virtualbox.nix+6−3
nixos/tests/virtualbox.nix+6−3
@@ -273,9 +273,12 @@ let
273273
274274 sub shutdownVM_${name} {
275275 $machine->succeed(ru "touch ${sharePath}/shutdown");
276− $machine->waitUntilSucceeds(
277− "test ! -e ${sharePath}/shutdown ".
278− " -a ! -e ${sharePath}/boot-done"
276+ $machine->execute(
277+ 'set -e; i=0; '.
278+ 'while test -e ${sharePath}/shutdown '.
279+ ' -o -e ${sharePath}/boot-done; do '.
280+ 'sleep 1; i=$(($i + 1)); [ $i -le 3600 ]; '.
281+ 'done'
279282 );
280283 waitForShutdown_${name};
281284 }