From 82019c01bb638b0ce243f14ed74a62c8e5312140 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 22 Jun 2012 14:31:07 -0400 Subject: [PATCH] Test driver: exit when all VMs have exited rather than sleeping forever --- lib/test-driver/test-driver.pl | 8 ++++++++ lib/testing.nix | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/test-driver/test-driver.pl b/lib/test-driver/test-driver.pl index 0fdcf97af67..43f74cf404b 100644 --- a/lib/test-driver/test-driver.pl +++ b/lib/test-driver/test-driver.pl @@ -68,6 +68,14 @@ sub startAll { } +# Wait until all VMs have terminated. +sub joinAll { + $log->nest("waiting for all VMs to finish", sub { + $_->waitForShutdown foreach values %vms; + }); +} + + # In interactive tests, this allows the non-interactive test script to # be executed conveniently. sub testScript { diff --git a/lib/testing.nix b/lib/testing.nix index 704ee4025a5..6a39df8c865 100644 --- a/lib/testing.nix +++ b/lib/testing.nix @@ -157,7 +157,7 @@ rec { ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms wrapProgram $out/bin/nixos-run-vms \ --add-flags "$vms" \ - --set tests '"startAll; sleep 1e9;"' \ + --set tests '"startAll; joinAll;"' \ --set VLANS '"${toString vlans}"' ''; # "