diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-18 13:39:01 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-18 13:39:01 +0200 |
commit | 2c8ca08d0407d61af1a00152e3a120a6eff938f9 (patch) | |
tree | 94535765f92e99402354b8187b67d708589c0e70 | |
parent | 0e2f76b6f0ecb4b4c00a4c8001843b3c54bc08ad (diff) |
If build terminates abnormally, suspend machine for investigation
-rw-r--r-- | bbot/agent.cxx | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/bbot/agent.cxx b/bbot/agent.cxx index eed49d6..b2beed8 100644 --- a/bbot/agent.cxx +++ b/bbot/agent.cxx @@ -596,7 +596,7 @@ perform_task (const dir_path& md, try {m->forcedown ();} catch (const failed&) {} })); - auto soft_fail = [&xp, &m, &r] (const char* msg) + auto soft_fail = [&xp, &m, &r] (const char* msg, bool wait = true) { { diag_record dr (error); @@ -604,7 +604,10 @@ perform_task (const dir_path& md, m->print_info (dr); } m->suspend (); - m->wait (); + + if (wait) + m->wait (); + return r; }; @@ -633,6 +636,26 @@ perform_task (const dir_path& md, l3 ([&]{trace << "completed build in " << build_to - to << "s";}); + // Parse the result manifest. + // + r = parse_manifest<result_manifest> (rf, "result"); + + // Update package name/version if the returned value as "unknown". + // + if (r.version == bpkg::version ("0")) + { + assert (r.status == result_status::abnormal); + + r.name = tm.name; + r.version = tm.version; + } + + // 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). // @@ -640,20 +663,6 @@ perform_task (const dir_path& md, } run_btrfs (trace, "subvolume", "delete", xp); - - // Parse the result manifest. - // - r = parse_manifest<result_manifest> (rf, "result"); - - // Update package name/version if the returned value as "unknown". - // - if (r.version == bpkg::version ("0")) - { - assert (r.status == result_status::abnormal); - - r.name = tm.name; - r.version = tm.version; - } } catch (const system_error& e) { |