summaryrefslogtreecommitdiffstats
path: root/nixos/lib/test-driver/Machine.pm
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/lib/test-driver/Machine.pm')
-rw-r--r--nixos/lib/test-driver/Machine.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/lib/test-driver/Machine.pm b/nixos/lib/test-driver/Machine.pm
index 41088ed75f7e..8ac0a31f2875 100644
--- a/nixos/lib/test-driver/Machine.pm
+++ b/nixos/lib/test-driver/Machine.pm
@@ -381,6 +381,11 @@ sub waitForUnit {
my $info = $self->getUnitInfo($unit);
my $state = $info->{ActiveState};
die "unit ‘$unit’ reached state ‘$state’\n" if $state eq "failed";
+ if ($state eq "inactive") {
+ my ($status, $jobs) = $self->execute("systemctl list-jobs --full 2>&1");
+ die "unit ‘$unit’ is inactive and there are no pending jobs\n"
+ if $jobs =~ /No jobs/; # FIXME: fragile
+ }
return 1 if $state eq "active";
};
});