/** * validates test dependencies including: * fio Performs actual testing - version 2.0+ required * gnuplot Generates graphs per the SNIA test specification. These graphs * are used in the PDF report * hdparm Used for ATA secure erase (when supported) * util-linux For TRIM operations using `blkdiscard` and `fstrim` (when * supported). Not required if test targets are rotational * wkhtmltopdf Generates PDF version of report - download from * http://wkhtmltopdf.org * zip Archives HTML test report into a single zip file * returns an array containing the missing dependencies (array is empty if * all dependencies are valid) * @param array $options the run options (see BlockStorageTest::getRunOptions) * @return array */ public static function validateDependencies($options) { $dependencies = array('fio' => 'fio'); // reporting dependencies if (!isset($options['noreport']) || !$options['noreport']) { $dependencies['gnuplot'] = 'gnuplot'; $dependencies['zip'] = 'zip'; if (!isset($options['nopdfreport']) || !$options['nopdfreport']) { $dependencies['wkhtmltopdf'] = 'wkhtmltopdf'; } } // ATA secure erase requires hdparm if ((!isset($options['nosecureerase']) || !$options['nosecureerase']) && isset($options['secureerase_pswd'])) { $dependencies['hdparm'] = 'hdparm'; } // non-rotational devices require trim if (!isset($options['notrim']) || !$options['notrim']) { $nonrotational = FALSE; foreach ($options['target'] as $target) { if (!BlockStorageTest::isRotational($target)) { $nonrotational = TRUE; break; } } if (!$nonrotational) { $dependencies['fstrim'] = 'util-linux'; } } return validate_dependencies($dependencies); }
/** * validates dependencies for the chosen benchmark db. returns TRUE if * present, FALSE otherwise * @return boolean */ private final function validateDependencies() { $dependencies = array(); if (isset($this->options['db'])) { switch ($this->options['db']) { case 'bigquery': $dependencies['bq'] = 'Google Cloud SDK'; break; case 'callback': case 'librato': $dependencies['curl'] = 'curl'; break; case 'mysql': $dependencies['mysql'] = 'mysql'; break; case 'postgresql': $dependencies['psql'] = 'postgresql'; break; default: $err = '--db ' . $options['db'] . ' is not valid'; break; } } if ($this->archiver) { $dependencies['curl'] = 'curl'; } if ($dependencies = validate_dependencies($dependencies)) { foreach ($dependencies as $dependency) { print_msg(sprintf('Missing dependence %s', $dependency), isset($this->options['verbose']), __FILE__, __LINE__, TRUE); } } return count($dependencies) > 0 ? FALSE : TRUE; }
/** * validates test dependencies including: * curl Used for throughput testing * dig Used for DNS testing * ping Used for latency testing * traceroute Used to traceroute failed test endpoints * returns an array containing the missing dependencies (array is empty if * all dependencies are valid) * @return array */ public function validateDependencies() { $dependencies = array(); if (isset($this->options['geoiplookup'])) { $dependencies['geoiplookup'] = 'GeoIP'; } if (isset($this->options['traceroute'])) { $dependencies['traceroute'] = 'traceroute'; } if (isset($this->options['collectd_rrd'])) { $dependencies['zip'] = 'zip'; } foreach ($this->options['test'] as $tests) { if (in_array('latency', $tests)) { $dependencies['ping'] = 'ping'; } if (in_array('downlink', $tests) || in_array('uplink', $tests) || in_array('throughput', $tests)) { $dependencies['curl'] = 'curl'; } if (in_array('dns', $tests)) { $dependencies['dig'] = 'dig'; } } return validate_dependencies($dependencies); }