diff options
author | Samuel Dionne-Riel <samuel@dionne-riel.com> | 2019-01-08 21:18:27 -0500 |
---|---|---|
committer | Samuel Dionne-Riel <samuel@dionne-riel.com> | 2019-01-11 22:36:31 -0500 |
commit | 1fe0018df81a423a3b85faa09b2f8fdabfe143c3 (patch) | |
tree | 309702bef025624316a0a05cc43a8c6806404d3a /nixos/lib | |
parent | eebd1a9263716a04689a37b6537e50801d376b5e (diff) | |
download | nixpkgs-1fe0018df81a423a3b85faa09b2f8fdabfe143c3.tar nixpkgs-1fe0018df81a423a3b85faa09b2f8fdabfe143c3.tar.gz nixpkgs-1fe0018df81a423a3b85faa09b2f8fdabfe143c3.tar.bz2 nixpkgs-1fe0018df81a423a3b85faa09b2f8fdabfe143c3.tar.lz nixpkgs-1fe0018df81a423a3b85faa09b2f8fdabfe143c3.tar.xz nixpkgs-1fe0018df81a423a3b85faa09b2f8fdabfe143c3.tar.zst nixpkgs-1fe0018df81a423a3b85faa09b2f8fdabfe143c3.zip |
test-driver: Adds time it took to connect to guest in logs
This will make it possible to track whether the time is generous or not when ran on hydra.
Diffstat (limited to 'nixos/lib')
-rw-r--r-- | nixos/lib/test-driver/Machine.pm | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/nixos/lib/test-driver/Machine.pm b/nixos/lib/test-driver/Machine.pm index a00fe25c2b8..8b1f00020cb 100644 --- a/nixos/lib/test-driver/Machine.pm +++ b/nixos/lib/test-driver/Machine.pm @@ -10,6 +10,7 @@ use Cwd; use File::Basename; use File::Path qw(make_path); use File::Slurp; +use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC); my $showGraphics = defined $ENV{'DISPLAY'}; @@ -249,12 +250,15 @@ sub connect { $self->start; + my $now = clock_gettime(CLOCK_MONOTONIC); local $SIG{ALRM} = sub { die "timed out waiting for the VM to connect\n"; }; alarm 300; readline $self->{socket} or die "the VM quit before connecting\n"; alarm 0; $self->log("connected to guest root shell"); + # We're interested in tracking how close we are to `alarm`. + $self->log(sprintf("(connecting took %.2f seconds)", clock_gettime(CLOCK_MONOTONIC) - $now)); $self->{connected} = 1; }); |