From 97dc0af4508f937208c9dbe4b557c04f9ee08dee Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 25 Mar 2019 11:24:40 +0100 Subject: [PATCH 1/3] Fix #77728: pgort140.DLL missing If a PGO build is requested, but a build error occurs after the PGI build has succeeded and before the PGO build has even been attempted (for instance, if the PGO training fails), we may get a bogus archive containing the PGI build, without any hint. We apply a quick fix which requires to run the PGO build if requested, and reports a respective error otherwise. --- script/snap.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/script/snap.php b/script/snap.php index 15804a4..c1d6d3a 100644 --- a/script/snap.php +++ b/script/snap.php @@ -120,6 +120,7 @@ echo "running build in <$build_src_path>\n"; $build->buildconf(); if ($branch->config->getPGO() == 1) { + $need_pgo_build = true; /* For now it is enough to just get a very same build of PHP to setup the environment. This only needs to be done once for setup. In further @@ -137,6 +138,7 @@ $build->configure(' "--enable-pgi" '); } else { + $need_pgo_build = false; $build->configure(); } $build->make(); @@ -153,6 +155,7 @@ $build->configure(' "--with-pgo" ', false); $build->make(); $html_make_log = $build->getMakeLogParsed(); + $need_pgo_build = false; } catch (Exception $e) { echo $e->getMessage() . "\n"; echo $build->log_buildconf; @@ -192,7 +195,11 @@ file_put_contents($toupload_dir . '/logs/make-' . $build_name . '-r'. $last_rev . '.html', $html_make_log); copy(__DIR__ . '/../template/log_style.css', $toupload_dir . '/logs/log_style.css'); - $stats = $build->getStats(); + if ($need_pgo_build) { + $stats = ['warning' => 0, 'error' => 1]; + } else { + $stats = $build->getStats(); + } $json_filename = $build_name . '.json'; @@ -206,8 +213,12 @@ if ($stats['error'] > 0) { $has_build_errors = true; - $build_errors[$build_name] = $build->compiler_log_parser->getErrors(); - $json_data['build_error'] = $build_errors[$build_name]; + if ($need_pgo_build) { + $json_data['build_error'] = ['PGO build not attempted']; + } else { + $build_errors[$build_name] = $build->compiler_log_parser->getErrors(); + $json_data['build_error'] = $build_errors[$build_name]; + } } $json = json_encode($json_data); From 90416bf4c5129a626fee65cb8a87ae96a1fd56b5 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 25 Mar 2019 14:09:40 +0100 Subject: [PATCH 2/3] Don't go on after failure If the PGI build failed, it makes no sense to do the PGO build. If the binaries couldn't be built, it makes no sense to create the archive. --- script/snap.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/script/snap.php b/script/snap.php index c1d6d3a..5ff1d43 100644 --- a/script/snap.php +++ b/script/snap.php @@ -143,26 +143,15 @@ } $build->make(); /* $html_make_log = $build->getMakeLogParsed(); */ - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - echo $build->log_buildconf; - } - if ($branch->config->getPGO() == 1) { - echo "Creating PGO build\n"; - try { + if ($branch->config->getPGO() == 1) { + echo "Creating PGO build\n"; $build->pgoTrain(); $build->make(' clean-pgo'); $build->configure(' "--with-pgo" ', false); $build->make(); $html_make_log = $build->getMakeLogParsed(); $need_pgo_build = false; - } catch (Exception $e) { - echo $e->getMessage() . "\n"; - echo $build->log_buildconf; } - } - - try { $build->makeArchive(); } catch (Exception $e) { echo $e->getMessage() . "\n"; From ced1dad0fe911f696f843bce550ed3b0fedd9340 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 25 Mar 2019 17:01:09 +0100 Subject: [PATCH 3/3] Allow PGO training to fail --- script/snap.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/script/snap.php b/script/snap.php index 5ff1d43..9d8bfb2 100644 --- a/script/snap.php +++ b/script/snap.php @@ -145,7 +145,13 @@ /* $html_make_log = $build->getMakeLogParsed(); */ if ($branch->config->getPGO() == 1) { echo "Creating PGO build\n"; - $build->pgoTrain(); + try { + // if training fails, we still can go on for snaps + $build->pgoTrain(); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + echo $build->log_buildconf; + } $build->make(' clean-pgo'); $build->configure(' "--with-pgo" ', false); $build->make();