aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-05-10 14:50:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-05-10 14:50:42 +0200
commite08751b52c77608eda1bb38e3437167f53e3b06b (patch)
tree4d2363dfdf3dcacaa878bf2bbf84356fb981c54c
parente6153b23d0824abdb324191e1622bfd4226dc38b (diff)
Suspend machine on abnormal build for investigation
-rw-r--r--bbot/agent.cxx33
1 files changed, 18 insertions, 15 deletions
diff --git a/bbot/agent.cxx b/bbot/agent.cxx
index b2d09d1..09156f2 100644
--- a/bbot/agent.cxx
+++ b/bbot/agent.cxx
@@ -171,6 +171,7 @@ bootstrap_machine (const dir_path& md,
}
m->suspend ();
m->wait ();
+ info << "resuming after machine suspension";
return nullopt;
};
@@ -640,7 +641,7 @@ try
try {m->forcedown ();} catch (const failed&) {}
}));
- auto soft_fail = [&xp, &m, &r] (const char* msg, bool wait = true)
+ auto soft_fail = [&xp, &m, &r] (const char* msg)
{
{
diag_record dr (error);
@@ -648,10 +649,8 @@ try
m->print_info (dr);
}
m->suspend ();
-
- if (wait)
- m->wait ();
-
+ m->wait ();
+ info << "resuming after machine suspension";
return r;
};
@@ -700,17 +699,21 @@ try
r.status = result_status::abnormal; // Soft-fail below.
}
- // If the build terminated abnormally, suspent the machine for
- // investigation (note that here we don't wait or return).
- //
if (r.status == result_status::abnormal)
- soft_fail ("build terminated abnormally", false);
-
- // Force the machine down (there is no need wasting time on clean
- // shutdown since the next step is to drop the snapshot). Also fail
- // softly if things go badly.
- //
- try {m->forcedown (false);} catch (const failed&) {}
+ {
+ // If the build terminated abnormally, suspend the machine for
+ // investigation.
+ //
+ return soft_fail ("build terminated abnormally");
+ }
+ else
+ {
+ // Force the machine down (there is no need wasting time on clean
+ // shutdown since the next step is to drop the snapshot). Also fail
+ // softly if things go badly.
+ //
+ try {m->forcedown (false);} catch (const failed&) {}
+ }
}
run_btrfs (trace, "subvolume", "delete", xp);