From adb976a80ba4c22e2410587bd438f4881223bd38 Mon Sep 17 00:00:00 2001 From: drewklein Date: Tue, 31 Jan 2017 12:16:30 -0800 Subject: [PATCH] =?UTF-8?q?updating=20oss-performance=20to=20work=20with?= =?UTF-8?q?=20recent=20changes=20to=20invariant=20sig=E2=80=A6=20(#78)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * updating oss-performance to work with recent changes to invariant signature * updating change to reflect comments * changing %s to %f for a numeric value --- base/BuildChecker.php | 2 +- base/PerfRunner.php | 9 ++++++--- base/PerfTarget.php | 4 +++- base/Siege.php | 2 +- targets/wordpress/WordpressTarget.php | 8 +++----- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/base/BuildChecker.php b/base/BuildChecker.php index b0bd239..31103b9 100644 --- a/base/BuildChecker.php +++ b/base/BuildChecker.php @@ -39,7 +39,7 @@ public static function Check( if ($skipKeys->contains($k)) { continue; } - invariant(is_array($v), $k.' is not an array'); + invariant(is_array($v), '%s is not an array', $k); $v = self::MakeCheckedValue($v); if ($v['OK']) { continue; diff --git a/base/PerfRunner.php b/base/PerfRunner.php index 8b36580..1aed7ba 100644 --- a/base/PerfRunner.php +++ b/base/PerfRunner.php @@ -84,7 +84,8 @@ private static function RunWithOptionsAndEngine( Process::sleepSeconds($options->delayPhpStartup); invariant( $php_engine->isRunning(), - 'Failed to start '.get_class($php_engine), + 'Failed to start %s', + get_class($php_engine), ); if ($target->needsUnfreeze()) { @@ -114,7 +115,8 @@ private static function RunWithOptionsAndEngine( invariant(!$siege->isRunning(), 'Siege is still running :/'); invariant( $php_engine->isRunning(), - get_class($php_engine).' crashed', + '%s crashed', + get_class($php_engine), ); } else { self::PrintProgress('Skipping single request warmup'); @@ -130,7 +132,8 @@ private static function RunWithOptionsAndEngine( invariant(!$siege->isRunning(), 'Siege is still running :/'); invariant( $php_engine->isRunning(), - get_class($php_engine).' crashed', + '%s crashed', + get_class($php_engine), ); } else { self::PrintProgress('Skipping multi request warmup'); diff --git a/base/PerfTarget.php b/base/PerfTarget.php index 1ce9b2d..982a080 100644 --- a/base/PerfTarget.php +++ b/base/PerfTarget.php @@ -30,7 +30,9 @@ final public function sanityCheck(): void { $content = file_get_contents($url, /* include path = */ false, $ctx); invariant( strstr($content, $this->getSanityCheckString()) !== false, - 'Failed to find string "'.$this->getSanityCheckString().'" in '.$url, + 'Failed to find string "%s" in %s', + $this->getSanityCheckString(), + $url, ); } diff --git a/base/Siege.php b/base/Siege.php index 0cc1922..3859af1 100644 --- a/base/Siege.php +++ b/base/Siege.php @@ -146,7 +146,7 @@ protected function getArguments(): Vector { return $arguments; default: invariant_violation( - 'Unexpected request mode: '.(string) $this->mode, + 'Unexpected request mode: %s', (string) $this->mode, ); } } diff --git a/targets/wordpress/WordpressTarget.php b/targets/wordpress/WordpressTarget.php index 20df7ae..f773235 100644 --- a/targets/wordpress/WordpressTarget.php +++ b/targets/wordpress/WordpressTarget.php @@ -100,11 +100,9 @@ private function unfreezeRequest(PerfOptions $options): void { $data = file_get_contents($url, /* include path = */ false, $ctx); invariant( $data !== false, - 'Failed to unfreeze '. - $url. - ' after '. - $options->maxdelayUnfreeze. - ' secs', + 'Failed to unfreeze %s after %f secs', + $url, + $options->maxdelayUnfreeze, ); } }