diff --git a/nixos/lib/test-driver/Machine.pm b/nixos/lib/test-driver/Machine.pm index a00fe25c2b8ed..fa2cdc02cf30d 100644 --- a/nixos/lib/test-driver/Machine.pm +++ b/nixos/lib/test-driver/Machine.pm @@ -396,6 +396,16 @@ sub systemctl { return $self->execute("systemctl $q"); } +sub systemdAnalyzeBlame { + my ($self) = @_; + my ($status, $lines) = $self->execute("systemd-analyze blame"); + return undef if $status != 0; + foreach my $line (split /\n/ ,$lines) { + $line =~ s/\s*//; + $self->log($line); + } +} + # Fail if the given systemd unit is not in the "active" state. sub requireActiveUnit { my ($self, $unit) = @_; diff --git a/nixos/lib/test-driver/test-driver.pl b/nixos/lib/test-driver/test-driver.pl index a3354fb0e1eb8..b0074d03bf507 100644 --- a/nixos/lib/test-driver/test-driver.pl +++ b/nixos/lib/test-driver/test-driver.pl @@ -122,6 +122,13 @@ sub runTests { $term->WriteHistory; } + $log->nest("collecting systemd units exection time", sub { + foreach my $vm (values %vms) { + next unless $vm->isUp(); + $vm->systemdAnalyzeBlame(); + } + }); + # Copy the kernel coverage data for each machine, if the kernel # has been compiled with coverage instrumentation. $log->nest("collecting coverage data", sub {