From 2c8ca08d0407d61af1a00152e3a120a6eff938f9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 18 Apr 2017 13:39:01 +0200 Subject: If build terminates abnormally, suspend machine for investigation --- bbot/agent.cxx | 41 +++++++++++++++++++++++++---------------- 1 file 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 (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 (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) { -- cgit v1.1