From a560f529329b9950e5c62b01dba105e9b4679f9d Mon Sep 17 00:00:00 2001 From: "rniwa@webkit.org" Date: Sat, 24 Jan 2015 00:24:26 +0000 Subject: [PATCH] Perf dashboard always assigns the result of A/B testing with build request 1 https://bugs.webkit.org/show_bug.cgi?id=140382 Reviewed by Darin Adler. The bug was caused by the expression array_get($report, 'jobId') or array_get($report, 'buildRequest') which always evaluated to 1 when the report contained jobId. Fixed the bug by cascading array_get instead. Also fixed a typo as well as a bug that reports were never associated with builds. * public/include/report-processor.php: (ReportProcessor::process): Don't use "or" to find the non-null value since that always evaluates to 1 instead of the first non-null value. (ReportProcessor::resolve_build_id): Fixed the typo by adding the missing "$this->". (ReportProcessor::commit): Associate the report with the corresponding build as intended. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179037 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Websites/perf.webkit.org/ChangeLog | 18 ++++++++++++++++++ .../public/include/report-processor.php | 9 +++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Websites/perf.webkit.org/ChangeLog b/Websites/perf.webkit.org/ChangeLog index 519656b6b3b6..3a6c525989cb 100644 --- a/Websites/perf.webkit.org/ChangeLog +++ b/Websites/perf.webkit.org/ChangeLog @@ -1,3 +1,21 @@ +2015-01-23 Ryosuke Niwa + + Perf dashboard always assigns the result of A/B testing with build request 1 + https://bugs.webkit.org/show_bug.cgi?id=140382 + + Reviewed by Darin Adler. + + The bug was caused by the expression array_get($report, 'jobId') or array_get($report, 'buildRequest') + which always evaluated to 1 when the report contained jobId. Fixed the bug by cascading array_get instead. + + Also fixed a typo as well as a bug that reports were never associated with builds. + + * public/include/report-processor.php: + (ReportProcessor::process): Don't use "or" to find the non-null value since that always evaluates to 1 + instead of the first non-null value. + (ReportProcessor::resolve_build_id): Fixed the typo by adding the missing "$this->". + (ReportProcessor::commit): Associate the report with the corresponding build as intended. + 2015-01-23 Ryosuke Niwa Unreviewed typo fix. The prefix in triggerable_configurations is "trigconfig", not "trigrepo". diff --git a/Websites/perf.webkit.org/public/include/report-processor.php b/Websites/perf.webkit.org/public/include/report-processor.php index 52e35a831b86..d1d3a6a3d221 100644 --- a/Websites/perf.webkit.org/public/include/report-processor.php +++ b/Websites/perf.webkit.org/public/include/report-processor.php @@ -90,7 +90,7 @@ class ReportProcessor { // FIXME: Deprecate and unsupport "jobId". $build_id = $this->resolve_build_id($build_data, array_get($report, 'revisions', array()), - array_get($report, 'jobId') or array_get($report, 'buildRequest')); + array_get($report, 'jobId', array_get($report, 'buildRequest'))); $this->runs->commit($platform_id, $build_id); } @@ -129,7 +129,7 @@ class ReportProcessor { $this->exit_with_error('FailedToInsertBuild', $build_data); if ($build_request_id) { - if ($db->update_row('build_requests', 'request', array('id' => $build_request_id), array('status' => 'completed', 'build' => $build_id)) + if ($this->db->update_row('build_requests', 'request', array('id' => $build_request_id), array('status' => 'completed', 'build' => $build_id)) != $build_request_id) $this->exit_with_error('FailedToUpdateBuildRequest', array('buildRequest' => $build_request_id, 'build' => $build_id)); } @@ -439,8 +439,9 @@ class TestRunsGenerator { } } - $this->db->query_and_get_affected_rows("UPDATE reports SET report_committed_at = CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - WHERE report_id = $1", array($this->report_id)); + $this->db->query_and_get_affected_rows("UPDATE reports + SET (report_committed_at, report_build) = (CURRENT_TIMESTAMP AT TIME ZONE 'UTC', $2) + WHERE report_id = $1", array($this->report_id, $build_id)); $this->db->commit_transaction() or $this->exit_with_error('FailedToCommitTransaction'); } -- 2.36.0