diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-12-30 12:40:29 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-12-30 15:17:52 +0100 |
commit | 146c727924674f1bf59a216b01d8ed5f534c287a (patch) | |
tree | 34e06819f63e4a7018c8f454f4927f10787630fb | |
parent | e78bad526286b392808b613e2435a9d4920d4b79 (diff) | |
download | nixpkgs-146c727924674f1bf59a216b01d8ed5f534c287a.tar nixpkgs-146c727924674f1bf59a216b01d8ed5f534c287a.tar.gz nixpkgs-146c727924674f1bf59a216b01d8ed5f534c287a.tar.bz2 nixpkgs-146c727924674f1bf59a216b01d8ed5f534c287a.tar.lz nixpkgs-146c727924674f1bf59a216b01d8ed5f534c287a.tar.xz nixpkgs-146c727924674f1bf59a216b01d8ed5f534c287a.tar.zst nixpkgs-146c727924674f1bf59a216b01d8ed5f534c287a.zip |
waitForUnit: Fail if the unit reaches inactive state with no pending jobs
This prevents waitForUnit for looping for many minutes before giving up.
-rw-r--r-- | nixos/lib/test-driver/Machine.pm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/lib/test-driver/Machine.pm b/nixos/lib/test-driver/Machine.pm index 41088ed75f7..8ac0a31f287 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"; }; }); |